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:
Denys Vlasenko
2009-09-06 12:47:55 +02:00
parent 5370bfb123
commit 043b1e5d99
24 changed files with 40 additions and 30 deletions

View File

@@ -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 nfields_printed = 0;
char *field = NULL;
const char delimiter[2] = { delim, 0 };
char delimiter[2];
delimiter[0] = delim;
delimiter[1] = 0;
/* does this line contain any delimiters? */
if (strchr(line, delim) == NULL) {

View File

@@ -29,7 +29,7 @@ static const struct suffix_mult dd_suffixes[] = {
{ "M", 1048576 },
{ "GD", 1000000000 },
{ "G", 1073741824 },
{ }
{ "", 0 }
};
struct globals {

View File

@@ -214,9 +214,9 @@ static arith_t arithmetic_common(VALUE *l, VALUE *r, int op)
static VALUE *docolon(VALUE *sv, VALUE *pv)
{
enum { NMATCH = 2 };
VALUE *v;
regex_t re_buffer;
const int NMATCH = 2;
regmatch_t re_regs[NMATCH];
tostring(sv);

View File

@@ -25,7 +25,7 @@ static const struct suffix_mult head_suffixes[] = {
{ "b", 512 },
{ "k", 1024 },
{ "m", 1024*1024 },
{ }
{ "", 0 }
};
#endif

View File

@@ -963,7 +963,7 @@ parse_old_offset(const char *s, off_t *offset)
static const struct suffix_mult Bb[] = {
{ "B", 1024 },
{ "b", 512 },
{ }
{ "", 0 }
};
char *p;
int radix;
@@ -1178,7 +1178,7 @@ int od_main(int argc, char **argv)
{ "b", 512 },
{ "k", 1024 },
{ "m", 1024*1024 },
{ }
{ "", 0 }
};
enum {
OPT_A = 1 << 0,

View File

@@ -29,7 +29,7 @@ static const struct suffix_mult sfx[] = {
{ "m", 60 },
{ "h", 60*60 },
{ "d", 24*60*60 },
{ }
{ "", 0 }
};
#endif

View File

@@ -20,7 +20,7 @@ static const struct suffix_mult split_suffices[] = {
#if ENABLE_FEATURE_SPLIT_FANCY
{ "g", 1024*1024*1024 },
#endif
{ }
{ "", 0 }
};
/* Increment the suffix part of the filename.

View File

@@ -774,7 +774,7 @@ static const struct suffix_mult stty_suffixes[] = {
{ "b", 512 },
{ "k", 1024 },
{ "B", 1024 },
{ }
{ "", 0 }
};
static const struct mode_info *find_mode(const char *name)

View File

@@ -30,7 +30,7 @@ static const struct suffix_mult tail_suffixes[] = {
{ "b", 512 },
{ "k", 1024 },
{ "m", 1024*1024 },
{ }
{ "", 0 }
};
struct globals {

View File

@@ -48,8 +48,9 @@
* Fix handling of -a to not print "unknown", add -o and -i support.
*/
#include <sys/utsname.h>
#include "libbb.h"
/* After libbb.h, since it needs sys/types.h on some systems */
#include <sys/utsname.h>
typedef struct {
struct utsname name;