aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-03-24 02:05:58 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-03-24 02:05:58 +0000
commit42cc304e9084843ad6b153afaf4b3f6c6528c364 (patch)
tree51d7cc0dfcd554658d980b9628180e39512f9b1b
parent39c77c37384f87075ad578855f0a11ecbf0681f3 (diff)
downloadbusybox-w32-42cc304e9084843ad6b153afaf4b3f6c6528c364.tar.gz
busybox-w32-42cc304e9084843ad6b153afaf4b3f6c6528c364.tar.bz2
busybox-w32-42cc304e9084843ad6b153afaf4b3f6c6528c364.zip
lpr: add more accurate comments
*: trailing whitespace removal
-rw-r--r--editors/patch.c2
-rw-r--r--editors/vi.c2
-rw-r--r--include/unarchive.h2
-rw-r--r--miscutils/chrt.c2
-rw-r--r--networking/sendmail.c2
-rw-r--r--printutils/lpd.c45
-rw-r--r--printutils/lpr.c2
-rw-r--r--shell/msh.c2
-rw-r--r--util-linux/script.c2
-rw-r--r--util-linux/volume_id/get_devname.c2
10 files changed, 35 insertions, 28 deletions
diff --git a/editors/patch.c b/editors/patch.c
index a37f4e62f..a2d593d87 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -136,7 +136,7 @@ int patch_main(int argc ATTRIBUTE_UNUSED, char **argv)
136 src_stream = NULL; 136 src_stream = NULL;
137 137
138 if (backup_filename && !stat(original_filename, &saved_stat)) { 138 if (backup_filename && !stat(original_filename, &saved_stat)) {
139 src_stream = xfopen((strcmp(original_filename, new_filename)) ? 139 src_stream = xfopen((strcmp(original_filename, new_filename)) ?
140 original_filename : backup_filename, "r"); 140 original_filename : backup_filename, "r");
141 } 141 }
142 142
diff --git a/editors/vi.c b/editors/vi.c
index 22bd2fffa..65fb0265e 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1718,7 +1718,7 @@ static int find_range(char ** start, char ** stop, char c)
1718 p = t; 1718 p = t;
1719 } 1719 }
1720 1720
1721 // backward char movements don't include start position 1721 // backward char movements don't include start position
1722 if (q > p && strchr("^0bBh\b\177", c)) q--; 1722 if (q > p && strchr("^0bBh\b\177", c)) q--;
1723 1723
1724 multiline = 0; 1724 multiline = 0;
diff --git a/include/unarchive.h b/include/unarchive.h
index bfd6488db..b49e6cbb5 100644
--- a/include/unarchive.h
+++ b/include/unarchive.h
@@ -14,7 +14,7 @@ typedef struct file_header_t {
14 char *name; 14 char *name;
15 char *link_target; 15 char *link_target;
16#if ENABLE_FEATURE_TAR_UNAME_GNAME 16#if ENABLE_FEATURE_TAR_UNAME_GNAME
17 char *uname; 17 char *uname;
18 char *gname; 18 char *gname;
19#endif 19#endif
20 off_t size; 20 off_t size;
diff --git a/miscutils/chrt.c b/miscutils/chrt.c
index 13557feef..a0f684bb3 100644
--- a/miscutils/chrt.c
+++ b/miscutils/chrt.c
@@ -67,7 +67,7 @@ int chrt_main(int argc ATTRIBUTE_UNUSED, char **argv)
67 fflush_stdout_and_exit(EXIT_SUCCESS); 67 fflush_stdout_and_exit(EXIT_SUCCESS);
68 } 68 }
69 69
70 argv += optind; 70 argv += optind;
71 if (opt & OPT_p) { 71 if (opt & OPT_p) {
72 pid_str = *argv++; 72 pid_str = *argv++;
73 if (*argv) { /* "-p <priority> <pid> [...]" */ 73 if (*argv) { /* "-p <priority> <pid> [...]" */
diff --git a/networking/sendmail.c b/networking/sendmail.c
index 2eb01dc94..2218f2c19 100644
--- a/networking/sendmail.c
+++ b/networking/sendmail.c
@@ -537,7 +537,7 @@ int sendgetmail_main(int argc ATTRIBUTE_UNUSED, char **argv)
537 // NOTE: we don't use xatou(buf) since buf is "nmsg nbytes" 537 // NOTE: we don't use xatou(buf) since buf is "nmsg nbytes"
538 // we only need nmsg and atoi is just exactly what we need 538 // we only need nmsg and atoi is just exactly what we need
539 // if atoi fails to convert buf into number it returns 0 539 // if atoi fails to convert buf into number it returns 0
540 // in this case the following loop simply will not be executed 540 // in this case the following loop simply will not be executed
541 nmsg = atoi(buf); 541 nmsg = atoi(buf);
542 if (ENABLE_FEATURE_CLEAN_UP) 542 if (ENABLE_FEATURE_CLEAN_UP)
543 free(buf-4); // buf is "+OK " away from malloc'ed string 543 free(buf-4); // buf is "+OK " away from malloc'ed string
diff --git a/printutils/lpd.c b/printutils/lpd.c
index cac881383..bc0348eba 100644
--- a/printutils/lpd.c
+++ b/printutils/lpd.c
@@ -10,37 +10,40 @@
10/* 10/*
11 * A typical usage of BB lpd looks as follows: 11 * A typical usage of BB lpd looks as follows:
12 * # tcpsvd -E 0 515 lpd SPOOLDIR [HELPER-PROG [ARGS...]] 12 * # tcpsvd -E 0 515 lpd SPOOLDIR [HELPER-PROG [ARGS...]]
13 * 13 *
14 * This means a network listener is started on port 515 (default for LP protocol). 14 * This means a network listener is started on port 515 (default for LP protocol).
15 * When a client connection is made (via lpr) lpd first change its working directory to SPOOLDIR. 15 * When a client connection is made (via lpr) lpd first change its working directory to SPOOLDIR.
16 * 16 *
17 * SPOOLDIR is the spool directory which contains printing queues 17 * SPOOLDIR is the spool directory which contains printing queues
18 * and should have the following structure: 18 * and should have the following structure:
19 * 19 *
20 * SPOOLDIR/ 20 * SPOOLDIR/
21 * <queue1> 21 * <queue1>
22 * ... 22 * ...
23 * <queueN> 23 * <queueN>
24 * 24 *
25 * <queueX> can be of two types: 25 * <queueX> can be of two types:
26 * A. a printer character device or an ordinary file a link to such; 26 * A. a printer character device or an ordinary file a link to such;
27 * B. a directory. 27 * B. a directory.
28 * 28 *
29 * In case A lpd just dumps the data it receives from client (lpr) to the 29 * In case A lpd just dumps the data it receives from client (lpr) to the
30 * end of queue file/device. This is non-spooling mode. 30 * end of queue file/device. This is non-spooling mode.
31 * 31 *
32 * In case B lpd enters spooling mode. It reliably saves client data along with control info 32 * In case B lpd enters spooling mode. It reliably saves client data along with control info
33 * in two unique files under the queue directory. These files are named dfAXXXHHHH and cfAXXXHHHH, 33 * in two unique files under the queue directory. These files are named dfAXXXHHHH and cfAXXXHHHH,
34 * where XXX is the job number and HHHH is the client hostname. Unless a printing helper application 34 * where XXX is the job number and HHHH is the client hostname. Unless a printing helper application
35 * is specified lpd is done at this point. 35 * is specified lpd is done at this point.
36 * 36 *
37 * NB: file names are produced by peer! They actually may be anything at all!
38 * lpd only sanitizes them (by removing most non-alphanumerics).
39 *
37 * If HELPER-PROG (with optional arguments) is specified then lpd continues to process client data: 40 * If HELPER-PROG (with optional arguments) is specified then lpd continues to process client data:
38 * 1. it reads and parses control file (cfA...). The parse process results in setting environment 41 * 1. it reads and parses control file (cfA...). The parse process results in setting environment
39 * variables whose values were passed in control file; when parsing is complete, lpd deletes 42 * variables whose values were passed in control file; when parsing is complete, lpd deletes
40 * control file. 43 * control file.
41 * 2. it spawns specified helper application. It is then the helper application who is responsible 44 * 2. it spawns specified helper application. It is then the helper application who is responsible
42 * for both actual printing and deleting processed data file. 45 * for both actual printing and deleting processed data file.
43 * 46 *
44 * A good lpr passes control files which when parsed provide the following variables: 47 * A good lpr passes control files which when parsed provide the following variables:
45 * $H = host which issues the job 48 * $H = host which issues the job
46 * $P = user who prints 49 * $P = user who prints
@@ -49,13 +52,17 @@
49 * $L = print banner page 52 * $L = print banner page
50 * $M = the user to whom a mail should be sent if a problem occurs 53 * $M = the user to whom a mail should be sent if a problem occurs
51 * $l = name of datafile ("dfAxxx") - file whose content are to be printed 54 * $l = name of datafile ("dfAxxx") - file whose content are to be printed
52 * 55 *
56 * lpd also provides $DATAFILE environment variable - the ACTUAL name
57 * of the datafile under which it was saved.
58 * $l is not reliable (you are at mercy of remote peer), DON'T USE IT.
59 *
53 * Thus, a typical helper can be something like this: 60 * Thus, a typical helper can be something like this:
54 * #!/bin/sh 61 * #!/bin/sh
55 * cat "$l" >/dev/lp0 62 * cat "$l" >/dev/lp0
56 * mv -f "$l" save/ 63 * mv -f "$l" save/
57 *
58 */ 64 */
65
59#include "libbb.h" 66#include "libbb.h"
60 67
61// strip argument of bad chars 68// strip argument of bad chars
diff --git a/printutils/lpr.c b/printutils/lpr.c
index 5313d5a20..d0bf5873e 100644
--- a/printutils/lpr.c
+++ b/printutils/lpr.c
@@ -49,7 +49,7 @@ int lpqr_main(int argc ATTRIBUTE_UNUSED, char *argv[])
49 OPT_U = 1 << 1, // -U username 49 OPT_U = 1 << 1, // -U username
50 50
51 LPR_V = 1 << 2, // -V: be verbose 51 LPR_V = 1 << 2, // -V: be verbose
52 LPR_h = 1 << 3, // -h: want banner printed 52 LPR_h = 1 << 3, // -h: want banner printed
53 LPR_C = 1 << 4, // -C class: job "class" (? supposedly printed on banner) 53 LPR_C = 1 << 4, // -C class: job "class" (? supposedly printed on banner)
54 LPR_J = 1 << 5, // -J title: the job title for the banner page 54 LPR_J = 1 << 5, // -J title: the job title for the banner page
55 LPR_m = 1 << 6, // -m: send mail back to user 55 LPR_m = 1 << 6, // -m: send mail back to user
diff --git a/shell/msh.c b/shell/msh.c
index 63f365962..cd4695454 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -2740,7 +2740,7 @@ static int forkexec(struct op *t, int *pin, int *pout, int no_fork, char **wp)
2740 // longjmps away (at "Run builtin" below), leaving t->op_words clobbered! 2740 // longjmps away (at "Run builtin" below), leaving t->op_words clobbered!
2741 // See http://bugs.busybox.net/view.php?id=846. 2741 // See http://bugs.busybox.net/view.php?id=846.
2742 // Now we do not touch t->op_words, but separately pass wp as param list 2742 // Now we do not touch t->op_words, but separately pass wp as param list
2743 // to builtins 2743 // to builtins
2744 DBGPRINTF(("FORKEXEC: bltin %p, no_fork %d, owp %p\n", bltin, 2744 DBGPRINTF(("FORKEXEC: bltin %p, no_fork %d, owp %p\n", bltin,
2745 no_fork, owp)); 2745 no_fork, owp));
2746 /* Don't fork if it is a lone builtin (not in pipe) 2746 /* Don't fork if it is a lone builtin (not in pipe)
diff --git a/util-linux/script.c b/util-linux/script.c
index 1c95ea550..700f0cb0a 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -168,7 +168,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv)
168 /* child: make pty slave to be input, output, error; run shell */ 168 /* child: make pty slave to be input, output, error; run shell */
169 close(pty); /* close pty master */ 169 close(pty); /* close pty master */
170 /* open pty slave to fd 0,1,2 */ 170 /* open pty slave to fd 0,1,2 */
171 close(0); 171 close(0);
172 xopen(pty_line, O_RDWR); /* uses fd 0 */ 172 xopen(pty_line, O_RDWR); /* uses fd 0 */
173 xdup2(0, 1); 173 xdup2(0, 1);
174 xdup2(0, 2); 174 xdup2(0, 2);
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index b46aad4a2..d1968b744 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -71,7 +71,7 @@ static void
71uuidcache_addentry(char *device, /*int major, int minor,*/ char *label, char *uuid) 71uuidcache_addentry(char *device, /*int major, int minor,*/ char *label, char *uuid)
72{ 72{
73 struct uuidCache_s *last; 73 struct uuidCache_s *last;
74 74
75 if (!uuidCache) { 75 if (!uuidCache) {
76 last = uuidCache = xzalloc(sizeof(*uuidCache)); 76 last = uuidCache = xzalloc(sizeof(*uuidCache));
77 } else { 77 } else {