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

Defined functions

center defined in line 50; used 2 times
main defined in line 23; never used

Defined variables

apndx defined in line 18; used 2 times
  • in line 43(2)
cp defined in line 19; used 6 times
id_mkindx defined in line 15; never used
list defined in line 17; used 2 times
Last modified: 1987-02-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2253
Valid CSS Valid XHTML 1.0 Strict