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>
This commit is contained in:
parent
5370bfb123
commit
043b1e5d99
@ -111,7 +111,10 @@ static void cut_file(FILE *file, char delim, const struct cut_list *cut_lists, u
|
|||||||
int ndelim = -1; /* zero-based / one-based problem */
|
int ndelim = -1; /* zero-based / one-based problem */
|
||||||
int nfields_printed = 0;
|
int nfields_printed = 0;
|
||||||
char *field = NULL;
|
char *field = NULL;
|
||||||
const char delimiter[2] = { delim, 0 };
|
char delimiter[2];
|
||||||
|
|
||||||
|
delimiter[0] = delim;
|
||||||
|
delimiter[1] = 0;
|
||||||
|
|
||||||
/* does this line contain any delimiters? */
|
/* does this line contain any delimiters? */
|
||||||
if (strchr(line, delim) == NULL) {
|
if (strchr(line, delim) == NULL) {
|
||||||
|
@ -29,7 +29,7 @@ static const struct suffix_mult dd_suffixes[] = {
|
|||||||
{ "M", 1048576 },
|
{ "M", 1048576 },
|
||||||
{ "GD", 1000000000 },
|
{ "GD", 1000000000 },
|
||||||
{ "G", 1073741824 },
|
{ "G", 1073741824 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct globals {
|
struct globals {
|
||||||
|
@ -214,9 +214,9 @@ static arith_t arithmetic_common(VALUE *l, VALUE *r, int op)
|
|||||||
|
|
||||||
static VALUE *docolon(VALUE *sv, VALUE *pv)
|
static VALUE *docolon(VALUE *sv, VALUE *pv)
|
||||||
{
|
{
|
||||||
|
enum { NMATCH = 2 };
|
||||||
VALUE *v;
|
VALUE *v;
|
||||||
regex_t re_buffer;
|
regex_t re_buffer;
|
||||||
const int NMATCH = 2;
|
|
||||||
regmatch_t re_regs[NMATCH];
|
regmatch_t re_regs[NMATCH];
|
||||||
|
|
||||||
tostring(sv);
|
tostring(sv);
|
||||||
|
@ -25,7 +25,7 @@ static const struct suffix_mult head_suffixes[] = {
|
|||||||
{ "b", 512 },
|
{ "b", 512 },
|
||||||
{ "k", 1024 },
|
{ "k", 1024 },
|
||||||
{ "m", 1024*1024 },
|
{ "m", 1024*1024 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -963,7 +963,7 @@ parse_old_offset(const char *s, off_t *offset)
|
|||||||
static const struct suffix_mult Bb[] = {
|
static const struct suffix_mult Bb[] = {
|
||||||
{ "B", 1024 },
|
{ "B", 1024 },
|
||||||
{ "b", 512 },
|
{ "b", 512 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
char *p;
|
char *p;
|
||||||
int radix;
|
int radix;
|
||||||
@ -1178,7 +1178,7 @@ int od_main(int argc, char **argv)
|
|||||||
{ "b", 512 },
|
{ "b", 512 },
|
||||||
{ "k", 1024 },
|
{ "k", 1024 },
|
||||||
{ "m", 1024*1024 },
|
{ "m", 1024*1024 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
OPT_A = 1 << 0,
|
OPT_A = 1 << 0,
|
||||||
|
@ -29,7 +29,7 @@ static const struct suffix_mult sfx[] = {
|
|||||||
{ "m", 60 },
|
{ "m", 60 },
|
||||||
{ "h", 60*60 },
|
{ "h", 60*60 },
|
||||||
{ "d", 24*60*60 },
|
{ "d", 24*60*60 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ static const struct suffix_mult split_suffices[] = {
|
|||||||
#if ENABLE_FEATURE_SPLIT_FANCY
|
#if ENABLE_FEATURE_SPLIT_FANCY
|
||||||
{ "g", 1024*1024*1024 },
|
{ "g", 1024*1024*1024 },
|
||||||
#endif
|
#endif
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Increment the suffix part of the filename.
|
/* Increment the suffix part of the filename.
|
||||||
|
@ -774,7 +774,7 @@ static const struct suffix_mult stty_suffixes[] = {
|
|||||||
{ "b", 512 },
|
{ "b", 512 },
|
||||||
{ "k", 1024 },
|
{ "k", 1024 },
|
||||||
{ "B", 1024 },
|
{ "B", 1024 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct mode_info *find_mode(const char *name)
|
static const struct mode_info *find_mode(const char *name)
|
||||||
|
@ -30,7 +30,7 @@ static const struct suffix_mult tail_suffixes[] = {
|
|||||||
{ "b", 512 },
|
{ "b", 512 },
|
||||||
{ "k", 1024 },
|
{ "k", 1024 },
|
||||||
{ "m", 1024*1024 },
|
{ "m", 1024*1024 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct globals {
|
struct globals {
|
||||||
|
@ -48,8 +48,9 @@
|
|||||||
* Fix handling of -a to not print "unknown", add -o and -i support.
|
* Fix handling of -a to not print "unknown", add -o and -i support.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
/* After libbb.h, since it needs sys/types.h on some systems */
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
|
@ -782,7 +782,7 @@ static action*** parse_params(char **argv)
|
|||||||
{ "", 512 },
|
{ "", 512 },
|
||||||
{ "b", 512 },
|
{ "b", 512 },
|
||||||
{ "k", 1024 },
|
{ "k", 1024 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
action_size *ap;
|
action_size *ap;
|
||||||
ap = ALLOC_ACTION(size);
|
ap = ALLOC_ACTION(size);
|
||||||
|
@ -7,9 +7,10 @@
|
|||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/utsname.h> /* for uname(2) */
|
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
/* After libbb.h, since it needs sys/types.h on some systems */
|
||||||
|
#include <sys/utsname.h> /* for uname(2) */
|
||||||
|
|
||||||
|
|
||||||
/* Returns current kernel version encoded as major*65536 + minor*256 + patch,
|
/* Returns current kernel version encoded as major*65536 + minor*256 + patch,
|
||||||
* so, for example, to check if the kernel is greater than 2.2.11:
|
* so, for example, to check if the kernel is greater than 2.2.11:
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h> /* MAXHOSTNAMELEN */
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
/* After libbb.h, since it needs sys/types.h on some systems */
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
#define LOGIN " login: "
|
#define LOGIN " login: "
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* Licensed under GPLv2, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/socket.h> /* netinet/in.h needs it */
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
|
@ -182,7 +182,7 @@ static const struct op operators[] = {
|
|||||||
{"p", print_no_pop},
|
{"p", print_no_pop},
|
||||||
{"f", print_stack_no_pop},
|
{"f", print_stack_no_pop},
|
||||||
{"o", set_output_base},
|
{"o", set_output_base},
|
||||||
{ /* zero filled */ }
|
{ "", NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void stack_machine(const char *argument)
|
static void stack_machine(const char *argument)
|
||||||
|
@ -33,7 +33,7 @@ int watchdog_main(int argc, char **argv)
|
|||||||
static const struct suffix_mult suffixes[] = {
|
static const struct suffix_mult suffixes[] = {
|
||||||
{ "ms", 1 },
|
{ "ms", 1 },
|
||||||
{ "", 1000 },
|
{ "", 1000 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned opts;
|
unsigned opts;
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
#undef _GNU_SOURCE
|
#undef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <libbb.h>
|
#include "libbb.h"
|
||||||
#include <sys/utsname.h> /* uname() */
|
|
||||||
#include "modutils.h"
|
#include "modutils.h"
|
||||||
|
#include <sys/utsname.h> /* uname() */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Theory of operation:
|
* Theory of operation:
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
/* After libbb.h, since it needs sys/types.h on some systems */
|
||||||
#include <sys/utsname.h> /* uname() */
|
#include <sys/utsname.h> /* uname() */
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
|
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
|
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libbb.h"
|
||||||
|
/* After libbb.h, since it needs sys/types.h on some systems */
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
|
|
||||||
#include "libbb.h"
|
|
||||||
|
|
||||||
#define MAX_OPT_DEPTH 10
|
#define MAX_OPT_DEPTH 10
|
||||||
#define EUNBALBRACK 10001
|
#define EUNBALBRACK 10001
|
||||||
#define EUNDEFVAR 10002
|
#define EUNDEFVAR 10002
|
||||||
|
@ -57,7 +57,7 @@ const struct dhcp_option dhcp_options[] = {
|
|||||||
* with "option XXX YYY" syntax in dhcpd config file. */
|
* with "option XXX YYY" syntax in dhcpd config file. */
|
||||||
|
|
||||||
{ OPTION_U16 , 0x39 }, /* DHCP_MAX_SIZE */
|
{ OPTION_U16 , 0x39 }, /* DHCP_MAX_SIZE */
|
||||||
{ } /* zeroed terminating entry */
|
{ 0, 0 } /* zeroed terminating entry */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Used for converting options from incoming packets to env variables
|
/* Used for converting options from incoming packets to env variables
|
||||||
|
@ -682,7 +682,7 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
|
|||||||
static const struct suffix_mult km_suffixes[] = {
|
static const struct suffix_mult km_suffixes[] = {
|
||||||
{ "k", 1024 },
|
{ "k", 1024 },
|
||||||
{ "m", 1024*1024 },
|
{ "m", 1024*1024 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
ld->sizemax = xatou_sfx(&s[1], km_suffixes);
|
ld->sizemax = xatou_sfx(&s[1], km_suffixes);
|
||||||
break;
|
break;
|
||||||
@ -698,7 +698,7 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
|
|||||||
{ "m", 60 },
|
{ "m", 60 },
|
||||||
{ "h", 60*60 },
|
{ "h", 60*60 },
|
||||||
/*{ "d", 24*60*60 },*/
|
/*{ "d", 24*60*60 },*/
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
ld->rotate_period = xatou_sfx(&s[1], mh_suffixes);
|
ld->rotate_period = xatou_sfx(&s[1], mh_suffixes);
|
||||||
if (ld->rotate_period) {
|
if (ld->rotate_period) {
|
||||||
|
@ -2064,7 +2064,7 @@ static int rlookup(char *n)
|
|||||||
{ "{" , '{' },
|
{ "{" , '{' },
|
||||||
{ "}" , '}' },
|
{ "}" , '}' },
|
||||||
{ "." , DOT },
|
{ "." , DOT },
|
||||||
{ },
|
{ "" , 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct res *rp;
|
const struct res *rp;
|
||||||
|
@ -47,7 +47,7 @@ static const struct suffix_mult suffixes[] = {
|
|||||||
{ "b", 512 },
|
{ "b", 512 },
|
||||||
{ "k", 1024 },
|
{ "k", 1024 },
|
||||||
{ "m", 1024*1024 },
|
{ "m", 1024*1024 },
|
||||||
{ }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
int hexdump_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int hexdump_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
|
@ -7,8 +7,9 @@
|
|||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
/* After libbb.h, since it needs sys/types.h on some systems */
|
||||||
|
#include <sys/utsname.h>
|
||||||
#include "rtc_.h"
|
#include "rtc_.h"
|
||||||
|
|
||||||
#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
|
#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
|
||||||
@ -67,7 +68,10 @@ static void show_clock(int utc)
|
|||||||
static void to_sys_clock(int utc)
|
static void to_sys_clock(int utc)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
const struct timezone tz = { timezone/60 - 60*daylight, 0 };
|
struct timezone tz;
|
||||||
|
|
||||||
|
tz.tz_minuteswest = timezone/60 - 60*daylight;
|
||||||
|
tz.tz_dsttime = 0;
|
||||||
|
|
||||||
tv.tv_sec = read_rtc(utc);
|
tv.tv_sec = read_rtc(utc);
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user