style fixes

This commit is contained in:
Denis Vlasenko 2007-04-13 23:22:00 +00:00
parent f7fcca4af7
commit 87468857f6
8 changed files with 58 additions and 59 deletions

View File

@ -85,18 +85,18 @@ uncompress(int fd_in, int fd_out)
{ {
USE_DESKTOP(long long total_written = 0;) USE_DESKTOP(long long total_written = 0;)
unsigned char *stackp; unsigned char *stackp;
long int code; long code;
int finchar; int finchar;
long int oldcode; long oldcode;
long int incode; long incode;
int inbits; int inbits;
int posbits; int posbits;
int outpos; int outpos;
int insize; int insize;
int bitmask; int bitmask;
long int free_ent; long free_ent;
long int maxcode; long maxcode;
long int maxmaxcode; long maxmaxcode;
int n_bits; int n_bits;
int rsize = 0; int rsize = 0;
RESERVE_CONFIG_UBUFFER(inbuf, IBUFSIZ + 64); RESERVE_CONFIG_UBUFFER(inbuf, IBUFSIZ + 64);
@ -243,7 +243,7 @@ uncompress(int fd_in, int fd_out)
} }
/* Generate output characters in reverse order */ /* Generate output characters in reverse order */
while ((long int) code >= (long int) 256) { while ((long) code >= (long) 256) {
*--stackp = tab_suffixof(code); *--stackp = tab_suffixof(code);
code = tab_prefixof(code); code = tab_prefixof(code);
} }

View File

