1: /*
   2:  *  mkindx.c - utility to format a nice index to source files, etc.
   3:  *
   4:  *  usage:  mkindx "title string" [file_name] [filename] .....
   5:  */
   6: 
   7: # include   <stdio.h>
   8: 
   9: char id_mkindx[] = "@(#)mkindx.c	1.1";
  10: 
  11: char list[10000] = "pwd >>index; echo \" \" >>index; ls -l ";
  12: char *apndx = ">>index";
  13: char *cp = list;
  14: extern char *ctime();
  15: FILE *fopen(), *index;
  16: 
  17: main (argc, argv)
  18: char **argv;
  19: {
  20:     short i;
  21:     long time(), t;
  22: 
  23:     if (index = fopen ("index", "w"))
  24:     {
  25:         fprintf (index, "\n\n\n\n\n\n\n\n\n");
  26:         center (argv[1]);   /* center title on page */
  27:         t = time(0);
  28:         center (ctime(&t));   /* center date & time */
  29:         fprintf (index, "\n");
  30:         fclose (index);
  31:         while (*cp) cp++;   /* find end of shell command */
  32:         for (i = 2; i < argc; i++)
  33:         {
  34:             while (*argv[i]) *cp++ = *(argv[i]++);
  35:             *cp++ = ' ';
  36:         }
  37:         while (*apndx) *cp++ = *apndx++;
  38:         *cp = '\0';
  39:         system (list);
  40:     }
  41:     else fprintf (stderr, "mkindx: can't open index\n");
  42: }
  43: 
  44: center (string)
  45: char *string;
  46: {
  47:     short pad;
  48: 
  49:     pad = (72 - strlen(string)) >> 1;
  50:     while (pad-- > 0) fputc(' ', index);
  51:     fprintf (index, "%s\n", string);
  52: }

Defined functions

center defined in line 44; used 2 times
main defined in line 17; never used

Defined variables

apndx defined in line 12; used 2 times
  • in line 37(2)
cp defined in line 13; used 6 times
id_mkindx defined in line 9; never used
list defined in line 11; used 2 times
Last modified: 1983-05-20
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 764
Valid CSS Valid XHTML 1.0 Strict