nc: use symbolic SHUT_WR instead of literal 1
[oweals/busybox.git] / printutils / lpd.c
index d91491f1b39d96702e73f22c0e61b602907db0a7..642e8a89e70b06938d9c97e4ff6f55656bab3c04 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
  *
- * Licensed under GPLv2, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2, see file LICENSE in this source tree.
  */
 
 /*
  * mv -f ./"$DATAFILE" save/
  */
 
+//usage:#define lpd_trivial_usage
+//usage:       "SPOOLDIR [HELPER [ARGS]]"
+//usage:#define lpd_full_usage "\n\n"
+//usage:       "SPOOLDIR must contain (symlinks to) device nodes or directories"
+//usage:     "\nwith names matching print queue names. In the first case, jobs are"
+//usage:     "\nsent directly to the device. Otherwise each job is stored in queue"
+//usage:     "\ndirectory and HELPER program is called. Name of file to print"
+//usage:     "\nis passed in $DATAFILE variable."
+//usage:     "\nExample:"
+//usage:     "\n       tcpsvd -E 0 515 softlimit -m 999999 lpd /var/spool ./print"
+
 #include "libbb.h"
 
 // strip argument of bad chars
@@ -91,7 +102,7 @@ static char *xmalloc_read_stdin(void)
 {
        // SECURITY:
        size_t max = 4 * 1024; // more than enough for commands!
-       return xmalloc_reads(STDIN_FILENO, NULL, &max);
+       return xmalloc_reads(STDIN_FILENO, &max);
 }
 
 int lpd_main(int argc, char *argv[]) MAIN_EXTERNALLY_VISIBLE;
@@ -135,7 +146,7 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[])
        while (1) {
                char *fname;
                int fd;
-               // int is easier than ssize_t: can use xatoi_u,
+               // int is easier than ssize_t: can use xatoi_positive,
                // and can correctly display error returns (-1)
                int expected_len, real_len;