@ -133,7 +133,7 @@ static void print_statfs(char *pformat, const size_t buf_len, const char m,
printf(pformat, statfsbuf->f_namelen); printf(pformat, statfsbuf->f_namelen);
} else if (m == 't') { } else if (m == 't') {
strncat(pformat, "lx", buf_len); strncat(pformat, "lx", buf_len);
printf(pformat, (unsigned long int) (statfsbuf->f_type)); /* no equiv */ printf(pformat, (unsigned long) (statfsbuf->f_type)); /* no equiv */
} else if (m == 'T') { } else if (m == 'T') {
strncat(pformat, "s", buf_len); strncat(pformat, "s", buf_len);
printf(pformat, human_fstype(statfsbuf->f_type)); printf(pformat, human_fstype(statfsbuf->f_type));
@ -148,7 +148,7 @@ static void print_statfs(char *pformat, const size_t buf_len, const char m,
printf(pformat, (intmax_t) (statfsbuf->f_bavail)); printf(pformat, (intmax_t) (statfsbuf->f_bavail));
} else if (m == 's' || m == 'S') { } else if (m == 's' || m == 'S') {
strncat(pformat, "lu", buf_len); strncat(pformat, "lu", buf_len);
printf(pformat, (unsigned long int) (statfsbuf->f_bsize)); printf(pformat, (unsigned long) (statfsbuf->f_bsize));
} else if (m == 'c') { } else if (m == 'c') {
strncat(pformat, "jd", buf_len); strncat(pformat, "jd", buf_len);
printf(pformat, (intmax_t) (statfsbuf->f_files)); printf(pformat, (intmax_t) (statfsbuf->f_files));
@ -205,22 +205,22 @@ static void print_stat(char *pformat, const size_t buf_len, const char m,
printf(pformat, (uintmax_t) statbuf->st_ino); printf(pformat, (uintmax_t) statbuf->st_ino);
} else if (m == 'a') { } else if (m == 'a') {
strncat(pformat, "lo", buf_len); strncat(pformat, "lo", buf_len);
printf(pformat, (unsigned long int) (statbuf->st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO))); printf(pformat, (unsigned long) (statbuf->st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)));
} else if (m == 'A') { } else if (m == 'A') {
strncat(pformat, "s", buf_len); strncat(pformat, "s", buf_len);
printf(pformat, bb_mode_string(statbuf->st_mode)); printf(pformat, bb_mode_string(statbuf->st_mode));
} else if (m == 'f') { } else if (m == 'f') {
strncat(pformat, "lx", buf_len); strncat(pformat, "lx", buf_len);
printf(pformat, (unsigned long int) statbuf->st_mode); printf(pformat, (unsigned long) statbuf->st_mode);
} else if (m == 'F') { } else if (m == 'F') {
strncat(pformat, "s", buf_len); strncat(pformat, "s", buf_len);
printf(pformat, file_type(statbuf)); printf(pformat, file_type(statbuf));
} else if (m == 'h') { } else if (m == 'h') {
strncat(pformat, "lu", buf_len); strncat(pformat, "lu", buf_len);
printf(pformat, (unsigned long int) statbuf->st_nlink); printf(pformat, (unsigned long) statbuf->st_nlink);
} else if (m == 'u') { } else if (m == 'u') {
strncat(pformat, "lu", buf_len); strncat(pformat, "lu", buf_len);
printf(pformat, (unsigned long int) statbuf->st_uid); printf(pformat, (unsigned long) statbuf->st_uid);
} else if (m == 'U') { } else if (m == 'U') {
strncat(pformat, "s", buf_len); strncat(pformat, "s", buf_len);
setpwent(); setpwent();
@ -228,7 +228,7 @@ static void print_stat(char *pformat, const size_t buf_len, const char m,
printf(pformat, (pw_ent != 0L) ? pw_ent->pw_name : "UNKNOWN"); printf(pformat, (pw_ent != 0L) ? pw_ent->pw_name : "UNKNOWN");
} else if (m == 'g') { } else if (m == 'g') {
strncat(pformat, "lu", buf_len); strncat(pformat, "lu", buf_len);
printf(pformat, (unsigned long int) statbuf->st_gid); printf(pformat, (unsigned long) statbuf->st_gid);
} else if (m == 'G') { } else if (m == 'G') {
strncat(pformat, "s", buf_len); strncat(pformat, "s", buf_len);
setgrent(); setgrent();
@ -236,40 +236,40 @@ static void print_stat(char *pformat, const size_t buf_len, const char m,
printf(pformat, (gw_ent != 0L) ? gw_ent->gr_name : "UNKNOWN"); printf(pformat, (gw_ent != 0L) ? gw_ent->gr_name : "UNKNOWN");
} else if (m == 't') { } else if (m == 't') {
strncat(pformat, "lx", buf_len); strncat(pformat, "lx", buf_len);
printf(pformat, (unsigned long int) major(statbuf->st_rdev)); printf(pformat, (unsigned long) major(statbuf->st_rdev));
} else if (m == 'T') { } else if (m == 'T') {
strncat(pformat, "lx", buf_len); strncat(pformat, "lx", buf_len);
printf(pformat, (unsigned long int) minor(statbuf->st_rdev)); printf(pformat, (unsigned long) minor(statbuf->st_rdev));
} else if (m == 's') { } else if (m == 's') {
strncat(pformat, "ju", buf_len); strncat(pformat, "ju", buf_len);
printf(pformat, (uintmax_t) (statbuf->st_size)); printf(pformat, (uintmax_t) (statbuf->st_size));
} else if (m == 'B') { } else if (m == 'B') {
strncat(pformat, "lu", buf_len); strncat(pformat, "lu", buf_len);
printf(pformat, (unsigned long int) 512); //ST_NBLOCKSIZE printf(pformat, (unsigned long) 512); //ST_NBLOCKSIZE
} else if (m == 'b') { } else if (m == 'b') {
strncat(pformat, "ju", buf_len); strncat(pformat, "ju", buf_len);
printf(pformat, (uintmax_t) statbuf->st_blocks); printf(pformat, (uintmax_t) statbuf->st_blocks);
} else if (m == 'o') { } else if (m == 'o') {
strncat(pformat, "lu", buf_len); strncat(pformat, "lu", buf_len);
printf(pformat, (unsigned long int) statbuf->st_blksize); printf(pformat, (unsigned long) statbuf->st_blksize);
} else if (m == 'x') { } else if (m == 'x') {
strncat(pformat, "s", buf_len); strncat(pformat, "s", buf_len);
printf(pformat, human_time(statbuf->st_atime)); printf(pformat, human_time(statbuf->st_atime));
} else if (m == 'X') { } else if (m == 'X') {
strncat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu", buf_len); strncat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu", buf_len);
printf(pformat, (unsigned long int) statbuf->st_atime); printf(pformat, (unsigned long) statbuf->st_atime);
} else if (m == 'y') { } else if (m == 'y') {
strncat(pformat, "s", buf_len); strncat(pformat, "s", buf_len);
printf(pformat, human_time(statbuf->st_mtime)); printf(pformat, human_time(statbuf->st_mtime));
} else if (m == 'Y') { } else if (m == 'Y') {
strncat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu", buf_len); strncat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu", buf_len);
printf(pformat, (unsigned long int) statbuf->st_mtime); printf(pformat, (unsigned long) statbuf->st_mtime);
} else if (m == 'z') { } else if (m == 'z') {
strncat(pformat, "s", buf_len); strncat(pformat, "s", buf_len);
printf(pformat, human_time(statbuf->st_ctime)); printf(pformat, human_time(statbuf->st_ctime));
} else if (m == 'Z') { } else if (m == 'Z') {
strncat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu", buf_len); strncat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu", buf_len);
printf(pformat, (unsigned long int) statbuf->st_ctime); printf(pformat, (unsigned long) statbuf->st_ctime);
#if ENABLE_SELINUX #if ENABLE_SELINUX
} else if (m == 'C' && (option_mask32 & OPT_SELINUX)) { } else if (m == 'C' && (option_mask32 & OPT_SELINUX)) {
strncat(pformat, "s", buf_len); strncat(pformat, "s", buf_len);
@ -395,7 +395,7 @@ static bool do_statfs(char const *filename, char const *format)
statfsbuf.f_namelen); statfsbuf.f_namelen);
if (option_mask32 & OPT_TERSE) if (option_mask32 & OPT_TERSE)
printf("%lx ", (unsigned long int) (statfsbuf.f_type)); printf("%lx ", (unsigned long) (statfsbuf.f_type));
else else
printf("Type: %s\n", human_fstype(statfsbuf.f_type)); printf("Type: %s\n", human_fstype(statfsbuf.f_type));
@ -406,7 +406,7 @@ static bool do_statfs(char const *filename, char const *format)
"Blocks: Total: %-10jd Free: %-10jd Available: %jd\n" "Blocks: Total: %-10jd Free: %-10jd Available: %jd\n"
"Inodes: Total: %-10jd Free: %jd\n"); "Inodes: Total: %-10jd Free: %jd\n");
printf(format, printf(format,
(unsigned long int) (statfsbuf.f_bsize), (unsigned long) (statfsbuf.f_bsize),
(intmax_t) (statfsbuf.f_blocks), (intmax_t) (statfsbuf.f_blocks),
(intmax_t) (statfsbuf.f_bfree), (intmax_t) (statfsbuf.f_bfree),
(intmax_t) (statfsbuf.f_bavail), (intmax_t) (statfsbuf.f_bavail),
@ -425,7 +425,7 @@ static bool do_statfs(char const *filename, char const *format)
"Blocks: Total: %-10jd Free: %-10jd Available: %jd\n" "Blocks: Total: %-10jd Free: %-10jd Available: %jd\n"
"Inodes: Total: %-10jd Free: %jd\n")); "Inodes: Total: %-10jd Free: %jd\n"));
printf(format, printf(format,
(unsigned long int) (statfsbuf.f_bsize), (unsigned long) (statfsbuf.f_bsize),
(intmax_t) (statfsbuf.f_blocks), (intmax_t) (statfsbuf.f_blocks),
(intmax_t) (statfsbuf.f_bfree), (intmax_t) (statfsbuf.f_bfree),
(intmax_t) (statfsbuf.f_bavail), (intmax_t) (statfsbuf.f_bavail),
@ -529,18 +529,18 @@ static bool do_stat(char const *filename, char const *format)
filename, filename,
(uintmax_t) (statbuf.st_size), (uintmax_t) (statbuf.st_size),
(uintmax_t) statbuf.st_blocks, (uintmax_t) statbuf.st_blocks,
(unsigned long int) statbuf.st_mode, (unsigned long) statbuf.st_mode,
(unsigned long int) statbuf.st_uid, (unsigned long) statbuf.st_uid,
(unsigned long int) statbuf.st_gid, (unsigned long) statbuf.st_gid,
(uintmax_t) statbuf.st_dev, (uintmax_t) statbuf.st_dev,
(uintmax_t) statbuf.st_ino, (uintmax_t) statbuf.st_ino,
(unsigned long int) statbuf.st_nlink, (unsigned long) statbuf.st_nlink,
(unsigned long int) major(statbuf.st_rdev), (unsigned long) major(statbuf.st_rdev),
(unsigned long int) minor(statbuf.st_rdev), (unsigned long) minor(statbuf.st_rdev),
(unsigned long int) statbuf.st_atime, (unsigned long) statbuf.st_atime,
(unsigned long int) statbuf.st_mtime, (unsigned long) statbuf.st_mtime,
(unsigned long int) statbuf.st_ctime, (unsigned long) statbuf.st_ctime,
(unsigned long int) statbuf.st_blksize (unsigned long) statbuf.st_blksize
); );
#if ENABLE_SELINUX #if ENABLE_SELINUX
if (option_mask32 & OPT_SELINUX) if (option_mask32 & OPT_SELINUX)
@ -569,24 +569,24 @@ static bool do_stat(char const *filename, char const *format)
"Device: %jxh/%jud\tInode: %-10ju Links: %-5lu", "Device: %jxh/%jud\tInode: %-10ju Links: %-5lu",
(uintmax_t) (statbuf.st_size), (uintmax_t) (statbuf.st_size),
(uintmax_t) statbuf.st_blocks, (uintmax_t) statbuf.st_blocks,
(unsigned long int) statbuf.st_blksize, (unsigned long) statbuf.st_blksize,
file_type(&statbuf), file_type(&statbuf),
(uintmax_t) statbuf.st_dev, (uintmax_t) statbuf.st_dev,
(uintmax_t) statbuf.st_dev, (uintmax_t) statbuf.st_dev,
(uintmax_t) statbuf.st_ino, (uintmax_t) statbuf.st_ino,
(unsigned long int) statbuf.st_nlink); (unsigned long) statbuf.st_nlink);
if (S_ISBLK(statbuf.st_mode) || S_ISCHR(statbuf.st_mode)) if (S_ISBLK(statbuf.st_mode) || S_ISCHR(statbuf.st_mode))
printf(" Device type: %lx,%lx\n", printf(" Device type: %lx,%lx\n",
(unsigned long int) major(statbuf.st_rdev), (unsigned long) major(statbuf.st_rdev),
(unsigned long int) minor(statbuf.st_rdev)); (unsigned long) minor(statbuf.st_rdev));
else else
putchar('\n'); putchar('\n');
printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n", printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n",
(unsigned long int) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)), (unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)),
bb_mode_string(statbuf.st_mode), bb_mode_string(statbuf.st_mode),
(unsigned long int) statbuf.st_uid, (unsigned long) statbuf.st_uid,
(pw_ent != 0L) ? pw_ent->pw_name : "UNKNOWN", (pw_ent != 0L) ? pw_ent->pw_name : "UNKNOWN",
(unsigned long int) statbuf.st_gid, (unsigned long) statbuf.st_gid,
(gw_ent != 0L) ? gw_ent->gr_name : "UNKNOWN"); (gw_ent != 0L) ? gw_ent->gr_name : "UNKNOWN");
#if ENABLE_SELINUX #if ENABLE_SELINUX
printf(" S_Context: %lc\n", *scontext); printf(" S_Context: %lc\n", *scontext);

