From 87468857f685863cd763ae361c2cb3be0ee53a68 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 13 Apr 2007 23:22:00 +0000 Subject: [PATCH] style fixes --- archival/libunarchive/decompress_uncompress.c | 14 ++-- coreutils/stat.c | 68 +++++++++---------- include/platform.h | 8 +-- include/shadow_.h | 14 ++-- libpwdgrp/pwd_grp.c | 4 +- networking/route.c | 2 +- scripts/kconfig/zconf.tab.c_shipped | 2 +- util-linux/mount.c | 5 +- 8 files changed, 58 insertions(+), 59 deletions(-) diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c index 8ce3cba74..a1d7fd67c 100644 --- a/archival/libunarchive/decompress_uncompress.c +++ b/archival/libunarchive/decompress_uncompress.c @@ -85,18 +85,18 @@ uncompress(int fd_in, int fd_out) { USE_DESKTOP(long long total_written = 0;) unsigned char *stackp; - long int code; + long code; int finchar; - long int oldcode; - long int incode; + long oldcode; + long incode; int inbits; int posbits; int outpos; int insize; int bitmask; - long int free_ent; - long int maxcode; - long int maxmaxcode; + long free_ent; + long maxcode; + long maxmaxcode; int n_bits; int rsize = 0; RESERVE_CONFIG_UBUFFER(inbuf, IBUFSIZ + 64); @@ -243,7 +243,7 @@ uncompress(int fd_in, int fd_out) } /* Generate output characters in reverse order */ - while ((long int) code >= (long int) 256) { + while ((long) code >= (long) 256) { *--stackp = tab_suffixof(code); code = tab_prefixof(code); } diff --git a/coreutils/stat.c b/coreutils/stat.c index 7c5631764..16b8d1e44 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c @@ -133,7 +133,7 @@ static void print_statfs(char *pformat, const size_t buf_len, const char m, printf(pformat, statfsbuf->f_namelen); } else if (m == 't') { 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') { strncat(pformat, "s", buf_len); 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)); } else if (m == 's' || m == 'S') { strncat(pformat, "lu", buf_len); - printf(pformat, (unsigned long int) (statfsbuf->f_bsize)); + printf(pformat, (unsigned long) (statfsbuf->f_bsize)); } else if (m == 'c') { strncat(pformat, "jd", buf_len); 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); } else if (m == 'a') { 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') { strncat(pformat, "s", buf_len); printf(pformat, bb_mode_string(statbuf->st_mode)); } else if (m == 'f') { strncat(pformat, "lx", buf_len); - printf(pformat, (unsigned long int) statbuf->st_mode); + printf(pformat, (unsigned long) statbuf->st_mode); } else if (m == 'F') { strncat(pformat, "s", buf_len); printf(pformat, file_type(statbuf)); } else if (m == 'h') { strncat(pformat, "lu", buf_len); - printf(pformat, (unsigned long int) statbuf->st_nlink); + printf(pformat, (unsigned long) statbuf->st_nlink); } else if (m == 'u') { strncat(pformat, "lu", buf_len); - printf(pformat, (unsigned long int) statbuf->st_uid); + printf(pformat, (unsigned long) statbuf->st_uid); } else if (m == 'U') { strncat(pformat, "s", buf_len); 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"); } else if (m == 'g') { strncat(pformat, "lu", buf_len); - printf(pformat, (unsigned long int) statbuf->st_gid); + printf(pformat, (unsigned long) statbuf->st_gid); } else if (m == 'G') { strncat(pformat, "s", buf_len); 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"); } else if (m == 't') { 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') { 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') { strncat(pformat, "ju", buf_len); printf(pformat, (uintmax_t) (statbuf->st_size)); } else if (m == 'B') { strncat(pformat, "lu", buf_len); - printf(pformat, (unsigned long int) 512); //ST_NBLOCKSIZE + printf(pformat, (unsigned long) 512); //ST_NBLOCKSIZE } else if (m == 'b') { strncat(pformat, "ju", buf_len); printf(pformat, (uintmax_t) statbuf->st_blocks); } else if (m == 'o') { strncat(pformat, "lu", buf_len); - printf(pformat, (unsigned long int) statbuf->st_blksize); + printf(pformat, (unsigned long) statbuf->st_blksize); } else if (m == 'x') { strncat(pformat, "s", buf_len); printf(pformat, human_time(statbuf->st_atime)); } else if (m == 'X') { 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') { strncat(pformat, "s", buf_len); printf(pformat, human_time(statbuf->st_mtime)); } else if (m == 'Y') { 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') { strncat(pformat, "s", buf_len); printf(pformat, human_time(statbuf->st_ctime)); } else if (m == 'Z') { 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 } else if (m == 'C' && (option_mask32 & OPT_SELINUX)) { strncat(pformat, "s", buf_len); @@ -395,7 +395,7 @@ static bool do_statfs(char const *filename, char const *format) statfsbuf.f_namelen); if (option_mask32 & OPT_TERSE) - printf("%lx ", (unsigned long int) (statfsbuf.f_type)); + printf("%lx ", (unsigned long) (statfsbuf.f_type)); else 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" "Inodes: Total: %-10jd Free: %jd\n"); printf(format, - (unsigned long int) (statfsbuf.f_bsize), + (unsigned long) (statfsbuf.f_bsize), (intmax_t) (statfsbuf.f_blocks), (intmax_t) (statfsbuf.f_bfree), (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" "Inodes: Total: %-10jd Free: %jd\n")); printf(format, - (unsigned long int) (statfsbuf.f_bsize), + (unsigned long) (statfsbuf.f_bsize), (intmax_t) (statfsbuf.f_blocks), (intmax_t) (statfsbuf.f_bfree), (intmax_t) (statfsbuf.f_bavail), @@ -529,18 +529,18 @@ static bool do_stat(char const *filename, char const *format) filename, (uintmax_t) (statbuf.st_size), (uintmax_t) statbuf.st_blocks, - (unsigned long int) statbuf.st_mode, - (unsigned long int) statbuf.st_uid, - (unsigned long int) statbuf.st_gid, + (unsigned long) statbuf.st_mode, + (unsigned long) statbuf.st_uid, + (unsigned long) statbuf.st_gid, (uintmax_t) statbuf.st_dev, (uintmax_t) statbuf.st_ino, - (unsigned long int) statbuf.st_nlink, - (unsigned long int) major(statbuf.st_rdev), - (unsigned long int) minor(statbuf.st_rdev), - (unsigned long int) statbuf.st_atime, - (unsigned long int) statbuf.st_mtime, - (unsigned long int) statbuf.st_ctime, - (unsigned long int) statbuf.st_blksize + (unsigned long) statbuf.st_nlink, + (unsigned long) major(statbuf.st_rdev), + (unsigned long) minor(statbuf.st_rdev), + (unsigned long) statbuf.st_atime, + (unsigned long) statbuf.st_mtime, + (unsigned long) statbuf.st_ctime, + (unsigned long) statbuf.st_blksize ); #if ENABLE_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", (uintmax_t) (statbuf.st_size), (uintmax_t) statbuf.st_blocks, - (unsigned long int) statbuf.st_blksize, + (unsigned long) statbuf.st_blksize, file_type(&statbuf), (uintmax_t) statbuf.st_dev, (uintmax_t) statbuf.st_dev, (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)) printf(" Device type: %lx,%lx\n", - (unsigned long int) major(statbuf.st_rdev), - (unsigned long int) minor(statbuf.st_rdev)); + (unsigned long) major(statbuf.st_rdev), + (unsigned long) minor(statbuf.st_rdev)); else putchar('\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), - (unsigned long int) statbuf.st_uid, + (unsigned long) statbuf.st_uid, (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"); #if ENABLE_SELINUX printf(" S_Context: %lc\n", *scontext); diff --git a/include/platform.h b/include/platform.h index 4ed5fe624..0adbed4e7 100644 --- a/include/platform.h +++ b/include/platform.h @@ -173,13 +173,13 @@ __extension__ typedef unsigned long long __u64; #else /* Largest integral types. */ #if __BIG_ENDIAN__ -typedef long int intmax_t; -typedef unsigned long int uintmax_t; +typedef long intmax_t; +typedef unsigned long uintmax_t; #else __extension__ -typedef long long int intmax_t; +typedef long long intmax_t; __extension__ -typedef unsigned long long int uintmax_t; +typedef unsigned long long uintmax_t; #endif #endif diff --git a/include/shadow_.h b/include/shadow_.h index fb2153c52..92bcde864 100644 --- a/include/shadow_.h +++ b/include/shadow_.h @@ -37,13 +37,13 @@ struct spwd { char *sp_namp; /* Login name */ char *sp_pwdp; /* Encrypted password */ - long int sp_lstchg; /* Date of last change */ - long int sp_min; /* Minimum number of days between changes */ - long int sp_max; /* Maximum number of days between changes */ - long int 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 int sp_expire; /* Number of days since 1970-01-01 until account expires */ - unsigned long int sp_flag; /* Reserved */ + long sp_lstchg; /* Date of last change */ + long sp_min; /* Minimum number of days between changes */ + long sp_max; /* Maximum number of days between changes */ + long sp_warn; /* Number of days to warn user to change the password */ + long sp_inact; /* Number of days the account may be inactive */ + long sp_expire; /* Number of days since 1970-01-01 until account expires */ + unsigned long sp_flag; /* Reserved */ }; diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c index 7a8a23745..d59fd50bf 100644 --- a/libpwdgrp/pwd_grp.c +++ b/libpwdgrp/pwd_grp.c @@ -679,7 +679,7 @@ int putspent(const struct spwd *p, FILE *stream) { static const char ld_format[] = "%ld:"; const char *f; - long int x; + long x; int i; int rv = -1; @@ -692,7 +692,7 @@ int putspent(const struct spwd *p, FILE *stream) for (i=0 ; i < sizeof(_sp_off) ; i++) { 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) { f += 3; } diff --git a/networking/route.c b/networking/route.c index dfb8ee56f..da5969868 100644 --- a/networking/route.c +++ b/networking/route.c @@ -478,7 +478,7 @@ static void set_flags(char *flagstr, int flags) void bb_displayroutes(int noresolve, int netstatfmt) { 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; struct sockaddr_in s_addr; struct in_addr mask; diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index ca8003dce..97100b764 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped @@ -1219,7 +1219,7 @@ yyparse () YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; diff --git a/util-linux/mount.c b/util-linux/mount.c index e4a7c81c6..7dd70392a 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -201,17 +201,16 @@ static int parse_mount_options(char *options, char **unrecognized) static llist_t *get_block_backed_filesystems(void) { - static const char *const filesystems[] = { + static const char filesystems[2][sizeof("/proc/filesystems")] = { "/etc/filesystems", "/proc/filesystems", - 0 }; char *fs, *buf; llist_t *list = 0; int i; FILE *f; - for (i = 0; filesystems[i]; i++) { + for (i = 0; i < 2; i++) { f = fopen(filesystems[i], "r"); if (!f) continue;