From f99afb5dff00534df6cf8f4d9de5d274c7818eac Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 24 Feb 2008 23:32:36 +0000 Subject: lpd: new applet by Vladimir Dronnikov --- printutils/Config.in | 6 ++++++ printutils/Kbuild | 1 + printutils/lpr.c | 12 +++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'printutils') diff --git a/printutils/Config.in b/printutils/Config.in index b53b9e7fa..e5f18646c 100644 --- a/printutils/Config.in +++ b/printutils/Config.in @@ -1,5 +1,11 @@ menu "print support" +config LPD + bool "lpd" + default n + help + lpd is a print spooling daemon. + config LPR bool "lpr" default n diff --git a/printutils/Kbuild b/printutils/Kbuild index 4f97d0d15..008290ee9 100644 --- a/printutils/Kbuild +++ b/printutils/Kbuild @@ -4,5 +4,6 @@ lib-y := +lib-$(CONFIG_LPD) += lpd.o lib-$(CONFIG_LPR) += lpr.o lib-$(CONFIG_LPQ) += lpr.o 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 @@ */ static void get_response_or_say_and_die(const char *errmsg) { + static const char newline = '\n'; char buf = ' '; fflush(stdout); @@ -28,8 +29,9 @@ static void get_response_or_say_and_die(const char *errmsg) // request has failed bb_error_msg("error while %s. Server said:", errmsg); safe_write(STDERR_FILENO, &buf, 1); - logmode = 0; /* no errors from bb_copyfd_eof() */ + logmode = 0; /* no error messages from bb_copyfd_eof() pls */ bb_copyfd_eof(STDOUT_FILENO, STDERR_FILENO); + safe_write(STDERR_FILENO, &newline, 1); xfunc_die(); } } @@ -190,8 +192,12 @@ int lpqr_main(int argc, char *argv[]) , remote_filename ); // delete possible "\nX\n" patterns - while ((c = strchr(controlfile, '\n')) != NULL && c[1] && c[2] == '\n') - memmove(c, c+2, strlen(c+1)); /* strlen(c+1) == strlen(c+2) + 1 */ + c = controlfile; + while ((c = strchr(c, '\n')) != NULL) { + c++; + while (c[0] && c[1] == '\n') + memmove(c, c+2, strlen(c+1)); /* strlen(c+1) == strlen(c+2) + 1 */ + } // send control file if (opts & LPR_V) -- cgit v1.2.3