diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/Config.in | 4 | ||||
-rw-r--r-- | coreutils/cal.c | 6 | ||||
-rw-r--r-- | coreutils/date.c | 14 | ||||
-rw-r--r-- | coreutils/expr.c | 2 | ||||
-rw-r--r-- | coreutils/install.c | 2 | ||||
-rw-r--r-- | coreutils/libcoreutils/getopt_mk_fifo_nod.c | 2 | ||||
-rw-r--r-- | coreutils/ls.c | 62 | ||||
-rw-r--r-- | coreutils/nice.c | 2 | ||||
-rw-r--r-- | coreutils/printf.c | 4 | ||||
-rw-r--r-- | coreutils/rmdir.c | 2 | ||||
-rw-r--r-- | coreutils/sort.c | 4 | ||||
-rw-r--r-- | coreutils/stat.c | 18 | ||||
-rw-r--r-- | coreutils/test.c | 18 | ||||
-rw-r--r-- | coreutils/uname.c | 2 | ||||
-rw-r--r-- | coreutils/uudecode.c | 10 | ||||
-rw-r--r-- | coreutils/who.c | 64 |
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 default n depends on CONFIG_STAT help - Without this, stat will not support the '-c format' option where - users can pass a custom format string for output. This adds about + Without this, stat will not support the '-c format' option where + users can pass a custom format string for output. This adds about 7k to a nonstatic build on amd64. config 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 @@ #endif #define THURSDAY 4 /* for reformation */ -#define SATURDAY 6 /* 1 Jan 1 was a Saturday */ +#define SATURDAY 6 /* 1 Jan 1 was a Saturday */ -#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */ -#define NUMBER_MISSING_DAYS 11 /* 11 day correction */ +#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */ +#define NUMBER_MISSING_DAYS 11 /* 11 day correction */ #define MAXDAYS 42 /* max slots in a month array */ #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) &t.tm_min) == 2) { /* no adjustments needed */ } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon, - &t.tm_mday, &t.tm_hour, + &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec) == 5) { /* Adjust dates from 1-12 to 0-11 */ t.tm_mon -= 1; } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon, - &t.tm_mday, + &t.tm_mday, &t.tm_hour, &t.tm_min) == 4) { /* Adjust dates from 1-12 to 0-11 */ t.tm_mon -= 1; } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year, - &t.tm_mon, &t.tm_mday, + &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec) == 6) { t.tm_year -= 1900; /* Adjust years */ t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year, - &t.tm_mon, &t.tm_mday, + &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min) == 5) { t.tm_year -= 1900; /* Adjust years */ 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) } #define DATE_OPT_RFC2822 0x01 -#define DATE_OPT_SET 0x02 -#define DATE_OPT_UTC 0x04 -#define DATE_OPT_DATE 0x08 +#define DATE_OPT_SET 0x02 +#define DATE_OPT_UTC 0x04 +#define DATE_OPT_DATE 0x08 #define DATE_OPT_REFERENCE 0x10 #ifdef CONFIG_FEATURE_DATE_ISOFMT # 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) else { v = xmalloc (sizeof(VALUE)); v->type = string; - v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i); + v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i); } freev (l); 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[] = { { "preserve-timestamps", 0, NULL, 'p' }, { "strip", 0, NULL, 's' }, { "group", 0, NULL, 'g' }, - { "mode", 0, NULL, 'm' }, + { "mode", 0, NULL, 'm' }, { "owner", 0, NULL, 'o' }, { 0, 0, 0, 0 } }; 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) bb_getopt_ulflags(argc, argv, "m:", &smode); if(smode) { - if (bb_parse_mode(smode, &mode)) + if (bb_parse_mode(smode, &mode)) umask(0); } 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; static const struct option ls_color_opt[] = { {"color", optional_argument, NULL, 1}, - {NULL, 0, NULL, 0} + {NULL, 0, NULL, 0} }; #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) dirs = 0; for (i = 0; i < nfiles; i++) { if (S_ISDIR(dn[i]->dstat.st_mode) - && (notsubdirs || + && (notsubdirs || ((dn[i]->name[0] != '.') || (dn[i]->name[1] && ((dn[i]->name[1] != '.') || dn[i]->name[2]))))) @@ -747,7 +747,7 @@ static int list_single(struct dnode *dn) { char context[80]; int len; - + if (dn->sid) { /* I assume sid initilized with NULL */ len = strlen(dn->sid)+1; @@ -895,57 +895,57 @@ static const char ls_options[]="Cadil1gnsxAk" \ static const unsigned opt_flags[] = { LIST_SHORT | STYLE_COLUMNS, /* C */ - DISP_HIDDEN | DISP_DOT, /* a */ - DISP_NOLIST, /* d */ - LIST_INO, /* i */ - LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */ - LIST_SHORT | STYLE_SINGLE, /* 1 */ - 0, /* g - ingored */ - LIST_ID_NUMERIC, /* n */ - LIST_BLOCKS, /* s */ - DISP_ROWS, /* x */ - DISP_HIDDEN, /* A */ + DISP_HIDDEN | DISP_DOT, /* a */ + DISP_NOLIST, /* d */ + LIST_INO, /* i */ + LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */ + LIST_SHORT | STYLE_SINGLE, /* 1 */ + 0, /* g - ingored */ + LIST_ID_NUMERIC, /* n */ + LIST_BLOCKS, /* s */ + DISP_ROWS, /* x */ + DISP_HIDDEN, /* A */ #ifdef CONFIG_SELINUX - LIST_CONTEXT, /* k */ + LIST_CONTEXT, /* k */ #else - 0, /* k - ingored */ + 0, /* k - ingored */ #endif #ifdef CONFIG_FEATURE_LS_TIMESTAMPS # ifdef CONFIG_FEATURE_LS_SORTFILES TIME_CHANGE | SORT_CTIME, /* c */ # else - TIME_CHANGE, /* c */ + TIME_CHANGE, /* c */ # endif - LIST_FULLTIME, /* e */ + LIST_FULLTIME, /* e */ # ifdef CONFIG_FEATURE_LS_SORTFILES - SORT_MTIME, /* t */ + SORT_MTIME, /* t */ # else - 0, /* t - ignored -- is this correct? */ + 0, /* t - ignored -- is this correct? */ # endif # ifdef CONFIG_FEATURE_LS_SORTFILES TIME_ACCESS | SORT_ATIME, /* u */ # else - TIME_ACCESS, /* u */ + TIME_ACCESS, /* u */ # endif #endif #ifdef CONFIG_FEATURE_LS_SORTFILES - SORT_SIZE, /* S */ - SORT_EXT, /* X */ - SORT_ORDER_REVERSE, /* r */ - SORT_VERSION, /* v */ + SORT_SIZE, /* S */ + SORT_EXT, /* X */ + SORT_ORDER_REVERSE, /* r */ + SORT_VERSION, /* v */ #endif #ifdef CONFIG_FEATURE_LS_FILETYPES LIST_FILETYPE | LIST_EXEC, /* F */ - LIST_FILETYPE, /* p */ + LIST_FILETYPE, /* p */ #endif #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS - FOLLOW_LINKS, /* L */ + FOLLOW_LINKS, /* L */ #endif #ifdef CONFIG_FEATURE_LS_RECURSIVE - DISP_RECURSIVE, /* R */ + DISP_RECURSIVE, /* R */ #endif #ifdef CONFIG_FEATURE_HUMAN_READABLE - LS_DISP_HR, /* h */ + LS_DISP_HR, /* h */ #endif #ifdef CONFIG_SELINUX LIST_MODEBITS|LIST_NLINKS|LIST_CONTEXT|LIST_SIZE|LIST_DATE_TIME, /* K */ @@ -1025,7 +1025,7 @@ extern int ls_main(int argc, char **argv) for (i = 0; opt_flags[i] != (1U<<31); i++) { if (opt & (1 << i)) { unsigned int flags = opt_flags[i]; - + if (flags & LIST_MASK_TRIGGER) { all_fmt &= ~LIST_MASK; } @@ -1064,11 +1064,11 @@ extern int ls_main(int argc, char **argv) #if CONFIG_FEATURE_LS_COLOR_IS_DEFAULT char *p; - if ((p = getenv ("LS_COLORS")) != NULL && + if ((p = getenv ("LS_COLORS")) != NULL && (*p == '\0' || (strcmp(p, "none") == 0))) { ; } else if (isatty(STDOUT_FILENO)) { - show_color = 1; + show_color = 1; } #endif 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) bb_perror_msg_and_die(Xetpriority_msg, 's'); } } - + execvp(*argv, argv); /* Now exec the desired program. */ /* 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) } if(convert(arg,result)) fprintf(stderr, "%s", arg); } - + static unsigned long xstrtoul(char *arg) { unsigned long result; - multiconvert(arg,&result, (converter)safe_strtoul); + multiconvert(arg,&result, (converter)safe_strtoul); return result; } 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) /* Path is now just the parent component. Note that dirname * returns "." if there are no parents. We must distinguish * this from the case of the original path starting with '.'. - */ + */ if (do_dot || (*path != '.') || path[1]) { continue; } 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) #ifdef CONFIG_FEATURE_SORT_BIG struct sort_key *key; - + for(key=key_list;!retval && key;key=key->next_key) { flags=(key->flags) ? key->flags : global_flags; /* Chop out and modify key chunks, handling -dfib */ @@ -312,7 +312,7 @@ int sort_main(int argc, char **argv) #ifdef CONFIG_FEATURE_SORT_BIG /* if no key, perform alphabetic sort */ if(!key_list) add_key()->range[0]=1; - /* handle -c */ + /* handle -c */ if(global_flags&FLAG_c) { int j=(global_flags&FLAG_u) ? -1 : 0; 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; static char const *file_type(struct stat const *st) { - /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107 + /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107 * for some of these formats. - * To keep diagnostics grammatical in English, the + * To keep diagnostics grammatical in English, the * returned string must start with a consonant. */ 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) #ifdef CONFIG_FEATURE_STAT_FORMAT /* print statfs info */ -static void print_statfs(char *pformat, size_t buf_len, char m, - char const *filename, void const *data) +static void print_statfs(char *pformat, size_t buf_len, char m, + char const *filename, void const *data) { struct statfs const *statfsbuf = data; @@ -190,8 +190,8 @@ static void print_statfs(char *pformat, size_t buf_len, char m, } /* print stat info */ -static void print_stat(char *pformat, size_t buf_len, char m, - char const *filename, void const *data) +static void print_stat(char *pformat, size_t buf_len, char m, + char const *filename, void const *data) { #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) struct stat *statbuf = (struct stat *) data; @@ -326,9 +326,9 @@ static void print_stat(char *pformat, size_t buf_len, char m, } } -static void print_it(char const *masterformat, char const *filename, - void (*print_func) (char *, size_t, char, char const *, void const *), - void const *data) +static void print_it(char const *masterformat, char const *filename, + void (*print_func) (char *, size_t, char, char const *, void const *), + void const *data) { char *b; 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 @@ * * Copyright (c) by a whole pile of folks: * - * test(1); version 7-like -- author Erik Baalbergen - * modified by Eric Gisin to be used as built-in. - * modified by Arnold Robbins to add SVR3 compatibility - * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). - * modified by J.T. Conklin for NetBSD. - * modified by Herbert Xu to be used as built-in in ash. - * modified by Erik Andersen <andersen@codepoet.org> to be used - * in busybox. + * test(1); version 7-like -- author Erik Baalbergen + * modified by Eric Gisin to be used as built-in. + * modified by Arnold Robbins to add SVR3 compatibility + * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). + * modified by J.T. Conklin for NetBSD. + * modified by Herbert Xu to be used as built-in in ash. + * modified by Erik Andersen <andersen@codepoet.org> to be used + * in busybox. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Original copyright notice states: - * "This program is in the Public Domain." + * "This program is in the Public Domain." */ #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) } #if defined(__sparc__) && defined(__linux__) - if ((fake_sparc != NULL) + if ((fake_sparc != NULL) && ((fake_sparc[0] == 'y') || (fake_sparc[0] == 'Y'))) { 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) bb_error_msg_and_die("Short file"); } - while (length > 0) { + while (length > 0) { /* Merge four 6 bit chars to three 8 bit chars */ fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream); line_ptr++; @@ -65,14 +65,14 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream) break; } - fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream); + fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream); line_ptr++; length--; if (length == 0) { break; } - fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream); + fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream); line_ptr += 2; length -= 2; } @@ -130,10 +130,10 @@ static int read_base64(FILE *src_stream, FILE *dst_stream) /* Merge 6 bit chars to 8 bit */ fputc(translated[0] << 2 | translated[1] >> 4, dst_stream); if (count > 2) { - fputc(translated[1] << 4 | translated[2] >> 2, dst_stream); + fputc(translated[1] << 4 | translated[2] >> 2, dst_stream); } if (count > 3) { - fputc(translated[2] << 6 | translated[3], dst_stream); + fputc(translated[2] << 6 | translated[3], dst_stream); } } } 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) time_t now, idle; if (argc > 1) - bb_show_usage(); + bb_show_usage(); setutent(); devlen = sizeof("/dev/") - 1; printf("USER TTY IDLE FROM HOST\n"); while ((ut = getutent()) != NULL) { - char name[40]; + char name[40]; - if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { - len = strlen(ut->ut_line); - if (ut->ut_line[0] == '/') { - strncpy(name, ut->ut_line, len); - name[len] = '\0'; - strcpy(ut->ut_line, ut->ut_line + devlen); - } else { - strcpy(name, "/dev/"); - strncpy(name+devlen, ut->ut_line, len); - name[devlen+len] = '\0'; - } + if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { + len = strlen(ut->ut_line); + if (ut->ut_line[0] == '/') { + strncpy(name, ut->ut_line, len); + name[len] = '\0'; + strcpy(ut->ut_line, ut->ut_line + devlen); + } else { + strcpy(name, "/dev/"); + strncpy(name+devlen, ut->ut_line, len); + name[devlen+len] = '\0'; + } - printf("%-10s %-8s ", ut->ut_user, ut->ut_line); + printf("%-10s %-8s ", ut->ut_user, ut->ut_line); - if (stat(name, &st) == 0) { - now = time(NULL); - idle = now - st.st_atime; + if (stat(name, &st) == 0) { + now = time(NULL); + idle = now - st.st_atime; - if (idle < 60) - printf("00:00m "); - else if (idle < (60 * 60)) - printf("00:%02dm ", (int)(idle / 60)); - else if (idle < (24 * 60 * 60)) - printf("%02d:%02dm ", (int)(idle / (60 * 60)), - (int)(idle % (60 * 60)) / 60); - else if (idle < (24 * 60 * 60 * 365)) - printf("%03ddays ", (int)(idle / (24 * 60 * 60))); - else - printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365))); - } else - printf("%-8s ", "?"); + if (idle < 60) + printf("00:00m "); + else if (idle < (60 * 60)) + printf("00:%02dm ", (int)(idle / 60)); + else if (idle < (24 * 60 * 60)) + printf("%02d:%02dm ", (int)(idle / (60 * 60)), + (int)(idle % (60 * 60)) / 60); + else if (idle < (24 * 60 * 60 * 365)) + printf("%03ddays ", (int)(idle / (24 * 60 * 60))); + else + printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365))); + } else + printf("%-8s ", "?"); - printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); - } + printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); + } } endutent(); |