home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 21 / CD_ASCQ_21_040595.iso / dos / prg / c / freedos3 / source / jh_utils / ver.c < prev    next >
C/C++ Source or Header  |  1995-01-07  |  2KB  |  86 lines

  1. /*
  2.    This program is free software; you can redistribute it and/or modify
  3.    it under the terms of the GNU General Public License as published by
  4.    the Free Software Foundation; either version 2 of the License, or
  5.    (at your option) any later version.
  6.  
  7.    This program is distributed in the hope that it will be useful,
  8.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.    GNU General Public License for more details.
  11.  
  12.    You should have received a copy of the GNU General Public License
  13.    along with this program; if not, write to the Free Software
  14.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15.    */
  16.  
  17. /**************************************************************************
  18.  * This program displays the DOS version number and a pre-defined Free-DOS
  19.  * release version.  You will need to recompile this program each time you
  20.  * make a major Free-DOS release.
  21.  *
  22.  * NOTE: Please refer to this project as "Free-DOS", not "FreeDOS".  I like
  23.  * to use that dash.  The reason is that there was once a dispute between
  24.  * Free-DOS and another group called "Freedos" with different goals.
  25.  *
  26.  * Author: James Hall
  27.  */
  28.  
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31. #include "getopt.h"
  32. #include "freedos.h"
  33.  
  34. #define SPACE "   "
  35.  
  36.  
  37. void usage (void);
  38.  
  39.  
  40. main (int argc, char **argv)
  41. {
  42.   char c;
  43.   int iDos = 0;
  44.  
  45.   /* Scan the command line */
  46.  
  47.   while ((c = getopt (argc, argv, "dD?")) != EOF)
  48.     {
  49.       switch (c)
  50.     {
  51.     case 'd':
  52.     case 'D':
  53.       /* Dos only! */
  54.       iDos = 1;
  55.       break;
  56.     default:
  57.       usage ();
  58.       break;
  59.     }
  60.     }
  61.  
  62.   if ((argc - optind) > 0)
  63.     usage ();
  64.  
  65.   /* Display the version numbers */
  66.   /* _osmajor and _osminor from Quick-C display the version numbers
  67.      for DOS */
  68.  
  69.   printf ("\n%sDOS version %u.%2.2u", SPACE, _osmajor, _osminor);
  70.  
  71.   if (!iDos)
  72.     printf ("%sFree-DOS version %s", SPACE, VER_REL);
  73.  
  74.   printf ("\n");
  75.   exit (0);
  76. }
  77.  
  78. void 
  79. usage (void)
  80. {
  81.   printp ("VER", "Prints the DOS version and the major Free-DOS release.");
  82.   printu ("VER", "[/D]");
  83.   printo ("/D", "Display the DOS version number only.");
  84.   exit (1);
  85. }
  86.