Annotation of 43BSDTahoe/usr.lib/libI77/mkindx.c, revision 1.1

1.1     ! root        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: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.