aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/Config.in4
-rw-r--r--coreutils/cal.c6
-rw-r--r--coreutils/date.c14
-rw-r--r--coreutils/expr.c2
-rw-r--r--coreutils/install.c2
-rw-r--r--coreutils/libcoreutils/getopt_mk_fifo_nod.c2
-rw-r--r--coreutils/ls.c62
-rw-r--r--coreutils/nice.c2
-rw-r--r--coreutils/printf.c4
-rw-r--r--coreutils/rmdir.c2
-rw-r--r--coreutils/sort.c4
-rw-r--r--coreutils/stat.c18
-rw-r--r--coreutils/test.c18
-rw-r--r--coreutils/uname.c2
-rw-r--r--coreutils/uudecode.c10
-rw-r--r--coreutils/who.c64
16 files changed, 108 insertions, 108 deletions
diff --git a/coreutils/Config.in b/coreutils/Config.in
index 3b742dc6c..29f73adea 100644
--- a/coreutils/Config.in
+++ b/coreutils/Config.in
@@ -457,8 +457,8 @@ config CONFIG_FEATURE_STAT_FORMAT
457 default n 457 default n
458 depends on CONFIG_STAT 458 depends on CONFIG_STAT
459 help 459 help
460 Without this, stat will not support the '-c format' option where 460 Without this, stat will not support the '-c format' option where
461 users can pass a custom format string for output. This adds about 461 users can pass a custom format string for output. This adds about
462 7k to a nonstatic build on amd64. 462 7k to a nonstatic build on amd64.
463 463
464config CONFIG_STTY 464config CONFIG_STTY
diff --git a/coreutils/cal.c b/coreutils/cal.c
index 93c5692d0..9368dccf9 100644
--- a/coreutils/cal.c
+++ b/coreutils/cal.c
@@ -45,10 +45,10 @@
45#endif 45#endif
46 46
47#define THURSDAY 4 /* for reformation */ 47#define THURSDAY 4 /* for reformation */
48#define SATURDAY 6 /* 1 Jan 1 was a Saturday */ 48#define SATURDAY 6 /* 1 Jan 1 was a Saturday */
49 49
50#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */ 50#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */
51#define NUMBER_MISSING_DAYS 11 /* 11 day correction */ 51#define NUMBER_MISSING_DAYS 11 /* 11 day correction */
52 52
53#define MAXDAYS 42 /* max slots in a month array */ 53#define MAXDAYS 42 /* max slots in a month array */
54#define SPACE -1 /* used in day array */ 54#define SPACE -1 /* used in day array */
diff --git a/coreutils/date.c b/coreutils/date.c
index e9ec51044..2d411ab31 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -91,23 +91,23 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
91 &t.tm_min) == 2) { 91 &t.tm_min) == 2) {
92 /* no adjustments needed */ 92 /* no adjustments needed */
93 } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon, 93 } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon,
94 &t.tm_mday, &t.tm_hour, 94 &t.tm_mday, &t.tm_hour,
95 &t.tm_min, &t.tm_sec) == 5) { 95 &t.tm_min, &t.tm_sec) == 5) {
96 /* Adjust dates from 1-12 to 0-11 */ 96 /* Adjust dates from 1-12 to 0-11 */
97 t.tm_mon -= 1; 97 t.tm_mon -= 1;
98 } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon, 98 } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon,
99 &t.tm_mday, 99 &t.tm_mday,
100 &t.tm_hour, &t.tm_min) == 4) { 100 &t.tm_hour, &t.tm_min) == 4) {
101 /* Adjust dates from 1-12 to 0-11 */ 101 /* Adjust dates from 1-12 to 0-11 */
102 t.tm_mon -= 1; 102 t.tm_mon -= 1;
103 } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year, 103 } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year,
104 &t.tm_mon, &t.tm_mday, 104 &t.tm_mon, &t.tm_mday,
105 &t.tm_hour, &t.tm_min, 105 &t.tm_hour, &t.tm_min,
106 &t.tm_sec) == 6) { 106 &t.tm_sec) == 6) {
107 t.tm_year -= 1900; /* Adjust years */ 107 t.tm_year -= 1900; /* Adjust years */
108 t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ 108 t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
109 } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year, 109 } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year,
110 &t.tm_mon, &t.tm_mday, 110 &t.tm_mon, &t.tm_mday,
111 &t.tm_hour, &t.tm_min) == 5) { 111 &t.tm_hour, &t.tm_min) == 5) {
112 t.tm_year -= 1900; /* Adjust years */ 112 t.tm_year -= 1900; /* Adjust years */
113 t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ 113 t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
@@ -119,9 +119,9 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
119} 119}
120 120
121#define DATE_OPT_RFC2822 0x01 121#define DATE_OPT_RFC2822 0x01
122#define DATE_OPT_SET 0x02 122#define DATE_OPT_SET 0x02
123#define DATE_OPT_UTC 0x04 123#define DATE_OPT_UTC 0x04
124#define DATE_OPT_DATE 0x08 124#define DATE_OPT_DATE 0x08
125#define DATE_OPT_REFERENCE 0x10 125#define DATE_OPT_REFERENCE 0x10
126#ifdef CONFIG_FEATURE_DATE_ISOFMT 126#ifdef CONFIG_FEATURE_DATE_ISOFMT
127# define DATE_OPT_TIMESPEC 0x20 127# define DATE_OPT_TIMESPEC 0x20
diff --git a/coreutils/expr.c b/coreutils/expr.c
index 969d9fff5..a243e75af 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -365,7 +365,7 @@ static VALUE *eval6 (void)
365 else { 365 else {
366 v = xmalloc (sizeof(VALUE)); 366 v = xmalloc (sizeof(VALUE));
367 v->type = string; 367 v->type = string;
368 v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i); 368 v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i);
369 } 369 }
370 freev (l); 370 freev (l);
371 freev (i1); 371 freev (i1);
diff --git a/coreutils/install.c b/coreutils/install.c
index a4a96151d..c3d4f8c82 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -44,7 +44,7 @@ static const struct option install_long_options[] = {
44 { "preserve-timestamps", 0, NULL, 'p' }, 44 { "preserve-timestamps", 0, NULL, 'p' },
45 { "strip", 0, NULL, 's' }, 45 { "strip", 0, NULL, 's' },
46 { "group", 0, NULL, 'g' }, 46 { "group", 0, NULL, 'g' },
47 { "mode", 0, NULL, 'm' }, 47 { "mode", 0, NULL, 'm' },
48 { "owner", 0, NULL, 'o' }, 48 { "owner", 0, NULL, 'o' },
49 { 0, 0, 0, 0 } 49 { 0, 0, 0, 0 }
50}; 50};
diff --git a/coreutils/libcoreutils/getopt_mk_fifo_nod.c b/coreutils/libcoreutils/getopt_mk_fifo_nod.c
index 7e54fed3e..090fefaee 100644
--- a/coreutils/libcoreutils/getopt_mk_fifo_nod.c
+++ b/coreutils/libcoreutils/getopt_mk_fifo_nod.c
@@ -33,7 +33,7 @@ extern mode_t getopt_mk_fifo_nod(int argc, char **argv)
33 33
34 bb_getopt_ulflags(argc, argv, "m:", &smode); 34 bb_getopt_ulflags(argc, argv, "m:", &smode);
35 if(smode) { 35 if(smode) {
36 if (bb_parse_mode(smode, &mode)) 36 if (bb_parse_mode(smode, &mode))
37 umask(0); 37 umask(0);
38 } 38 }
39 return mode; 39 return mode;
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 5042c1298..46ab865dd 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -173,7 +173,7 @@ static int show_color = 0;
173static const struct option ls_color_opt[] = 173static const struct option ls_color_opt[] =
174{ 174{
175 {"color", optional_argument, NULL, 1}, 175 {"color", optional_argument, NULL, 1},
176 {NULL, 0, NULL, 0} 176 {NULL, 0, NULL, 0}
177}; 177};
178 178
179#define COLOR(mode) ("\000\043\043\043\042\000\043\043"\ 179#define COLOR(mode) ("\000\043\043\043\042\000\043\043"\
@@ -318,7 +318,7 @@ static int count_dirs(struct dnode **dn, int nfiles, int notsubdirs)
318 dirs = 0; 318 dirs = 0;
319 for (i = 0; i < nfiles; i++) { 319 for (i = 0; i < nfiles; i++) {
320 if (S_ISDIR(dn[i]->dstat.st_mode) 320 if (S_ISDIR(dn[i]->dstat.st_mode)
321 && (notsubdirs || 321 && (notsubdirs ||
322 ((dn[i]->name[0] != '.') || (dn[i]->name[1] 322 ((dn[i]->name[0] != '.') || (dn[i]->name[1]
323 && ((dn[i]->name[1] != '.') 323 && ((dn[i]->name[1] != '.')
324 || dn[i]->name[2]))))) 324 || dn[i]->name[2])))))
@@ -747,7 +747,7 @@ static int list_single(struct dnode *dn)
747 { 747 {
748 char context[80]; 748 char context[80];
749 int len; 749 int len;
750 750
751 if (dn->sid) { 751 if (dn->sid) {
752 /* I assume sid initilized with NULL */ 752 /* I assume sid initilized with NULL */
753 len = strlen(dn->sid)+1; 753 len = strlen(dn->sid)+1;
@@ -895,57 +895,57 @@ static const char ls_options[]="Cadil1gnsxAk" \
895 895
896static const unsigned opt_flags[] = { 896static const unsigned opt_flags[] = {
897 LIST_SHORT | STYLE_COLUMNS, /* C */ 897 LIST_SHORT | STYLE_COLUMNS, /* C */
898 DISP_HIDDEN | DISP_DOT, /* a */ 898 DISP_HIDDEN | DISP_DOT, /* a */
899 DISP_NOLIST, /* d */ 899 DISP_NOLIST, /* d */
900 LIST_INO, /* i */ 900 LIST_INO, /* i */
901 LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */ 901 LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */
902 LIST_SHORT | STYLE_SINGLE, /* 1 */ 902 LIST_SHORT | STYLE_SINGLE, /* 1 */
903 0, /* g - ingored */ 903 0, /* g - ingored */
904 LIST_ID_NUMERIC, /* n */ 904 LIST_ID_NUMERIC, /* n */
905 LIST_BLOCKS, /* s */ 905 LIST_BLOCKS, /* s */
906 DISP_ROWS, /* x */ 906 DISP_ROWS, /* x */
907 DISP_HIDDEN, /* A */ 907 DISP_HIDDEN, /* A */
908#ifdef CONFIG_SELINUX 908#ifdef CONFIG_SELINUX
909 LIST_CONTEXT, /* k */ 909 LIST_CONTEXT, /* k */
910#else 910#else
911 0, /* k - ingored */ 911 0, /* k - ingored */
912#endif 912#endif
913#ifdef CONFIG_FEATURE_LS_TIMESTAMPS 913#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
914# ifdef CONFIG_FEATURE_LS_SORTFILES 914# ifdef CONFIG_FEATURE_LS_SORTFILES
915 TIME_CHANGE | SORT_CTIME, /* c */ 915 TIME_CHANGE | SORT_CTIME, /* c */
916# else 916# else
917 TIME_CHANGE, /* c */ 917 TIME_CHANGE, /* c */
918# endif 918# endif
919 LIST_FULLTIME, /* e */ 919 LIST_FULLTIME, /* e */
920# ifdef CONFIG_FEATURE_LS_SORTFILES 920# ifdef CONFIG_FEATURE_LS_SORTFILES
921 SORT_MTIME, /* t */ 921 SORT_MTIME, /* t */
922# else 922# else
923 0, /* t - ignored -- is this correct? */ 923 0, /* t - ignored -- is this correct? */
924# endif 924# endif
925# ifdef CONFIG_FEATURE_LS_SORTFILES 925# ifdef CONFIG_FEATURE_LS_SORTFILES
926 TIME_ACCESS | SORT_ATIME, /* u */ 926 TIME_ACCESS | SORT_ATIME, /* u */
927# else 927# else
928 TIME_ACCESS, /* u */ 928 TIME_ACCESS, /* u */
929# endif 929# endif
930#endif 930#endif
931#ifdef CONFIG_FEATURE_LS_SORTFILES 931#ifdef CONFIG_FEATURE_LS_SORTFILES
932 SORT_SIZE, /* S */ 932 SORT_SIZE, /* S */
933 SORT_EXT, /* X */ 933 SORT_EXT, /* X */
934 SORT_ORDER_REVERSE, /* r */ 934 SORT_ORDER_REVERSE, /* r */
935 SORT_VERSION, /* v */ 935 SORT_VERSION, /* v */
936#endif 936#endif
937#ifdef CONFIG_FEATURE_LS_FILETYPES 937#ifdef CONFIG_FEATURE_LS_FILETYPES
938 LIST_FILETYPE | LIST_EXEC, /* F */ 938 LIST_FILETYPE | LIST_EXEC, /* F */
939 LIST_FILETYPE, /* p */ 939 LIST_FILETYPE, /* p */
940#endif 940#endif
941#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS 941#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
942 FOLLOW_LINKS, /* L */ 942 FOLLOW_LINKS, /* L */
943#endif 943#endif
944#ifdef CONFIG_FEATURE_LS_RECURSIVE 944#ifdef CONFIG_FEATURE_LS_RECURSIVE
945 DISP_RECURSIVE, /* R */ 945 DISP_RECURSIVE, /* R */
946#endif 946#endif
947#ifdef CONFIG_FEATURE_HUMAN_READABLE 947#ifdef CONFIG_FEATURE_HUMAN_READABLE
948 LS_DISP_HR, /* h */ 948 LS_DISP_HR, /* h */
949#endif 949#endif
950#ifdef CONFIG_SELINUX 950#ifdef CONFIG_SELINUX
951 LIST_MODEBITS|LIST_NLINKS|LIST_CONTEXT|LIST_SIZE|LIST_DATE_TIME, /* K */ 951 LIST_MODEBITS|LIST_NLINKS|LIST_CONTEXT|LIST_SIZE|LIST_DATE_TIME, /* K */
@@ -1025,7 +1025,7 @@ extern int ls_main(int argc, char **argv)
1025 for (i = 0; opt_flags[i] != (1U<<31); i++) { 1025 for (i = 0; opt_flags[i] != (1U<<31); i++) {
1026 if (opt & (1 << i)) { 1026 if (opt & (1 << i)) {
1027 unsigned int flags = opt_flags[i]; 1027 unsigned int flags = opt_flags[i];
1028 1028
1029 if (flags & LIST_MASK_TRIGGER) { 1029 if (flags & LIST_MASK_TRIGGER) {
1030 all_fmt &= ~LIST_MASK; 1030 all_fmt &= ~LIST_MASK;
1031 } 1031 }
@@ -1064,11 +1064,11 @@ extern int ls_main(int argc, char **argv)
1064#if CONFIG_FEATURE_LS_COLOR_IS_DEFAULT 1064#if CONFIG_FEATURE_LS_COLOR_IS_DEFAULT
1065 char *p; 1065 char *p;
1066 1066
1067 if ((p = getenv ("LS_COLORS")) != NULL && 1067 if ((p = getenv ("LS_COLORS")) != NULL &&
1068 (*p == '\0' || (strcmp(p, "none") == 0))) { 1068 (*p == '\0' || (strcmp(p, "none") == 0))) {
1069 ; 1069 ;
1070 } else if (isatty(STDOUT_FILENO)) { 1070 } else if (isatty(STDOUT_FILENO)) {
1071 show_color = 1; 1071 show_color = 1;
1072 } 1072 }
1073#endif 1073#endif
1074 1074
diff --git a/coreutils/nice.c b/coreutils/nice.c
index b66f9d82d..449184dab 100644
--- a/coreutils/nice.c
+++ b/coreutils/nice.c
@@ -77,7 +77,7 @@ int nice_main(int argc, char **argv)
77 bb_perror_msg_and_die(Xetpriority_msg, 's'); 77 bb_perror_msg_and_die(Xetpriority_msg, 's');
78 } 78 }
79 } 79 }
80 80
81 execvp(*argv, argv); /* Now exec the desired program. */ 81 execvp(*argv, argv); /* Now exec the desired program. */
82 82
83 /* The exec failed... */ 83 /* The exec failed... */
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 697a1c055..1fe68afcb 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -63,12 +63,12 @@ void multiconvert(char *arg, void *result, converter convert)
63 } 63 }
64 if(convert(arg,result)) fprintf(stderr, "%s", arg); 64 if(convert(arg,result)) fprintf(stderr, "%s", arg);
65} 65}
66 66
67static unsigned long xstrtoul(char *arg) 67static unsigned long xstrtoul(char *arg)
68{ 68{
69 unsigned long result; 69 unsigned long result;
70 70
71 multiconvert(arg,&result, (converter)safe_strtoul); 71 multiconvert(arg,&result, (converter)safe_strtoul);
72 return result; 72 return result;
73} 73}
74 74
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index a10e5bb4f..1d6b2cadb 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -59,7 +59,7 @@ extern int rmdir_main(int argc, char **argv)
59 /* Path is now just the parent component. Note that dirname 59 /* Path is now just the parent component. Note that dirname
60 * returns "." if there are no parents. We must distinguish 60 * returns "." if there are no parents. We must distinguish
61 * this from the case of the original path starting with '.'. 61 * this from the case of the original path starting with '.'.
62 */ 62 */
63 if (do_dot || (*path != '.') || path[1]) { 63 if (do_dot || (*path != '.') || path[1]) {
64 continue; 64 continue;
65 } 65 }
diff --git a/coreutils/sort.c b/coreutils/sort.c
index ce51bc178..b56a5abb8 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -156,7 +156,7 @@ static int compare_keys(const void *xarg, const void *yarg)
156 156
157#ifdef CONFIG_FEATURE_SORT_BIG 157#ifdef CONFIG_FEATURE_SORT_BIG
158 struct sort_key *key; 158 struct sort_key *key;
159 159
160 for(key=key_list;!retval && key;key=key->next_key) { 160 for(key=key_list;!retval && key;key=key->next_key) {
161 flags=(key->flags) ? key->flags : global_flags; 161 flags=(key->flags) ? key->flags : global_flags;
162 /* Chop out and modify key chunks, handling -dfib */ 162 /* Chop out and modify key chunks, handling -dfib */
@@ -312,7 +312,7 @@ int sort_main(int argc, char **argv)
312#ifdef CONFIG_FEATURE_SORT_BIG 312#ifdef CONFIG_FEATURE_SORT_BIG
313 /* if no key, perform alphabetic sort */ 313 /* if no key, perform alphabetic sort */
314 if(!key_list) add_key()->range[0]=1; 314 if(!key_list) add_key()->range[0]=1;
315 /* handle -c */ 315 /* handle -c */
316 if(global_flags&FLAG_c) { 316 if(global_flags&FLAG_c) {
317 int j=(global_flags&FLAG_u) ? -1 : 0; 317 int j=(global_flags&FLAG_u) ? -1 : 0;
318 for(i=1;i<linecount;i++) 318 for(i=1;i<linecount;i++)
diff --git a/coreutils/stat.c b/coreutils/stat.c
index c17b4d5e8..44289fbaa 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -44,9 +44,9 @@ static long flags;
44 44
45static char const *file_type(struct stat const *st) 45static char const *file_type(struct stat const *st)
46{ 46{
47 /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107 47 /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107
48 * for some of these formats. 48 * for some of these formats.
49 * To keep diagnostics grammatical in English, the 49 * To keep diagnostics grammatical in English, the
50 * returned string must start with a consonant. 50 * returned string must start with a consonant.
51 */ 51 */
52 if (S_ISREG(st->st_mode)) return st->st_size == 0 ? "regular empty file" : "regular file"; 52 if (S_ISREG(st->st_mode)) return st->st_size == 0 ? "regular empty file" : "regular file";
@@ -131,8 +131,8 @@ static char const *human_fstype(long f_type)
131 131
132#ifdef CONFIG_FEATURE_STAT_FORMAT 132#ifdef CONFIG_FEATURE_STAT_FORMAT
133/* print statfs info */ 133/* print statfs info */
134static void print_statfs(char *pformat, size_t buf_len, char m, 134static void print_statfs(char *pformat, size_t buf_len, char m,
135 char const *filename, void const *data) 135 char const *filename, void const *data)
136{ 136{
137 struct statfs const *statfsbuf = data; 137 struct statfs const *statfsbuf = data;
138 138
@@ -190,8 +190,8 @@ static void print_statfs(char *pformat, size_t buf_len, char m,
190} 190}
191 191
192/* print stat info */ 192/* print stat info */
193static void print_stat(char *pformat, size_t buf_len, char m, 193static void print_stat(char *pformat, size_t buf_len, char m,
194 char const *filename, void const *data) 194 char const *filename, void const *data)
195{ 195{
196#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) 196#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
197 struct stat *statbuf = (struct stat *) data; 197 struct stat *statbuf = (struct stat *) data;
@@ -326,9 +326,9 @@ static void print_stat(char *pformat, size_t buf_len, char m,
326 } 326 }
327} 327}
328 328
329static void print_it(char const *masterformat, char const *filename, 329static void print_it(char const *masterformat, char const *filename,
330 void (*print_func) (char *, size_t, char, char const *, void const *), 330 void (*print_func) (char *, size_t, char, char const *, void const *),
331 void const *data) 331 void const *data)
332{ 332{
333 char *b; 333 char *b;
334 334
diff --git a/coreutils/test.c b/coreutils/test.c
index 3da2daecd..d7bd5a0de 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -4,14 +4,14 @@
4 * 4 *
5 * Copyright (c) by a whole pile of folks: 5 * Copyright (c) by a whole pile of folks:
6 * 6 *
7 * test(1); version 7-like -- author Erik Baalbergen 7 * test(1); version 7-like -- author Erik Baalbergen
8 * modified by Eric Gisin to be used as built-in. 8 * modified by Eric Gisin to be used as built-in.
9 * modified by Arnold Robbins to add SVR3 compatibility 9 * modified by Arnold Robbins to add SVR3 compatibility
10 * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). 10 * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket).
11 * modified by J.T. Conklin for NetBSD. 11 * modified by J.T. Conklin for NetBSD.
12 * modified by Herbert Xu to be used as built-in in ash. 12 * modified by Herbert Xu to be used as built-in in ash.
13 * modified by Erik Andersen <andersen@codepoet.org> to be used 13 * modified by Erik Andersen <andersen@codepoet.org> to be used
14 * in busybox. 14 * in busybox.
15 * 15 *
16 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 * 29 *
30 * Original copyright notice states: 30 * Original copyright notice states:
31 * "This program is in the Public Domain." 31 * "This program is in the Public Domain."
32 */ 32 */
33 33
34#include <sys/types.h> 34#include <sys/types.h>
diff --git a/coreutils/uname.c b/coreutils/uname.c
index a3e52e39f..f6dc0170f 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -93,7 +93,7 @@ int uname_main(int argc, char **argv)
93 } 93 }
94 94
95#if defined(__sparc__) && defined(__linux__) 95#if defined(__sparc__) && defined(__linux__)
96 if ((fake_sparc != NULL) 96 if ((fake_sparc != NULL)
97 && ((fake_sparc[0] == 'y') 97 && ((fake_sparc[0] == 'y')
98 || (fake_sparc[0] == 'Y'))) { 98 || (fake_sparc[0] == 'Y'))) {
99 strcpy(uname_info.name.machine, "sparc"); 99 strcpy(uname_info.name.machine, "sparc");
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index b4bcc72e2..da6490a81 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -56,7 +56,7 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream)
56 bb_error_msg_and_die("Short file"); 56 bb_error_msg_and_die("Short file");
57 } 57 }
58 58
59 while (length > 0) { 59 while (length > 0) {
60 /* Merge four 6 bit chars to three 8 bit chars */ 60 /* Merge four 6 bit chars to three 8 bit chars */
61 fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream); 61 fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream);
62 line_ptr++; 62 line_ptr++;
@@ -65,14 +65,14 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream)
65 break; 65 break;
66 } 66 }
67 67
68 fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream); 68 fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream);
69 line_ptr++; 69 line_ptr++;
70 length--; 70 length--;
71 if (length == 0) { 71 if (length == 0) {
72 break; 72 break;
73 } 73 }
74 74
75 fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream); 75 fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream);
76 line_ptr += 2; 76 line_ptr += 2;
77 length -= 2; 77 length -= 2;
78 } 78 }
@@ -130,10 +130,10 @@ static int read_base64(FILE *src_stream, FILE *dst_stream)
130 /* Merge 6 bit chars to 8 bit */ 130 /* Merge 6 bit chars to 8 bit */
131 fputc(translated[0] << 2 | translated[1] >> 4, dst_stream); 131 fputc(translated[0] << 2 | translated[1] >> 4, dst_stream);
132 if (count > 2) { 132 if (count > 2) {
133 fputc(translated[1] << 4 | translated[2] >> 2, dst_stream); 133 fputc(translated[1] << 4 | translated[2] >> 2, dst_stream);
134 } 134 }
135 if (count > 3) { 135 if (count > 3) {
136 fputc(translated[2] << 6 | translated[3], dst_stream); 136 fputc(translated[2] << 6 | translated[3], dst_stream);
137 } 137 }
138 } 138 }
139} 139}
diff --git a/coreutils/who.c b/coreutils/who.c
index 0531326bd..e2ea227eb 100644
--- a/coreutils/who.c
+++ b/coreutils/who.c
@@ -33,49 +33,49 @@ extern int who_main(int argc, char **argv)
33 time_t now, idle; 33 time_t now, idle;
34 34
35 if (argc > 1) 35 if (argc > 1)
36 bb_show_usage(); 36 bb_show_usage();
37 37
38 setutent(); 38 setutent();
39 devlen = sizeof("/dev/") - 1; 39 devlen = sizeof("/dev/") - 1;
40 printf("USER TTY IDLE FROM HOST\n"); 40 printf("USER TTY IDLE FROM HOST\n");
41 41
42 while ((ut = getutent()) != NULL) { 42 while ((ut = getutent()) != NULL) {
43 char name[40]; 43 char name[40];
44 44
45 if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { 45 if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
46 len = strlen(ut->ut_line); 46 len = strlen(ut->ut_line);
47 if (ut->ut_line[0] == '/') { 47 if (ut->ut_line[0] == '/') {
48 strncpy(name, ut->ut_line, len); 48 strncpy(name, ut->ut_line, len);
49 name[len] = '\0'; 49 name[len] = '\0';
50 strcpy(ut->ut_line, ut->ut_line + devlen); 50 strcpy(ut->ut_line, ut->ut_line + devlen);
51 } else { 51 } else {
52 strcpy(name, "/dev/"); 52 strcpy(name, "/dev/");
53 strncpy(name+devlen, ut->ut_line, len); 53 strncpy(name+devlen, ut->ut_line, len);
54 name[devlen+len] = '\0'; 54 name[devlen+len] = '\0';
55 } 55 }
56 56
57 printf("%-10s %-8s ", ut->ut_user, ut->ut_line); 57 printf("%-10s %-8s ", ut->ut_user, ut->ut_line);
58 58
59 if (stat(name, &st) == 0) { 59 if (stat(name, &st) == 0) {
60 now = time(NULL); 60 now = time(NULL);
61 idle = now - st.st_atime; 61 idle = now - st.st_atime;
62 62
63 if (idle < 60) 63 if (idle < 60)
64 printf("00:00m "); 64 printf("00:00m ");
65 else if (idle < (60 * 60)) 65 else if (idle < (60 * 60))
66 printf("00:%02dm ", (int)(idle / 60)); 66 printf("00:%02dm ", (int)(idle / 60));
67 else if (idle < (24 * 60 * 60)) 67 else if (idle < (24 * 60 * 60))
68 printf("%02d:%02dm ", (int)(idle / (60 * 60)), 68 printf("%02d:%02dm ", (int)(idle / (60 * 60)),
69 (int)(idle % (60 * 60)) / 60); 69 (int)(idle % (60 * 60)) / 60);
70 else if (idle < (24 * 60 * 60 * 365)) 70 else if (idle < (24 * 60 * 60 * 365))
71 printf("%03ddays ", (int)(idle / (24 * 60 * 60))); 71 printf("%03ddays ", (int)(idle / (24 * 60 * 60)));
72 else 72 else
73 printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365))); 73 printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365)));
74 } else 74 } else
75 printf("%-8s ", "?"); 75 printf("%-8s ", "?");
76 76
77 printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); 77 printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
78 } 78 }
79 } 79 }
80 endutent(); 80 endutent();
81 81