Annotation of researchv10no/cmd/dimpress/main.c, revision 1.1

1.1     ! root        1: 
        !             2: 
        !             3: /*
        !             4:  *
        !             5:  * Template for normal C programs. All the code was written with standard
        !             6:  * tab settings, ie. every eighth column. Options are processed in routine
        !             7:  * options() using getopt(). The non-option arguments are handled in
        !             8:  * arguments(). To add a new option add its name to string *name and an
        !             9:  * appropriate case to the switch in options() (see getopt in section 3
        !            10:  * of the UNIX manual). You'll also need to add a bunch of code to handle
        !            11:  * the non-option arguments.
        !            12:  *
        !            13:  */
        !            14: 
        !            15: 
        !            16: #include <stdio.h>
        !            17: 
        !            18: #include "gen.h"                       /* general purpose definitions */
        !            19: #include "ext.h"                       /* external variable declarations */
        !            20: 
        !            21: 
        !            22: /*****************************************************************************/
        !            23: 
        !            24: 
        !            25: main(agc, agv)
        !            26: 
        !            27: 
        !            28:     int                agc;
        !            29:     char       *agv[];
        !            30: 
        !            31: 
        !            32: {
        !            33: 
        !            34: 
        !            35: /*
        !            36:  *
        !            37:  *
        !            38:  */
        !            39: 
        !            40: 
        !            41:     argc = agc;                                /* other routines may want them */
        !            42:     argv = agv;
        !            43: 
        !            44:     prog_name = argv[0];               /* really just for error messages */
        !            45: 
        !            46:     options();                         /* first get command line options */
        !            47:     arguments();                       /* then process non-option arguments */
        !            48: 
        !            49:     exit(x_stat);                      /* everything probably went OK */
        !            50: 
        !            51: }   /* End of main */
        !            52: 
        !            53: 
        !            54: /*****************************************************************************/
        !            55: 
        !            56: 
        !            57: options()
        !            58: 
        !            59: 
        !            60: {
        !            61: 
        !            62: 
        !            63:     int                ch;                     /* return value from getopt() */
        !            64:     char       *names = "DIF:R:o:";
        !            65: 
        !            66:     extern char        *optarg;                /* used by getopt() */
        !            67:     extern int optind;
        !            68: 
        !            69: 
        !            70: /*
        !            71:  *
        !            72:  * Reads and processes the command line options. Right now the recognized
        !            73:  * options are,
        !            74:  *
        !            75:  */
        !            76: 
        !            77: 
        !            78:     while ( (ch = getopt(argc, argv, names)) != EOF )  {
        !            79: 
        !            80:        switch ( ch )  {
        !            81: 
        !            82:            case 'o':                   /* processing range list */
        !            83:                    out_list(optarg);
        !            84:                    break;
        !            85: 
        !            86:            case 'F':                   /* new troff font directory */
        !            87:                    fontdir = optarg;
        !            88:                    break;
        !            89: 
        !            90:            case 'R':                   /* set raster table directory */
        !            91:                    rastdir = optarg;
        !            92:                    break;
        !            93: 
        !            94:            case 'D':                   /* debug flag */
        !            95:                    debug = ON;
        !            96:                    break;
        !            97: 
        !            98:            case 'I':                   /* ignore FATAL errors */
        !            99:                    ignore = ON;
        !           100:                    break;
        !           101: 
        !           102:            case '?':                   /* don't understand the option */
        !           103:                    error(FATAL, "");
        !           104:                    break;
        !           105: 
        !           106:            default:                    /* don't know what to do for ch */
        !           107:                    error(FATAL, "missing case for option %c\n", ch);
        !           108:                    break;
        !           109: 
        !           110:        }   /* End switch */
        !           111: 
        !           112:     }   /* End while */
        !           113: 
        !           114:     argc -= optind;                    /* get ready for non-option args */
        !           115:     argv += optind;
        !           116: 
        !           117: }   /* End of options */
        !           118: 
        !           119: 
        !           120: /*****************************************************************************/
        !           121: 
        !           122: 
        !           123: arguments()
        !           124: 
        !           125: 
        !           126: {
        !           127: 
        !           128: 
        !           129:     char       *file;
        !           130:     int                size;
        !           131:     int                i;
        !           132: 
        !           133: 
        !           134: /*
        !           135:  *
        !           136:  * Makes sure all the non-option command line arguments are processed.
        !           137:  *
        !           138:  */
        !           139: 
        !           140: 
        !           141:     if ( argc < 1 )
        !           142:        printf("No non-option arguments\n");
        !           143:     else  {                            /* have at least one argument */
        !           144:        while ( argc > 0 )  {
        !           145:            file = *argv++;
        !           146:            argc--;
        !           147:            size = atoi(*argv);
        !           148:            fprintf(stderr, "Get raster file for %s.r%d\n", file, size);
        !           149:            getrastdata(file, size);
        !           150:            for ( i = 0; i < 127; i++ ) dump_glyph(i);
        !           151:            argc--;
        !           152:            argv++;
        !           153:        }   /* End while */
        !           154:     }   /* End else */
        !           155: 
        !           156: }   /* End of arguments */
        !           157: 
        !           158: 
        !           159: /*****************************************************************************/
        !           160: 
        !           161: 

unix.superglobalmegacorp.com

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