aboutsummaryrefslogtreecommitdiff
path: root/printutils/lpr.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-24 23:32:36 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-24 23:32:36 +0000
commitf99afb5dff00534df6cf8f4d9de5d274c7818eac (patch)
tree72eb7ab8b462f2adf8adc8d7ffeef3cf9c1135cc /printutils/lpr.c
parenta2f47358eb5479d65510b0eb506d52435ca26c21 (diff)
downloadbusybox-w32-f99afb5dff00534df6cf8f4d9de5d274c7818eac.tar.gz
busybox-w32-f99afb5dff00534df6cf8f4d9de5d274c7818eac.tar.bz2
busybox-w32-f99afb5dff00534df6cf8f4d9de5d274c7818eac.zip
lpd: new applet by Vladimir Dronnikov <dronnikov AT gmail.com>
Diffstat (limited to 'printutils/lpr.c')
-rw-r--r--printutils/lpr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/printutils/lpr.c b/printutils/lpr.c
index 86fcd9b1b..52983bfb7 100644
--- a/printutils/lpr.c
+++ b/printutils/lpr.c
@@ -19,6 +19,7 @@
19 */ 19 */
20static void get_response_or_say_and_die(const char *errmsg) 20static void get_response_or_say_and_die(const char *errmsg)
21{ 21{
22 static const char newline = '\n';
22 char buf = ' '; 23 char buf = ' ';
23 24
24 fflush(stdout); 25 fflush(stdout);
@@ -28,8 +29,9 @@ static void get_response_or_say_and_die(const char *errmsg)
28 // request has failed 29 // request has failed
29 bb_error_msg("error while %s. Server said:", errmsg); 30 bb_error_msg("error while %s. Server said:", errmsg);
30 safe_write(STDERR_FILENO, &buf, 1); 31 safe_write(STDERR_FILENO, &buf, 1);
31 logmode = 0; /* no errors from bb_copyfd_eof() */ 32 logmode = 0; /* no error messages from bb_copyfd_eof() pls */
32 bb_copyfd_eof(STDOUT_FILENO, STDERR_FILENO); 33 bb_copyfd_eof(STDOUT_FILENO, STDERR_FILENO);
34 safe_write(STDERR_FILENO, &newline, 1);
33 xfunc_die(); 35 xfunc_die();
34 } 36 }
35} 37}
@@ -190,8 +192,12 @@ int lpqr_main(int argc, char *argv[])
190 , remote_filename 192 , remote_filename
191 ); 193 );
192 // delete possible "\nX\n" patterns 194 // delete possible "\nX\n" patterns
193 while ((c = strchr(controlfile, '\n')) != NULL && c[1] && c[2] == '\n') 195 c = controlfile;
194 memmove(c, c+2, strlen(c+1)); /* strlen(c+1) == strlen(c+2) + 1 */ 196 while ((c = strchr(c, '\n')) != NULL) {
197 c++;
198 while (c[0] && c[1] == '\n')
199 memmove(c, c+2, strlen(c+1)); /* strlen(c+1) == strlen(c+2) + 1 */
200 }
195 201
196 // send control file 202 // send control file
197 if (opts & LPR_V) 203 if (opts & LPR_V)