home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / auucp+-1.02 / fuucp_plus_src.lzh / dmail / dmkhelp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-21  |  1.1 KB  |  60 lines

  1.  
  2. /*
  3.  * DMKHELP.C
  4.  *
  5.  *  $Header: Beta:src/uucp/src/dmail/RCS/dmkhelp.c,v 1.1 90/02/02 12:04:11 dillon Exp Locker: dillon $
  6.  *
  7.  *  (C) Copyright 1985-1990 by Matthew Dillon,  All Rights Reserved.
  8.  *
  9.  *  Standalone C source.
  10.  *
  11.  *  Takes the file DMAIL.HELP (or that specified), and puts quotes and
  12.  * commas around each line, the output to stdout.  Used by Makefile to
  13.  * place the help file on line (by making it a static array).  See the
  14.  * Makefile.
  15.  *
  16.  */
  17.  
  18. #include <stdio.h>
  19. #include <string.h>
  20.  
  21. #define HELPC "dmail.help"
  22.  
  23. static char buf[1024];
  24.  
  25. main(argc, argv)
  26. char *argv[];
  27. {
  28.     FILE *fi;
  29.     char *ptr;
  30.     int len;
  31.     register int i;
  32.  
  33.     if (argc == 1)
  34.     fi = fopen (HELPC, "r");
  35.     else
  36.     fi = fopen (argv[1], "r");
  37.     if (fi == NULL) {
  38.     puts ("CANNOT OPEN");
  39.     exit (1);
  40.     }
  41.     while (fgets (buf, 1024, fi)) {
  42.     len = strlen(buf) - 1;
  43.     buf[len] = '\0';
  44.     putchar ('\"');
  45.     for (i = 0; i < len; ++i) {
  46.         if (buf[i] == '\"') {
  47.         putchar ('\\');
  48.         putchar ('\"');
  49.         } else {
  50.         putchar (buf[i]);
  51.         }
  52.     }
  53.     puts ("\",");
  54.     }
  55.     puts ("NULL");
  56.     fclose (fi);
  57. }
  58.  
  59.  
  60.