From 0e794e0a4fbce26b57791634b588626ad40d99b1 Mon Sep 17 00:00:00 2001 From: Roland Mainz Date: Mon, 14 Jun 2004 06:47:31 +0000 Subject: Fix for http://freedesktop.org/bugzilla/show_bug.cgi?id=742 : Add a "-d" option to display only the printer "name" and "description", avoiding the far more expensive query done by "-l" (which opens a connection to the print server and queries all printer attributes). --- xplsprinters.c | 8 ++++++-- xplsprinters.man | 15 +++++++++------ xplsprinters.sgml | 23 ++++++++++++++++------- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/xplsprinters.c b/xplsprinters.c index 92fdd3d..d29a6fd 100644 --- a/xplsprinters.c +++ b/xplsprinters.c @@ -219,7 +219,7 @@ void print_detailed_printer_info(XPPrinterRec *xp_rec, int detailLevel) } printf("printer: %s\n", xp_rec->name); - printf("\tcomment=%s\n", NULLSTR(xp_rec->desc)); + printf("\tdescription=%s\n", NULLSTR(xp_rec->desc)); printf("\tmodel-identifier=%s\n", NULLSTR(XpGetOneAttribute(pdpy, pcontext, XPPrinterAttr, "xp-model-identifier"))); print_medium_sizes(pdpy, pcontext); @@ -245,7 +245,7 @@ void print_printer_info(XPPrinterRec *xp_rec, int detailLevel) if( detailLevel < 1 ) return; - printf("\tcomment=%s\n", NULLSTR(xp_rec->desc)); + printf("\tdescription=%s\n", NULLSTR(xp_rec->desc)); } int main (int argc, char *argv[]) @@ -271,6 +271,10 @@ int main (int argc, char *argv[]) usage (); printername = argv[i]; } + else if( !strncmp("-d", arg, len) ) + { + details = 1; + } else if( !strncmp("-l", arg, len) ) { details = 2; diff --git a/xplsprinters.man b/xplsprinters.man index 3fb4f6b..7fa58ba 100644 --- a/xplsprinters.man +++ b/xplsprinters.man @@ -3,12 +3,12 @@ .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . -.TH "XPLSPRINTERS" "__mansuffix__" "13 February 2004" "" "" +.TH "XPLSPRINTERS" "__mansuffix__" "14 June 2004" "" "" .SH NAME xplsprinters \- shows a list of Xprint printers and it's attributes .SH SYNOPSIS -\fBxplsprinters\fR [ \fB-l\fR] [ \fB-printer \fIprintername\fB\fR] [ \fB-dump\fR] [ \fB-h\fR] +\fBxplsprinters\fR [ \fB-printer \fIprintername\fB\fR] [ \fB-d\fR] [ \fB-l\fR] [ \fB-dump\fR] [ \fB-h\fR] .SH "DESCRIPTION" .PP @@ -18,17 +18,20 @@ of printers and attributes supported for a specific list of printers. .SH "OPTIONS" .TP +\fB-printer \fIprintername\fB \fR +printer to use +.TP \fB-dump \fR dump all available printer attributes .TP \fB-h | -? \fR print usage .TP +\fB-d \fR +print description for each printer +.TP \fB-l \fR list detailed printer attribute information -.TP -\fB-printer \fIprintername\fB \fR -printer to use .SH "ENVIRONMENT" .TP \fBXPSERVERLIST \fR @@ -64,7 +67,7 @@ would print: .nf printer: ps002@castor:18 - comment= + description= model-identifier=HPDJ1600C default-medium=iso-a4 default-input-tray= diff --git a/xplsprinters.sgml b/xplsprinters.sgml index be6b044..99a20ea 100644 --- a/xplsprinters.sgml +++ b/xplsprinters.sgml @@ -27,10 +27,12 @@ manual volume numbers. xplsprinters - - + + + + @@ -53,6 +55,13 @@ manual volume numbers. OPTIONS + + + + + printer to use + + @@ -68,17 +77,17 @@ manual volume numbers. - + - list detailed printer attribute information + print description for each printer - + - printer to use + list detailed printer attribute information @@ -123,7 +132,7 @@ printer: xp_pdf_spooldir_tmp_Xprintjobs@meridian:19 would print: printer: ps002@castor:18 - comment= + description= model-identifier=HPDJ1600C default-medium=iso-a4 default-input-tray= -- cgit v1.2.3