diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-22 23:21:31 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-22 23:21:31 +0000 |
commit | 86620756d2143bd8728c3160db4096169f7c6fc0 (patch) | |
tree | 67f59739ad7f4ac156da6e86899a0f96bda1017b | |
parent | 32b2a9fd6a758602b149248bef8963466b05a088 (diff) | |
download | busybox-w32-86620756d2143bd8728c3160db4096169f7c6fc0.tar.gz busybox-w32-86620756d2143bd8728c3160db4096169f7c6fc0.tar.bz2 busybox-w32-86620756d2143bd8728c3160db4096169f7c6fc0.zip |
lpr: document options better
-rw-r--r-- | printutils/lpr.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/printutils/lpr.c b/printutils/lpr.c index b8c77bfc3..865071011 100644 --- a/printutils/lpr.c +++ b/printutils/lpr.c | |||
@@ -53,32 +53,32 @@ int lpr_main(int argc, char *argv[]) | |||
53 | const char *jobtitle; | 53 | const char *jobtitle; |
54 | const char *hostname; | 54 | const char *hostname; |
55 | const char *jobclass; | 55 | const char *jobclass; |
56 | char *logname; | 56 | char *username; |
57 | int pid1000; | 57 | int pid1000; |
58 | int server_sock, tmp_fd; | 58 | int server_sock, tmp_fd; |
59 | unsigned opt; | 59 | unsigned opt; |
60 | enum { | 60 | enum { |
61 | VERBOSE = 1 << 0, | 61 | VERBOSE = 1 << 0, |
62 | USE_HEADER = 1 << 1, /* -h banner or header for this job */ | 62 | USE_HEADER = 1 << 1, /* -h: want banner printed */ |
63 | USE_MAIL = 1 << 2, /* send mail to user@hostname */ | 63 | USE_MAIL = 1 << 2, /* -m: send mail back to user */ |
64 | OPT_U = 1 << 3, /* -U <username> */ | 64 | OPT_U = 1 << 3, /* -U username */ |
65 | OPT_J = 1 << 4, /* -J <title> is the jobtitle for the banner page */ | 65 | OPT_J = 1 << 4, /* -J title: the job title for the banner page */ |
66 | OPT_C = 1 << 5, /* -C <class> job classification */ | 66 | OPT_C = 1 << 5, /* -C class: job "class" (? supposedly printed on banner) */ |
67 | OPT_P = 1 << 6, /* -P <queue[@host[:port]]> */ | 67 | OPT_P = 1 << 6, /* -P queue[@host[:port]] */ |
68 | /* if no -P is given use $PRINTER, then "lp@localhost:515" */ | 68 | /* if no -P is given use $PRINTER, then "lp@localhost:515" */ |
69 | }; | 69 | }; |
70 | 70 | ||
71 | /* Set defaults, parse options */ | 71 | /* Set defaults, parse options */ |
72 | hostname = mygethostname31(); | 72 | hostname = mygethostname31(); |
73 | netopt = NULL; | 73 | netopt = NULL; |
74 | logname = getenv("LOGNAME"); | 74 | username = getenv("LOGNAME"); |
75 | if (logname == NULL) | 75 | if (username == NULL) |
76 | logname = (char*)"user"; /* TODO: getpwuid(getuid())->pw_name? */ | 76 | username = (char*)"user"; /* TODO: getpwuid(getuid())->pw_name? */ |
77 | opt = getopt32(argv, "VhmU:J:C:P:", | 77 | opt = getopt32(argv, "VhmU:J:C:P:", |
78 | &logname, &jobtitle, &jobclass, &netopt); | 78 | &username, &jobtitle, &jobclass, &netopt); |
79 | argv += optind; | 79 | argv += optind; |
80 | parse_prt(netopt, &netprint); | 80 | parse_prt(netopt, &netprint); |
81 | logname = xstrndup(logname, 31); | 81 | username = xstrndup(username, 31); |
82 | 82 | ||
83 | /* For stdin we need to save it to a tempfile, | 83 | /* For stdin we need to save it to a tempfile, |
84 | * otherwise we can't know the size. */ | 84 | * otherwise we can't know the size. */ |
@@ -127,18 +127,18 @@ int lpr_main(int argc, char *argv[]) | |||
127 | /* H HOST, P USER, l DATA_FILE_NAME, J JOBNAME */ | 127 | /* H HOST, P USER, l DATA_FILE_NAME, J JOBNAME */ |
128 | strings[0] = xasprintf("H%.32s\n" "P%.32s\n" "l%.32s\n" | 128 | strings[0] = xasprintf("H%.32s\n" "P%.32s\n" "l%.32s\n" |
129 | "J%.99s\n", | 129 | "J%.99s\n", |
130 | hostname, logname, dfa_name, | 130 | hostname, username, dfa_name, |
131 | !(opt & OPT_J) ? *argv : jobtitle); | 131 | (opt & OPT_J) ? jobtitle : *argv); |
132 | sptr = &strings[1]; | 132 | sptr = &strings[1]; |
133 | /* C CLASS - printed on banner page (if L cmd is also given) */ | 133 | /* C CLASS - printed on banner page (if L cmd is also given) */ |
134 | if (opt & OPT_J) /* [1] */ | 134 | if (opt & OPT_C) /* [1] */ |
135 | *sptr++ = xasprintf("C%.32s\n", jobclass); | 135 | *sptr++ = xasprintf("C%.32s\n", jobclass); |
136 | /* M WHOM_TO_MAIL */ | 136 | /* M WHOM_TO_MAIL */ |
137 | if (opt & USE_MAIL) /* [2] */ | 137 | if (opt & USE_MAIL) /* [2] */ |
138 | *sptr++ = xasprintf("M%.32s\n", logname); | 138 | *sptr++ = xasprintf("M%.32s\n", username); |
139 | /* H USER - print banner page, with given user's name */ | 139 | /* H USER - print banner page, with given user's name */ |
140 | if (opt & USE_HEADER) /* [3] */ | 140 | if (opt & USE_HEADER) /* [3] */ |
141 | *sptr++ = xasprintf("L%.32s\n", logname); | 141 | *sptr++ = xasprintf("L%.32s\n", username); |
142 | *sptr = NULL; /* [4] max */ | 142 | *sptr = NULL; /* [4] max */ |
143 | 143 | ||
144 | /* RFC 1179: "LPR servers MUST be able | 144 | /* RFC 1179: "LPR servers MUST be able |