View File

@ -173,13 +173,13 @@ __extension__ typedef unsigned long long __u64;
#else #else
/* Largest integral types. */ /* Largest integral types. */
#if __BIG_ENDIAN__ #if __BIG_ENDIAN__
typedef long int intmax_t; typedef long intmax_t;
typedef unsigned long int uintmax_t; typedef unsigned long uintmax_t;
#else #else
__extension__ __extension__
typedef long long int intmax_t; typedef long long intmax_t;
__extension__ __extension__
typedef unsigned long long int uintmax_t; typedef unsigned long long uintmax_t;
#endif #endif
#endif #endif

View File

@ -37,13 +37,13 @@
struct spwd { struct spwd {
char *sp_namp; /* Login name */ char *sp_namp; /* Login name */
char *sp_pwdp; /* Encrypted password */ char *sp_pwdp; /* Encrypted password */
long int sp_lstchg; /* Date of last change */ long sp_lstchg; /* Date of last change */
long int sp_min; /* Minimum number of days between changes */ long sp_min; /* Minimum number of days between changes */
long int sp_max; /* Maximum number of days between changes */ long sp_max; /* Maximum number of days between changes */
long int sp_warn; /* Number of days to warn user to change the password */ long sp_warn; /* Number of days to warn user to change the password */
long int sp_inact; /* Number of days the account may be inactive */ long sp_inact; /* Number of days the account may be inactive */
long int sp_expire; /* Number of days since 1970-01-01 until account expires */ long sp_expire; /* Number of days since 1970-01-01 until account expires */
unsigned long int sp_flag; /* Reserved */ unsigned long sp_flag; /* Reserved */
}; };

