home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume8 / libhoward / part08 / usage.c < prev    next >
C/C++ Source or Header  |  1989-10-01  |  2KB  |  62 lines

  1. /*
  2.  * usage - write usage string on standard error and exit
  3.  */
  4.  
  5. #ifndef lint
  6. static char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  7. #endif lint
  8.  
  9. /*
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License version 1,
  12.  * as published by the Free Software Foundation.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  */
  23.  
  24. #include <stdio.h>
  25. #include <howard/port.h>
  26. #include <howard/version.h>
  27.  
  28. MODVER ("@(#)$Header: usage.c,v 1.6 89/08/14 09:18:44 howard Exp $");
  29.  
  30. #include <howard/malf.h>
  31. #include <howard/usage.h>
  32.  
  33. PUBLIC void usage()
  34.  
  35. /* Function:
  36.  *    Write a usage message on stderr.
  37.  *    Exit with exit code 1.
  38.  * Algorithm:
  39.  *    If the global _progn is set up, write the program name from it.
  40.  *    Then write the string to which the global _usage points.
  41.  */
  42. {
  43. extern bStrT _usage; /* Usage string.*/
  44.  
  45. FPUTS ("Usage: ", stderr);
  46. putspn();
  47. PUTC (' ', stderr);
  48. FPUTS ((cStrT) _usage, stderr);
  49. PUTC ('\n', stderr);
  50. FFLUSH (stderr);
  51. exit (1);
  52. }
  53.  
  54. #ifdef TEST
  55. MAINVER ("@(#)$Header: usage.c,v 1.6 89/08/14 09:18:44 howard Exp $");
  56. USAGE ("[-a] [-b] {file}");
  57. main()
  58. {
  59. usage();
  60. }
  61. #endif
  62.