diff options
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | Changelog | 4 | ||||
-rw-r--r-- | applets/busybox.c | 3 | ||||
-rw-r--r-- | busybox.c | 3 | ||||
-rw-r--r-- | busybox.def.h | 3 | ||||
-rw-r--r-- | docs/busybox.pod | 26 | ||||
-rw-r--r-- | internal.h | 1 | ||||
-rw-r--r-- | miscutils/mktemp.c | 43 | ||||
-rw-r--r-- | mktemp.c | 43 | ||||
-rw-r--r-- | networking/ping.c | 38 | ||||
-rw-r--r-- | ping.c | 38 | ||||
-rw-r--r-- | procps/ps.c | 6 | ||||
-rw-r--r-- | ps.c | 6 |
13 files changed, 189 insertions, 28 deletions
@@ -42,3 +42,6 @@ Enrique Zanardi <ezanardi@ull.es> | |||
42 | 42 | ||
43 | Karl M. Hegbloom <karlheg@debian.org> | 43 | Karl M. Hegbloom <karlheg@debian.org> |
44 | cp_mv.c, the test suite, various fixes to utility.c, &c. | 44 | cp_mv.c, the test suite, various fixes to utility.c, &c. |
45 | |||
46 | Daniel Jacobowitz <dan@debian.org> | ||
47 | mktemp.c | ||
@@ -1,6 +1,10 @@ | |||
1 | 0.44 | 1 | 0.44 |
2 | * added the -v option (inverted search) to grep, | 2 | * added the -v option (inverted search) to grep, |
3 | updated docs/busybox.pod accordingly. -beppu | 3 | updated docs/busybox.pod accordingly. -beppu |
4 | * Added mktemp, contributed by Daniel Jacobowitz <dan@debian.org> | ||
5 | * Fix for ping warnings from Sascha Ziemann <szi@aibon.ping.de> | ||
6 | * More doc updates | ||
7 | |||
4 | 8 | ||
5 | 0.43 | 9 | 0.43 |
6 | * Major update to the provided documentation. | 10 | * Major update to the provided documentation. |
diff --git a/applets/busybox.c b/applets/busybox.c index f4260e937..4a6f928e0 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
@@ -197,6 +197,9 @@ static const struct Applet applets[] = { | |||
197 | #ifdef BB_MKSWAP | 197 | #ifdef BB_MKSWAP |
198 | {"mkswap", mkswap_main, _BB_DIR_SBIN}, | 198 | {"mkswap", mkswap_main, _BB_DIR_SBIN}, |
199 | #endif | 199 | #endif |
200 | #ifdef BB_MKTEMP | ||
201 | {"mktemp", mktemp_main, _BB_DIR_BIN}, | ||
202 | #endif | ||
200 | #ifdef BB_MNC | 203 | #ifdef BB_MNC |
201 | {"mnc", mnc_main, _BB_DIR_USR_BIN}, | 204 | {"mnc", mnc_main, _BB_DIR_USR_BIN}, |
202 | #endif | 205 | #endif |
@@ -197,6 +197,9 @@ static const struct Applet applets[] = { | |||
197 | #ifdef BB_MKSWAP | 197 | #ifdef BB_MKSWAP |
198 | {"mkswap", mkswap_main, _BB_DIR_SBIN}, | 198 | {"mkswap", mkswap_main, _BB_DIR_SBIN}, |
199 | #endif | 199 | #endif |
200 | #ifdef BB_MKTEMP | ||
201 | {"mktemp", mktemp_main, _BB_DIR_BIN}, | ||
202 | #endif | ||
200 | #ifdef BB_MNC | 203 | #ifdef BB_MNC |
201 | {"mnc", mnc_main, _BB_DIR_USR_BIN}, | 204 | {"mnc", mnc_main, _BB_DIR_USR_BIN}, |
202 | #endif | 205 | #endif |
diff --git a/busybox.def.h b/busybox.def.h index 77ee5b02a..3012b0cd5 100644 --- a/busybox.def.h +++ b/busybox.def.h | |||
@@ -52,12 +52,13 @@ | |||
52 | #define BB_LS | 52 | #define BB_LS |
53 | #define BB_LSMOD | 53 | #define BB_LSMOD |
54 | #define BB_MAKEDEVS | 54 | #define BB_MAKEDEVS |
55 | #define BB_MKFS_MINIX | ||
56 | #define BB_MATH | 55 | #define BB_MATH |
57 | #define BB_MKDIR | 56 | #define BB_MKDIR |
58 | #define BB_MKFIFO | 57 | #define BB_MKFIFO |
58 | #define BB_MKFS_MINIX | ||
59 | #define BB_MKNOD | 59 | #define BB_MKNOD |
60 | #define BB_MKSWAP | 60 | #define BB_MKSWAP |
61 | #define BB_MKTEMP | ||
61 | #define BB_MNC | 62 | #define BB_MNC |
62 | #define BB_MORE | 63 | #define BB_MORE |
63 | #define BB_MOUNT | 64 | #define BB_MOUNT |
diff --git a/docs/busybox.pod b/docs/busybox.pod index 71444c082..6fd8289f2 100644 --- a/docs/busybox.pod +++ b/docs/busybox.pod | |||
@@ -60,10 +60,10 @@ dirname, dmesg, du, dutmp, echo, false, fbset, fdflush, find, free, | |||
60 | freeramdisk, deallocvt, fsck.minix, grep, gunzip, gzip, halt, head, hostid, | 60 | freeramdisk, deallocvt, fsck.minix, grep, gunzip, gzip, halt, head, hostid, |
61 | hostname, init, kill, killall, length, ln, loadacm, loadfont, loadkmap, logger, | 61 | hostname, init, kill, killall, length, ln, loadacm, loadfont, loadkmap, logger, |
62 | logname, ls, lsmod, makedevs, math, mkdir, mkfifo, mkfs.minix, mknod, mkswap, | 62 | logname, ls, lsmod, makedevs, math, mkdir, mkfifo, mkfs.minix, mknod, mkswap, |
63 | mnc, more, mount, mt, mv, nslookup, ping, poweroff, printf, ps, pwd, reboot, | 63 | mktemp, mnc, more, mount, mt, mv, nslookup, ping, poweroff, printf, ps, pwd, |
64 | rm, rmdir, rmmod, sed, sh, sfdisk, sleep, sort, sync, syslogd, swapon, swapoff, | 64 | reboot, rm, rmdir, rmmod, sed, sh, sfdisk, sleep, sort, sync, syslogd, swapon, |
65 | tail, tar, test, tee, touch, tr, true, tty, umount, uname, uniq, update, | 65 | swapoff, tail, tar, test, tee, touch, tr, true, tty, umount, uname, uniq, |
66 | uptime, usleep, wc, whoami, yes, zcat, [ | 66 | update, uptime, usleep, wc, whoami, yes, zcat, [ |
67 | 67 | ||
68 | =over 4 | 68 | =over 4 |
69 | 69 | ||
@@ -1050,6 +1050,22 @@ Options: | |||
1050 | 1050 | ||
1051 | ------------------------------- | 1051 | ------------------------------- |
1052 | 1052 | ||
1053 | =item mktemp | ||
1054 | |||
1055 | Usage: mktemp [-q] TEMPLATE | ||
1056 | |||
1057 | Creates a temporary file with its name based on TEMPLATE. | ||
1058 | TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX). | ||
1059 | |||
1060 | Example: | ||
1061 | |||
1062 | $ mktemp /tmp/temp.XXXXXX | ||
1063 | /tmp/temp.mWiLjM | ||
1064 | $ ls -la /tmp/temp.mWiLjM | ||
1065 | -rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM | ||
1066 | |||
1067 | ------------------------------- | ||
1068 | |||
1053 | =item mnc | 1069 | =item mnc |
1054 | 1070 | ||
1055 | Usage: mnc [IP] [port] | 1071 | Usage: mnc [IP] [port] |
@@ -1817,4 +1833,4 @@ Enrique Zanardi <ezanardi@ull.es> | |||
1817 | 1833 | ||
1818 | =cut | 1834 | =cut |
1819 | 1835 | ||
1820 | # $Id: busybox.pod,v 1.22 2000/04/24 18:07:30 beppu Exp $ | 1836 | # $Id: busybox.pod,v 1.23 2000/04/25 23:24:55 erik Exp $ |
diff --git a/internal.h b/internal.h index 8c97a090a..1c267cbbb 100644 --- a/internal.h +++ b/internal.h | |||
@@ -119,6 +119,7 @@ extern int mkfifo_main(int argc, char **argv); | |||
119 | extern int mkfs_minix_main(int argc, char **argv); | 119 | extern int mkfs_minix_main(int argc, char **argv); |
120 | extern int mknod_main(int argc, char** argv); | 120 | extern int mknod_main(int argc, char** argv); |
121 | extern int mkswap_main(int argc, char** argv); | 121 | extern int mkswap_main(int argc, char** argv); |
122 | extern int mktemp_main(int argc, char **argv); | ||
122 | extern int mnc_main(int argc, char** argv); | 123 | extern int mnc_main(int argc, char** argv); |
123 | extern int more_main(int argc, char** argv); | 124 | extern int more_main(int argc, char** argv); |
124 | extern int mount_main(int argc, char** argv); | 125 | extern int mount_main(int argc, char** argv); |
diff --git a/miscutils/mktemp.c b/miscutils/mktemp.c new file mode 100644 index 000000000..b30b9a08f --- /dev/null +++ b/miscutils/mktemp.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * Mini mktemp implementation for busybox | ||
4 | * | ||
5 | * | ||
6 | * Copyright (C) 2000 by Daniel Jacobowitz | ||
7 | * Written by Daniel Jacobowitz <dan@debian.org> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #include "internal.h" | ||
26 | #include <stdio.h> | ||
27 | #include <errno.h> | ||
28 | |||
29 | |||
30 | extern int mktemp_main(int argc, char **argv) | ||
31 | { | ||
32 | if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q"))) | ||
33 | usage ("mktemp [-q] TEMPLATE\n" | ||
34 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
35 | "\nCreates a temporary file with its name based on TEMPLATE.\n" | ||
36 | "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).\n" | ||
37 | #endif | ||
38 | ); | ||
39 | if(mkstemp(argv[argc-1]) < 0) | ||
40 | exit(FALSE); | ||
41 | (void) puts(argv[argc-1]); | ||
42 | exit(TRUE); | ||
43 | } | ||
diff --git a/mktemp.c b/mktemp.c new file mode 100644 index 000000000..b30b9a08f --- /dev/null +++ b/mktemp.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * Mini mktemp implementation for busybox | ||
4 | * | ||
5 | * | ||
6 | * Copyright (C) 2000 by Daniel Jacobowitz | ||
7 | * Written by Daniel Jacobowitz <dan@debian.org> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #include "internal.h" | ||
26 | #include <stdio.h> | ||
27 | #include <errno.h> | ||
28 | |||
29 | |||
30 | extern int mktemp_main(int argc, char **argv) | ||
31 | { | ||
32 | if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q"))) | ||
33 | usage ("mktemp [-q] TEMPLATE\n" | ||
34 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
35 | "\nCreates a temporary file with its name based on TEMPLATE.\n" | ||
36 | "TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).\n" | ||
37 | #endif | ||
38 | ); | ||
39 | if(mkstemp(argv[argc-1]) < 0) | ||
40 | exit(FALSE); | ||
41 | (void) puts(argv[argc-1]); | ||
42 | exit(TRUE); | ||
43 | } | ||
diff --git a/networking/ping.c b/networking/ping.c index dca4c3cfe..9f83002a2 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping.c,v 1.13 2000/04/21 01:26:49 erik Exp $ | 3 | * $Id: ping.c,v 1.14 2000/04/25 23:24:55 erik Exp $ |
4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -262,6 +262,26 @@ static void sendping(int ign) | |||
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | static char *icmp_type_name (int id) | ||
266 | { | ||
267 | switch (id) { | ||
268 | case ICMP_ECHOREPLY: return "Echo Reply"; | ||
269 | case ICMP_DEST_UNREACH: return "Destination Unreachable"; | ||
270 | case ICMP_SOURCE_QUENCH: return "Source Quench"; | ||
271 | case ICMP_REDIRECT: return "Redirect (change route)"; | ||
272 | case ICMP_ECHO: return "Echo Request"; | ||
273 | case ICMP_TIME_EXCEEDED: return "Time Exceeded"; | ||
274 | case ICMP_PARAMETERPROB: return "Parameter Problem"; | ||
275 | case ICMP_TIMESTAMP: return "Timestamp Request"; | ||
276 | case ICMP_TIMESTAMPREPLY: return "Timestamp Reply"; | ||
277 | case ICMP_INFO_REQUEST: return "Information Request"; | ||
278 | case ICMP_INFO_REPLY: return "Information Reply"; | ||
279 | case ICMP_ADDRESS: return "Address Mask Request"; | ||
280 | case ICMP_ADDRESSREPLY: return "Address Mask Reply"; | ||
281 | default: return "unknown ICMP type"; | ||
282 | } | ||
283 | } | ||
284 | |||
265 | static void unpack(char *buf, int sz, struct sockaddr_in *from) | 285 | static void unpack(char *buf, int sz, struct sockaddr_in *from) |
266 | { | 286 | { |
267 | struct icmp *icmppkt; | 287 | struct icmp *icmppkt; |
@@ -282,10 +302,11 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
282 | sz -= hlen; | 302 | sz -= hlen; |
283 | icmppkt = (struct icmp *) (buf + hlen); | 303 | icmppkt = (struct icmp *) (buf + hlen); |
284 | 304 | ||
305 | if (icmppkt->icmp_id != myid) | ||
306 | return; /* not our ping */ | ||
307 | |||
285 | if (icmppkt->icmp_type == ICMP_ECHOREPLY) { | 308 | if (icmppkt->icmp_type == ICMP_ECHOREPLY) { |
286 | if (icmppkt->icmp_id != myid) | 309 | ++nreceived; |
287 | return; /* not our ping */ | ||
288 | ++nreceived; | ||
289 | tp = (struct timeval *) icmppkt->icmp_data; | 310 | tp = (struct timeval *) icmppkt->icmp_data; |
290 | 311 | ||
291 | if ((tv.tv_usec -= tp->tv_usec) < 0) { | 312 | if ((tv.tv_usec -= tp->tv_usec) < 0) { |
@@ -321,10 +342,11 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
321 | if (dupflag) | 342 | if (dupflag) |
322 | printf(" (DUP!)"); | 343 | printf(" (DUP!)"); |
323 | printf("\n"); | 344 | printf("\n"); |
324 | } else { | 345 | } else |
325 | fprintf(stderr, | 346 | if (icmppkt->icmp_type != ICMP_ECHO) |
326 | "Warning: unknown ICMP packet received (not echo-reply)\n"); | 347 | fprintf(stderr, |
327 | } | 348 | "Warning: Got ICMP %d (%s)\n", |
349 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); | ||
328 | } | 350 | } |
329 | 351 | ||
330 | static void ping(char *host) | 352 | static void ping(char *host) |
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping.c,v 1.13 2000/04/21 01:26:49 erik Exp $ | 3 | * $Id: ping.c,v 1.14 2000/04/25 23:24:55 erik Exp $ |
4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -262,6 +262,26 @@ static void sendping(int ign) | |||
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | static char *icmp_type_name (int id) | ||
266 | { | ||
267 | switch (id) { | ||
268 | case ICMP_ECHOREPLY: return "Echo Reply"; | ||
269 | case ICMP_DEST_UNREACH: return "Destination Unreachable"; | ||
270 | case ICMP_SOURCE_QUENCH: return "Source Quench"; | ||
271 | case ICMP_REDIRECT: return "Redirect (change route)"; | ||
272 | case ICMP_ECHO: return "Echo Request"; | ||
273 | case ICMP_TIME_EXCEEDED: return "Time Exceeded"; | ||
274 | case ICMP_PARAMETERPROB: return "Parameter Problem"; | ||
275 | case ICMP_TIMESTAMP: return "Timestamp Request"; | ||
276 | case ICMP_TIMESTAMPREPLY: return "Timestamp Reply"; | ||
277 | case ICMP_INFO_REQUEST: return "Information Request"; | ||
278 | case ICMP_INFO_REPLY: return "Information Reply"; | ||
279 | case ICMP_ADDRESS: return "Address Mask Request"; | ||
280 | case ICMP_ADDRESSREPLY: return "Address Mask Reply"; | ||
281 | default: return "unknown ICMP type"; | ||
282 | } | ||
283 | } | ||
284 | |||
265 | static void unpack(char *buf, int sz, struct sockaddr_in *from) | 285 | static void unpack(char *buf, int sz, struct sockaddr_in *from) |
266 | { | 286 | { |
267 | struct icmp *icmppkt; | 287 | struct icmp *icmppkt; |
@@ -282,10 +302,11 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
282 | sz -= hlen; | 302 | sz -= hlen; |
283 | icmppkt = (struct icmp *) (buf + hlen); | 303 | icmppkt = (struct icmp *) (buf + hlen); |
284 | 304 | ||
305 | if (icmppkt->icmp_id != myid) | ||
306 | return; /* not our ping */ | ||
307 | |||
285 | if (icmppkt->icmp_type == ICMP_ECHOREPLY) { | 308 | if (icmppkt->icmp_type == ICMP_ECHOREPLY) { |
286 | if (icmppkt->icmp_id != myid) | 309 | ++nreceived; |
287 | return; /* not our ping */ | ||
288 | ++nreceived; | ||
289 | tp = (struct timeval *) icmppkt->icmp_data; | 310 | tp = (struct timeval *) icmppkt->icmp_data; |
290 | 311 | ||
291 | if ((tv.tv_usec -= tp->tv_usec) < 0) { | 312 | if ((tv.tv_usec -= tp->tv_usec) < 0) { |
@@ -321,10 +342,11 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
321 | if (dupflag) | 342 | if (dupflag) |
322 | printf(" (DUP!)"); | 343 | printf(" (DUP!)"); |
323 | printf("\n"); | 344 | printf("\n"); |
324 | } else { | 345 | } else |
325 | fprintf(stderr, | 346 | if (icmppkt->icmp_type != ICMP_ECHO) |
326 | "Warning: unknown ICMP packet received (not echo-reply)\n"); | 347 | fprintf(stderr, |
327 | } | 348 | "Warning: Got ICMP %d (%s)\n", |
349 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); | ||
328 | } | 350 | } |
329 | 351 | ||
330 | static void ping(char *host) | 352 | static void ping(char *host) |
diff --git a/procps/ps.c b/procps/ps.c index 8d59700fd..f8cf33b25 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -163,13 +163,13 @@ extern int ps_main(int argc, char **argv) | |||
163 | if (*groupName == '\0') | 163 | if (*groupName == '\0') |
164 | sprintf(groupName, "%d", p.rgid); | 164 | sprintf(groupName, "%d", p.rgid); |
165 | 165 | ||
166 | len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName, | ||
167 | p.state); | ||
168 | sprintf(path, "/proc/%s/cmdline", entry->d_name); | 166 | sprintf(path, "/proc/%s/cmdline", entry->d_name); |
169 | file = fopen(path, "r"); | 167 | file = fopen(path, "r"); |
170 | if (file == NULL) | 168 | if (file == NULL) |
171 | fatalError("Can't open %s: %s\n", path, strerror(errno)); | 169 | continue; |
172 | i = 0; | 170 | i = 0; |
171 | len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName, | ||
172 | p.state); | ||
173 | while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) { | 173 | while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) { |
174 | i++; | 174 | i++; |
175 | if (c == '\0') | 175 | if (c == '\0') |
@@ -163,13 +163,13 @@ extern int ps_main(int argc, char **argv) | |||
163 | if (*groupName == '\0') | 163 | if (*groupName == '\0') |
164 | sprintf(groupName, "%d", p.rgid); | 164 | sprintf(groupName, "%d", p.rgid); |
165 | 165 | ||
166 | len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName, | ||
167 | p.state); | ||
168 | sprintf(path, "/proc/%s/cmdline", entry->d_name); | 166 | sprintf(path, "/proc/%s/cmdline", entry->d_name); |
169 | file = fopen(path, "r"); | 167 | file = fopen(path, "r"); |
170 | if (file == NULL) | 168 | if (file == NULL) |
171 | fatalError("Can't open %s: %s\n", path, strerror(errno)); | 169 | continue; |
172 | i = 0; | 170 | i = 0; |
171 | len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName, | ||
172 | p.state); | ||
173 | while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) { | 173 | while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) { |
174 | i++; | 174 | i++; |
175 | if (c == '\0') | 175 | if (c == '\0') |