aboutsummaryrefslogtreecommitdiff
path: root/printutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-04-27 15:03:34 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2012-04-27 15:03:34 +0200
commit0c62f20454b55a932d59c50b7418b8b634a8a23f (patch)
treef0855e58558970cd0130442d79f8baaa79340aeb /printutils
parentdeee356a629c81aae64ac22266561e9cc4e13e8b (diff)
downloadbusybox-w32-0c62f20454b55a932d59c50b7418b8b634a8a23f.tar.gz
busybox-w32-0c62f20454b55a932d59c50b7418b8b634a8a23f.tar.bz2
busybox-w32-0c62f20454b55a932d59c50b7418b8b634a8a23f.zip
lpr: small code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'printutils')
-rw-r--r--printutils/lpr.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/printutils/lpr.c b/printutils/lpr.c
index fc6bca9e8..748879542 100644
--- a/printutils/lpr.c
+++ b/printutils/lpr.c
@@ -212,12 +212,9 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
212 ); 212 );
213 // delete possible "\nX\n" patterns 213 // delete possible "\nX\n" patterns
214 c = controlfile; 214 c = controlfile;
215 cflen = (unsigned)strlen(controlfile);
216 while ((c = strchr(c, '\n')) != NULL) { 215 while ((c = strchr(c, '\n')) != NULL) {
217 if (c[1] && c[2] == '\n') { 216 if (c[1] && c[2] == '\n') {
218 /* can't use strcpy, results are undefined */ 217 overlapping_strcpy(c, c+2);
219 memmove(c, c+2, cflen - (c-controlfile) - 1);
220 cflen -= 2;
221 } else { 218 } else {
222 c++; 219 c++;
223 } 220 }
@@ -228,6 +225,7 @@ int lpqr_main(int argc UNUSED_PARAM, char *argv[])
228 bb_error_msg("sending control file"); 225 bb_error_msg("sending control file");
229 /* "Acknowledgement processing must occur as usual 226 /* "Acknowledgement processing must occur as usual
230 * after the command is sent." */ 227 * after the command is sent." */
228 cflen = (unsigned)strlen(controlfile);
231 fdprintf(fd, "\x2" "%u c%s\n", cflen, remote_filename); 229 fdprintf(fd, "\x2" "%u c%s\n", cflen, remote_filename);
232 get_response_or_say_and_die(fd, "sending control file"); 230 get_response_or_say_and_die(fd, "sending control file");
233 /* "Once all of the contents have 231 /* "Once all of the contents have