DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T x

⟦f30677a11⟧ TextFile

    Length: 1615 (0x64f)
    Types: TextFile
    Names: »xsetfp.c«

Derivation

└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦8e9e227a9⟧ 
            └─⟦0b3b13f5b⟧ 
                └─ ⟦this⟧ »./xsetfp.c« 

TextFile

/******************************************************************************
 * Description
 *	Connect to a display and set the current font path based on arguments.
 *****************************************************************************/


#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <stdio.h>

#define TRUE  1
#define FALSE 0

char *ProgramName;
Display *dpy;

static char *help_message[] = {
"where options include:",
"    -display host:dpy                X server to use",
NULL};

/******************************************************************************
 * Description
 *	Main routine.  Process command-line arguments, then get the info.
 *****************************************************************************/

main(argc, argv)
int argc;
char **argv;
{
    char	*Paths[1024];
    int		 NPaths = 0;
    char 	*display = NULL;
    char	**tmpv = argv;

    /* Process arguments: */

    while (*++tmpv) {
	if (!strcmp (*tmpv, "-display")) {
	    display = *++tmpv;
	} else {
	    Paths[NPaths++] = *tmpv;
	}
    }

    if (NPaths == 0) {
	char **cpp;

	fprintf (stderr, "usage:  %s [-options] <dirs>\n\n",
		 argv[0]);
	for (cpp = help_message; *cpp; cpp++) {
	    fprintf (stderr, "%s\n", *cpp);
	}
	fprintf (stderr, "\n");
	exit (1);
    }

    if (!(dpy= XOpenDisplay(display))) {
	perror("Cannot open display\n"); 
	exit(-1);
    }

    XSetFontPath( dpy, Paths, NPaths );

    {   int	  	  NPaths;
	char	**FP = XGetFontPath( dpy, &NPaths );
	int		  i;

	for (i = 0; i < NPaths; ++i) {
	    printf( "%s\n", FP[i] );
	}
    }

    XCloseDisplay(dpy);
}