Annotation of researchv9/X11/src/X.V11R1/fonts/compiler/showsnf.c, revision 1.1

1.1     ! root        1: /* 
        !             2:  * $Locker:  $ 
        !             3:  */ 
        !             4: static char    *rcsid = "$Header: showsnf.c,v 1.3 87/07/24 14:54:26 toddb Exp $";
        !             5: #include <stdio.h>
        !             6: #include <sys/types.h> 
        !             7: #include <sys/file.h> 
        !             8: #include <sys/stat.h> 
        !             9: #include <errno.h> 
        !            10: /* #include <malloc.h> */      extern char *malloc(), *realloc();
        !            11: 
        !            12: #include "misc.h"
        !            13: #include "Xmd.h"
        !            14: #include "X.h"
        !            15: #include "Xproto.h"
        !            16: #include "fontstruct.h"
        !            17: #include "font.h"
        !            18: 
        !            19: #include "fc.h"        /* used by converters only */
        !            20: char *program;
        !            21: 
        !            22: int glyphPad = DEFAULTGLPAD;
        !            23: int bitorder = DEFAULTBITORDER;
        !            24: 
        !            25: main(argc, argv)
        !            26:        int     argc;
        !            27:        char    **argv;
        !            28: {
        !            29:        int     verbose = 0,
        !            30:                fontcnt = 0;
        !            31: 
        !            32:        program = *argv;
        !            33:        for (argc--, argv++; argc; argc--, argv++) {
        !            34:                if (argv[0][0] == '-')
        !            35:                        switch(argv[0][1]) {
        !            36:                        case 'v':       verbose++; break;
        !            37:                        case 'm':       bitorder = MSBFirst; break;
        !            38:                        case 'l':       bitorder = LSBFirst; break;
        !            39:                        default:        usage(); break;
        !            40:                        }
        !            41:                else {
        !            42:                        showfont(argv[0], verbose);
        !            43:                        fontcnt++;
        !            44:                }
        !            45:        }
        !            46:        if (!fontcnt)
        !            47:                usage();
        !            48:        exit(0);
        !            49: }
        !            50: 
        !            51: usage()
        !            52: {
        !            53:        fprintf(stderr, "Usage: %s [-v] fontfile ...\n", program);
        !            54:        exit(1);
        !            55: }
        !            56: 
        !            57: showfont(file, verbose)
        !            58:        char    *file;
        !            59:        int     verbose;
        !            60: {
        !            61:        char    *buf;
        !            62:        struct stat     st;
        !            63:        TempFont        tf;
        !            64:        FontInfoRec f;
        !            65:        int     fd, i, strings;
        !            66: 
        !            67:        if (stat(file, &st) < 0) {
        !            68:                fprintf(stderr, "can't stat %s\n", file);
        !            69:                exit(1);
        !            70:        }
        !            71: 
        !            72:        fd = open(file, O_RDONLY);
        !            73:        if (fd < 0) {
        !            74:                fprintf(stderr, "can't open %s\n", file);
        !            75:                exit(1);
        !            76:        }
        !            77:        buf = malloc(st.st_size);
        !            78:        read(fd, buf, st.st_size);
        !            79:        close(fd);
        !            80: 
        !            81:        tf.pFI = (FontInfoPtr)buf;
        !            82:        tf.pCI = (CharInfoPtr)(buf + BYTESOFFONTINFO(tf.pFI));
        !            83:        tf.pGlyphs = ((unsigned char *)tf.pCI) + BYTESOFCHARINFO(tf.pFI);
        !            84:        tf.pFP = (FontPropPtr)(tf.pGlyphs + BYTESOFGLYPHINFO(tf.pFI));
        !            85:        strings = (int)tf.pFP + BYTESOFPROPINFO(tf.pFI);
        !            86: 
        !            87:        for (i=0; i<tf.pFI->nProps; i++) {
        !            88:                tf.pFP[i].name += strings;
        !            89:                if (tf.pFP[i].indirect)
        !            90:                        tf.pFP[i].value += strings;
        !            91:        }
        !            92:        printf("\n\n-------------  %s  ---------------\n\n", file);
        !            93:        DumpFont(&tf, verbose);
        !            94:        free(buf);
        !            95: }

unix.superglobalmegacorp.com

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