View File

@ -679,7 +679,7 @@ int putspent(const struct spwd *p, FILE *stream)
{ {
static const char ld_format[] = "%ld:"; static const char ld_format[] = "%ld:";
const char *f; const char *f;
long int x; long x;
int i; int i;
int rv = -1; int rv = -1;
@ -692,7 +692,7 @@ int putspent(const struct spwd *p, FILE *stream)
for (i=0 ; i < sizeof(_sp_off) ; i++) { for (i=0 ; i < sizeof(_sp_off) ; i++) {
f = ld_format; f = ld_format;
x = *(const long int *)(((const char *) p) + _sp_off[i]); x = *(const long *)(((const char *) p) + _sp_off[i]);
if (x == -1) { if (x == -1) {
f += 3; f += 3;
} }

View File

@ -478,7 +478,7 @@ static void set_flags(char *flagstr, int flags)
void bb_displayroutes(int noresolve, int netstatfmt) void bb_displayroutes(int noresolve, int netstatfmt)
{ {
char devname[64], flags[16], sdest[16], sgw[16]; char devname[64], flags[16], sdest[16], sgw[16];
unsigned long int d, g, m; unsigned long d, g, m;
int flgs, ref, use, metric, mtu, win, ir; int flgs, ref, use, metric, mtu, win, ir;
struct sockaddr_in s_addr; struct sockaddr_in s_addr;
struct in_addr mask; struct in_addr mask;

View File

@ -1219,7 +1219,7 @@ yyparse ()
YYDPRINTF ((stderr, "Stack size increased to %lu\n", YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize)); (unsigned long) yystacksize));
if (yyss + yystacksize - 1 <= yyssp) if (yyss + yystacksize - 1 <= yyssp)
YYABORT; YYABORT;

View File

@ -201,17 +201,16 @@ static int parse_mount_options(char *options, char **unrecognized)
static llist_t *get_block_backed_filesystems(void) static llist_t *get_block_backed_filesystems(void)
{ {
static const char *const filesystems[] = { static const char filesystems[2][sizeof("/proc/filesystems")] = {
"/etc/filesystems", "/etc/filesystems",
"/proc/filesystems", "/proc/filesystems",
0
}; };
char *fs, *buf; char *fs, *buf;
llist_t *list = 0; llist_t *list = 0;
int i; int i;
FILE *f; FILE *f;
for (i = 0; filesystems[i]; i++) { for (i = 0; i < 2; i++) {
f = fopen(filesystems[i], "r"); f = fopen(filesystems[i], "r");
if (!f) continue; if (!f) continue;