aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-09-06 12:47:55 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-09-06 12:47:55 +0200
commit043b1e5d997d9b582a5aee37bd56e2e4f29be6e4 (patch)
treebab07bc427f178857896a8bf252c61ea1a5c67a2
parent5370bfb123266ab5716f321e43d3f8f6da7d7143 (diff)
downloadbusybox-w32-043b1e5d997d9b582a5aee37bd56e2e4f29be6e4.tar.gz
busybox-w32-043b1e5d997d9b582a5aee37bd56e2e4f29be6e4.tar.bz2
busybox-w32-043b1e5d997d9b582a5aee37bd56e2e4f29be6e4.zip
more C standard compat fixes from Dan Fandrich
function old new delta docolon 207 204 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/cut.c5
-rw-r--r--coreutils/dd.c2
-rw-r--r--coreutils/expr.c2
-rw-r--r--coreutils/head.c2
-rw-r--r--coreutils/od_bloaty.c4
-rw-r--r--coreutils/sleep.c2
-rw-r--r--coreutils/split.c2
-rw-r--r--coreutils/stty.c2
-rw-r--r--coreutils/tail.c2
-rw-r--r--coreutils/uname.c3
-rw-r--r--findutils/find.c2
-rw-r--r--libbb/kernel_version.c5
-rw-r--r--libbb/login.c4
-rw-r--r--libbb/xconnect.c1
-rw-r--r--miscutils/dc.c2
-rw-r--r--miscutils/watchdog.c2
-rw-r--r--modutils/depmod.c4
-rw-r--r--modutils/modprobe-small.c2
-rw-r--r--networking/ifupdown.c4
-rw-r--r--networking/udhcp/options.c2
-rw-r--r--runit/svlogd.c4
-rw-r--r--shell/msh_unused.c2
-rw-r--r--util-linux/hexdump.c2
-rw-r--r--util-linux/hwclock.c8
24 files changed, 40 insertions, 30 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 9cc22be16..240ce4bb9 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -111,7 +111,10 @@ static void cut_file(FILE *file, char delim, const struct cut_list *cut_lists, u
111 int ndelim = -1; /* zero-based / one-based problem */ 111 int ndelim = -1; /* zero-based / one-based problem */
112 int nfields_printed = 0; 112 int nfields_printed = 0;
113 char *field = NULL; 113 char *field = NULL;
114 const char delimiter[2] = { delim, 0 }; 114 char delimiter[2];
115
116 delimiter[0] = delim;
117 delimiter[1] = 0;
115 118
116 /* does this line contain any delimiters? */ 119 /* does this line contain any delimiters? */
117 if (strchr(line, delim) == NULL) { 120 if (strchr(line, delim) == NULL) {
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 5281d8118..3fdfc236a 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -29,7 +29,7 @@ static const struct suffix_mult dd_suffixes[] = {
29 { "M", 1048576 }, 29 { "M", 1048576 },
30 { "GD", 1000000000 }, 30 { "GD", 1000000000 },
31 { "G", 1073741824 }, 31 { "G", 1073741824 },
32 { } 32 { "", 0 }
33}; 33};
34 34
35struct globals { 35struct globals {
diff --git a/coreutils/expr.c b/coreutils/expr.c
index 54c2ee165..f5701a460 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -214,9 +214,9 @@ static arith_t arithmetic_common(VALUE *l, VALUE *r, int op)
214 214
215static VALUE *docolon(VALUE *sv, VALUE *pv) 215static VALUE *docolon(VALUE *sv, VALUE *pv)
216{ 216{
217 enum { NMATCH = 2 };
217 VALUE *v; 218 VALUE *v;
218 regex_t re_buffer; 219 regex_t re_buffer;
219 const int NMATCH = 2;
220 regmatch_t re_regs[NMATCH]; 220 regmatch_t re_regs[NMATCH];
221 221
222 tostring(sv); 222 tostring(sv);
diff --git a/coreutils/head.c b/coreutils/head.c
index ac476d091..0fab8a8ae 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -25,7 +25,7 @@ static const struct suffix_mult head_suffixes[] = {
25 { "b", 512 }, 25 { "b", 512 },
26 { "k", 1024 }, 26 { "k", 1024 },
27 { "m", 1024*1024 }, 27 { "m", 1024*1024 },
28 { } 28 { "", 0 }
29}; 29};
30#endif 30#endif
31 31
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 00efec51c..1d5769bd8 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -963,7 +963,7 @@ parse_old_offset(const char *s, off_t *offset)
963 static const struct suffix_mult Bb[] = { 963 static const struct suffix_mult Bb[] = {
964 { "B", 1024 }, 964 { "B", 1024 },
965 { "b", 512 }, 965 { "b", 512 },
966 { } 966 { "", 0 }
967 }; 967 };
968 char *p; 968 char *p;
969 int radix; 969 int radix;
@@ -1178,7 +1178,7 @@ int od_main(int argc, char **argv)
1178 { "b", 512 }, 1178 { "b", 512 },
1179 { "k", 1024 }, 1179 { "k", 1024 },
1180 { "m", 1024*1024 }, 1180 { "m", 1024*1024 },
1181 { } 1181 { "", 0 }
1182 }; 1182 };
1183 enum { 1183 enum {
1184 OPT_A = 1 << 0, 1184 OPT_A = 1 << 0,
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index b16d03c2b..399a38dd4 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -29,7 +29,7 @@ static const struct suffix_mult sfx[] = {
29 { "m", 60 }, 29 { "m", 60 },
30 { "h", 60*60 }, 30 { "h", 60*60 },
31 { "d", 24*60*60 }, 31 { "d", 24*60*60 },
32 { } 32 { "", 0 }
33}; 33};
34#endif 34#endif
35 35
diff --git a/coreutils/split.c b/coreutils/split.c
index f1ec64be0..2191f30ea 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -20,7 +20,7 @@ static const struct suffix_mult split_suffices[] = {
20#if ENABLE_FEATURE_SPLIT_FANCY 20#if ENABLE_FEATURE_SPLIT_FANCY
21 { "g", 1024*1024*1024 }, 21 { "g", 1024*1024*1024 },
22#endif 22#endif
23 { } 23 { "", 0 }
24}; 24};
25 25
26/* Increment the suffix part of the filename. 26/* Increment the suffix part of the filename.
diff --git a/coreutils/stty.c b/coreutils/stty.c
index e02fe7c72..baa1ec2da 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -774,7 +774,7 @@ static const struct suffix_mult stty_suffixes[] = {
774 { "b", 512 }, 774 { "b", 512 },
775 { "k", 1024 }, 775 { "k", 1024 },
776 { "B", 1024 }, 776 { "B", 1024 },
777 { } 777 { "", 0 }
778}; 778};
779 779
780static const struct mode_info *find_mode(const char *name) 780static const struct mode_info *find_mode(const char *name)
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 05dadcd9b..0be166315 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -30,7 +30,7 @@ static const struct suffix_mult tail_suffixes[] = {
30 { "b", 512 }, 30 { "b", 512 },
31 { "k", 1024 }, 31 { "k", 1024 },
32 { "m", 1024*1024 }, 32 { "m", 1024*1024 },
33 { } 33 { "", 0 }
34}; 34};
35 35
36struct globals { 36struct globals {
diff --git a/coreutils/uname.c b/coreutils/uname.c
index 8453bcc01..9822e49bd 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -48,8 +48,9 @@
48 * Fix handling of -a to not print "unknown", add -o and -i support. 48 * Fix handling of -a to not print "unknown", add -o and -i support.
49 */ 49 */
50 50
51#include <sys/utsname.h>
52#include "libbb.h" 51#include "libbb.h"
52/* After libbb.h, since it needs sys/types.h on some systems */
53#include <sys/utsname.h>
53 54
54typedef struct { 55typedef struct {
55 struct utsname name; 56 struct utsname name;
diff --git a/findutils/find.c b/findutils/find.c
index 5e8193ffa..ba8fa0854 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -782,7 +782,7 @@ static action*** parse_params(char **argv)
782 { "", 512 }, 782 { "", 512 },
783 { "b", 512 }, 783 { "b", 512 },
784 { "k", 1024 }, 784 { "k", 1024 },
785 { } 785 { "", 0 }
786 }; 786 };
787 action_size *ap; 787 action_size *ap;
788 ap = ALLOC_ACTION(size); 788 ap = ALLOC_ACTION(size);
diff --git a/libbb/kernel_version.c b/libbb/kernel_version.c
index 8b9c4ec20..937d2dbfb 100644
--- a/libbb/kernel_version.c
+++ b/libbb/kernel_version.c
@@ -7,9 +7,10 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */ 8 */
9 9
10#include <sys/utsname.h> /* for uname(2) */
11
12#include "libbb.h" 10#include "libbb.h"
11/* After libbb.h, since it needs sys/types.h on some systems */
12#include <sys/utsname.h> /* for uname(2) */
13
13 14
14/* Returns current kernel version encoded as major*65536 + minor*256 + patch, 15/* Returns current kernel version encoded as major*65536 + minor*256 + patch,
15 * so, for example, to check if the kernel is greater than 2.2.11: 16 * so, for example, to check if the kernel is greater than 2.2.11:
diff --git a/libbb/login.c b/libbb/login.c
index ba9f4d2b5..07247a8c5 100644
--- a/libbb/login.c
+++ b/libbb/login.c
@@ -9,9 +9,9 @@
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
10 */ 10 */
11 11
12#include <sys/param.h> /* MAXHOSTNAMELEN */
13#include <sys/utsname.h>
14#include "libbb.h" 12#include "libbb.h"
13/* After libbb.h, since it needs sys/types.h on some systems */
14#include <sys/utsname.h>
15 15
16#define LOGIN " login: " 16#define LOGIN " login: "
17 17
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
index 85f93b639..a18466935 100644
--- a/libbb/xconnect.c
+++ b/libbb/xconnect.c
@@ -7,6 +7,7 @@
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this tarball for details.
8 */ 8 */
9 9
10#include <sys/socket.h> /* netinet/in.h needs it */
10#include <netinet/in.h> 11#include <netinet/in.h>
11#include <net/if.h> 12#include <net/if.h>
12#include <sys/un.h> 13#include <sys/un.h>
diff --git a/miscutils/dc.c b/miscutils/dc.c
index ff2bc3bce..3656cddc6 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -182,7 +182,7 @@ static const struct op operators[] = {
182 {"p", print_no_pop}, 182 {"p", print_no_pop},
183 {"f", print_stack_no_pop}, 183 {"f", print_stack_no_pop},
184 {"o", set_output_base}, 184 {"o", set_output_base},
185 { /* zero filled */ } 185 { "", NULL }
186}; 186};
187 187
188static void stack_machine(const char *argument) 188static void stack_machine(const char *argument)
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index e334d0189..8e961f0c1 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -33,7 +33,7 @@ int watchdog_main(int argc, char **argv)
33 static const struct suffix_mult suffixes[] = { 33 static const struct suffix_mult suffixes[] = {
34 { "ms", 1 }, 34 { "ms", 1 },
35 { "", 1000 }, 35 { "", 1000 },
36 { } 36 { "", 0 }
37 }; 37 };
38 38
39 unsigned opts; 39 unsigned opts;
diff --git a/modutils/depmod.c b/modutils/depmod.c
index 5ec2a51dd..d6cc8ed59 100644
--- a/modutils/depmod.c
+++ b/modutils/depmod.c
@@ -10,9 +10,9 @@
10 10
11#undef _GNU_SOURCE 11#undef _GNU_SOURCE
12#define _GNU_SOURCE 12#define _GNU_SOURCE
13#include <libbb.h> 13#include "libbb.h"
14#include <sys/utsname.h> /* uname() */
15#include "modutils.h" 14#include "modutils.h"
15#include <sys/utsname.h> /* uname() */
16 16
17/* 17/*
18 * Theory of operation: 18 * Theory of operation:
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index bbd700eb7..02d8fbd40 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
12 12/* After libbb.h, since it needs sys/types.h on some systems */
13#include <sys/utsname.h> /* uname() */ 13#include <sys/utsname.h> /* uname() */
14#include <fnmatch.h> 14#include <fnmatch.h>
15 15
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 7a9709e40..6b9449213 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -17,11 +17,11 @@
17 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 17 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
18 */ 18 */
19 19
20#include "libbb.h"
21/* After libbb.h, since it needs sys/types.h on some systems */
20#include <sys/utsname.h> 22#include <sys/utsname.h>
21#include <fnmatch.h> 23#include <fnmatch.h>
22 24
23#include "libbb.h"
24
25#define MAX_OPT_DEPTH 10 25#define MAX_OPT_DEPTH 10
26#define EUNBALBRACK 10001 26#define EUNBALBRACK 10001
27#define EUNDEFVAR 10002 27#define EUNDEFVAR 10002
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c
index ddb894432..38f99196e 100644
--- a/networking/udhcp/options.c
+++ b/networking/udhcp/options.c
@@ -57,7 +57,7 @@ const struct dhcp_option dhcp_options[] = {
57 * with "option XXX YYY" syntax in dhcpd config file. */ 57 * with "option XXX YYY" syntax in dhcpd config file. */
58 58
59 { OPTION_U16 , 0x39 }, /* DHCP_MAX_SIZE */ 59 { OPTION_U16 , 0x39 }, /* DHCP_MAX_SIZE */
60 { } /* zeroed terminating entry */ 60 { 0, 0 } /* zeroed terminating entry */
61}; 61};
62 62
63/* Used for converting options from incoming packets to env variables 63/* Used for converting options from incoming packets to env variables
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 66a13fbd0..34ceadf72 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -682,7 +682,7 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
682 static const struct suffix_mult km_suffixes[] = { 682 static const struct suffix_mult km_suffixes[] = {
683 { "k", 1024 }, 683 { "k", 1024 },
684 { "m", 1024*1024 }, 684 { "m", 1024*1024 },
685 { } 685 { "", 0 }
686 }; 686 };
687 ld->sizemax = xatou_sfx(&s[1], km_suffixes); 687 ld->sizemax = xatou_sfx(&s[1], km_suffixes);
688 break; 688 break;
@@ -698,7 +698,7 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
698 { "m", 60 }, 698 { "m", 60 },
699 { "h", 60*60 }, 699 { "h", 60*60 },
700 /*{ "d", 24*60*60 },*/ 700 /*{ "d", 24*60*60 },*/
701 { } 701 { "", 0 }
702 }; 702 };
703 ld->rotate_period = xatou_sfx(&s[1], mh_suffixes); 703 ld->rotate_period = xatou_sfx(&s[1], mh_suffixes);
704 if (ld->rotate_period) { 704 if (ld->rotate_period) {
diff --git a/shell/msh_unused.c b/shell/msh_unused.c
index fe85a8170..d4fe3db1b 100644
--- a/shell/msh_unused.c
+++ b/shell/msh_unused.c
@@ -2064,7 +2064,7 @@ static int rlookup(char *n)
2064 { "{" , '{' }, 2064 { "{" , '{' },
2065 { "}" , '}' }, 2065 { "}" , '}' },
2066 { "." , DOT }, 2066 { "." , DOT },
2067 { }, 2067 { "" , 0 },
2068 }; 2068 };
2069 2069
2070 const struct res *rp; 2070 const struct res *rp;
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index 98d1ac2ba..f3878f44f 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -47,7 +47,7 @@ static const struct suffix_mult suffixes[] = {
47 { "b", 512 }, 47 { "b", 512 },
48 { "k", 1024 }, 48 { "k", 1024 },
49 { "m", 1024*1024 }, 49 { "m", 1024*1024 },
50 { } 50 { "", 0 }
51}; 51};
52 52
53int hexdump_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 53int hexdump_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 2cdb186c5..6dff57f09 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -7,8 +7,9 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8*/ 8*/
9 9
10#include <sys/utsname.h>
11#include "libbb.h" 10#include "libbb.h"
11/* After libbb.h, since it needs sys/types.h on some systems */
12#include <sys/utsname.h>
12#include "rtc_.h" 13#include "rtc_.h"
13 14
14#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS 15#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
@@ -67,7 +68,10 @@ static void show_clock(int utc)
67static void to_sys_clock(int utc) 68static void to_sys_clock(int utc)
68{ 69{
69 struct timeval tv; 70 struct timeval tv;
70 const struct timezone tz = { timezone/60 - 60*daylight, 0 }; 71 struct timezone tz;
72
73 tz.tz_minuteswest = timezone/60 - 60*daylight;
74 tz.tz_dsttime = 0;
71 75
72 tv.tv_sec = read_rtc(utc); 76 tv.tv_sec = read_rtc(utc);
73 tv.tv_usec = 0; 77 tv.tv_usec = 0;