Annotation of researchv9/X11/src/X.V11R1/lib/X/XGetFPath.c, revision 1.1.1.1

1.1       root        1: #include "copyright.h"
                      2: 
                      3: /* $Header: XGetFPath.c,v 11.11 87/09/11 08:03:58 toddb Exp $ */
                      4: /* Copyright    Massachusetts Institute of Technology    1986  */
                      5: 
                      6: #define NEED_REPLIES
                      7: #include "Xlibint.h"
                      8: 
                      9: char **XGetFontPath(dpy, npaths)
                     10: register Display *dpy;
                     11: int *npaths;
                     12: {
                     13:        xGetFontPathReply rep;
                     14:        register long nbytes;
                     15:        char **flist;
                     16:        char *ch;
                     17:        register int i;
                     18:        register int length;
                     19:        register xReq *req;
                     20: 
                     21:        LockDisplay(dpy);
                     22:        GetEmptyReq (GetFontPath, req);
                     23:        (void) _XReply (dpy, (xReply *) &rep, 0, xFalse);
                     24:        if (*npaths = rep.nPaths) {
                     25:            flist = (char **) Xmalloc ((unsigned)*npaths * sizeof (char *));
                     26:            nbytes = (long)rep.length << 2;
                     27:            ch = (char *) Xmalloc ((unsigned) (nbytes + 1));
                     28:                 /* +1 to leave room for last null-terminator */
                     29:            _XReadPad (dpy, ch, nbytes);
                     30:            /*
                     31:             * unpack into null terminated strings.
                     32:             */
                     33:            length = *ch;
                     34:            for (i = 0; i < rep.nPaths; i++) {
                     35:                flist[i] = ch+1;  /* skip over length */
                     36:                ch += length + 1; /* find next length ... */
                     37:                length = *ch;
                     38:                *ch = '\0'; /* and replace with null-termination */
                     39:            }
                     40:        }
                     41:        else flist = NULL;
                     42:        UnlockDisplay(dpy);
                     43:        SyncHandle();
                     44:        return (flist);
                     45: }
                     46: 
                     47: XFreeFontPath (list)
                     48: char **list;
                     49: {
                     50:        if (list != NULL) {
                     51:                Xfree (list[0]-1);
                     52:                Xfree ((char *)list);
                     53:        }
                     54: }

unix.superglobalmegacorp.com

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