From aa117205949e38efa5befcef3b206a8ea582109f Mon Sep 17 00:00:00 2001 From: Roland Mainz Date: Wed, 6 Oct 2004 19:29:59 +0000 Subject: Fix for https://freedesktop.org/bugzilla/show_bug.cgi?id=1518 - Add filter support to "xlsfonts" that it can filter builtin-, glyph- and/or other kinds of printer fonts (controlled by the xp-listfonts-modes attribute as described in the CDE DtPrint and Xprint specifications). --- dsimple.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 103 insertions(+), 6 deletions(-) (limited to 'dsimple.c') diff --git a/dsimple.c b/dsimple.c index 8cdce02..c84ac3b 100644 --- a/dsimple.c +++ b/dsimple.c @@ -41,6 +41,9 @@ from The Open Group. * Written by Mark Lillibridge. Last updated 7/1/87 */ +#ifdef BUILD_PRINTSUPPORT +#include +#endif /* BUILD_PRINTSUPPORT */ #include "dsimple.h" /* @@ -55,9 +58,13 @@ from The Open Group. /* This stuff is defined in the calling program by just_display.h */ -char *program_name = "unknown_program"; -Display *dpy; -int screen; +char *program_name = "unknown_program"; +Display *dpy = NULL; +int screen = 0; +Bool printer_output = False; /* Video or printer output ? */ +#ifdef BUILD_PRINTSUPPORT +XPContext pcontext = None; +#endif /* BUILD_PRINTSUPPORT */ static void _bitmap_error(int, char *); @@ -131,6 +138,43 @@ char *Get_Display_Name(pargc, argv) } +#ifdef BUILD_PRINTSUPPORT +/* + * Get_Printer_Name (argc, argv) Look for -printer, -p, + * If found, remove it from command line. Don't go past a lone -. + */ +char *Get_Printer_Name(pargc, argv) + int *pargc; /* MODIFIED */ + char **argv; /* MODIFIED */ +{ + int argc = *pargc; + char **pargv = argv+1; + char *printername = NULL; + int i; + + for (i = 1; i < argc; i++) { + char *arg = argv[i]; + + if (!strcmp (arg, "-printer") || !strcmp (arg, "-p")) { + if (++i >= argc) usage (); + + printername = argv[i]; + *pargc -= 2; + continue; + } + if (!strcmp(arg,"-")) { + while (i