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

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

unix.superglobalmegacorp.com

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