if (!isofmt_arg) {
ifmt = 0; /* default is date */
} else {
- const char * const isoformats[] =
- {"date", "hours", "minutes", "seconds"};
+ static const char * const isoformats[] =
+ { "date", "hours", "minutes", "seconds" };
for (ifmt = 0; ifmt < 4; ifmt++)
- if (!strcmp(isofmt_arg, isoformats[ifmt])) {
- break;
- }
- if (ifmt == 4) /* parse error */
- bb_show_usage();
+ if (!strcmp(isofmt_arg, isoformats[ifmt]))
+ goto found;
+ /* parse error */
+ bb_show_usage();
+ found: ;
}
}
date_fmt[i++] = '%';
date_fmt[i++] = 'S';
}
-format_utc:
+ format_utc:
date_fmt[i++] = '%';
date_fmt[i] = (opt & DATE_OPT_UTC) ? 'Z' : 'z';
}
trunc_flag = 1 << 2,
twobufs_flag = 1 << 3,
};
- const char * const keywords[] = {
+ static const char * const keywords[] = {
"bs=", "count=", "seek=", "skip=", "if=", "of=",
#if ENABLE_FEATURE_DD_IBS_OBS
"ibs=", "obs=", "conv=", "notrunc", "sync", "noerror",
static VALUE *eval6(void)
{
VALUE *l, *r, *v = NULL /* silence gcc */, *i1, *i2;
- const char * const keywords[] = {
+ static const char * const keywords[] = {
"quote", "length", "match", "index", "substr", NULL
};
static char const *human_fstype(long f_type)
{
int i;
- const struct types {
+ static const struct types {
long type;
const char * const fs;
} humantypes[] = {
{ 0x62656572, "sysfs" },
{ 0, "UNKNOWN" }
};
- for (i=0; humantypes[i].type; ++i)
+ for (i = 0; humantypes[i].type; ++i)
if (humantypes[i].type == f_type)
break;
return humantypes[i].fs;
}
-#ifdef CONFIG_FEATURE_STAT_FORMAT
+#if ENABLE_FEATURE_STAT_FORMAT
/* print statfs info */
static void print_statfs(char *pformat, const size_t buf_len, const char m,
const char * const filename, void const *data
return 0;
}
-#ifdef CONFIG_FEATURE_STAT_FORMAT
+#if ENABLE_FEATURE_STAT_FORMAT
if (format == NULL)
-#ifndef ENABLE_SELINUX
+#if !ENABLE_SELINUX
format = (option_mask32 & OPT_TERSE
? "%n %i %l %t %s %b %f %a %c %d\n"
: " File: \"%n\"\n"
return 0;
}
-#ifdef CONFIG_FEATURE_STAT_FORMAT
+#if ENABLE_FEATURE_STAT_FORMAT
if (format == NULL) {
-#ifndef ENABLE_SELINUX
+#if !ENABLE_SELINUX
if (option_mask32 & OPT_TERSE) {
format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o";
} else {
/* Return a string that is the printable representation of character CH */
/* Adapted from 'cat' by Torbjorn Granlund */
-static const char *visible(unsigned int ch)
+static const char *visible(unsigned ch)
{
char *bpout = G.buf;
static int find_param(const char * const name)
{
- const char * const params[] = {
+ static const char * const params[] = {
"line",
"rows",
"cols",
"columns",
- "size",
- "speed",
+ "size", /* 4 */
+ "speed", /* 5 */
"ispeed",
"ospeed",
NULL
};
- smalluint i = index_in_str_array(params, name) + 1;
+ int i = index_in_str_array(params, name) + 1;
if (i == 0)
return 0;
if (!(i == 4 || i == 5))
static int recover_mode(const char *arg, struct termios *mode)
{
int i, n;
- unsigned int chr;
+ unsigned chr;
unsigned long iflag, oflag, cflag, lflag;
/* Scan into temporaries since it is too much trouble to figure out
}
static void display_recoverable(const struct termios *mode,
- const int ATTRIBUTE_UNUSED dummy)
+ int ATTRIBUTE_UNUSED dummy)
{
int i;
printf("%lx:%lx:%lx:%lx",
goto invalid_argument;
}
}
-end_option:
+ end_option:
continue;
}
default:
if (recover_mode(arg, &mode) == 1) break;
if (tty_value_to_baud(xatou(arg)) != (speed_t) -1) break;
-invalid_argument:
+ invalid_argument:
bb_error_msg_and_die("invalid argument '%s'", arg);
}
stty_state &= ~STTY_noargs;
unsigned i; /* XXX: FIXME: use unsigned char? */
unsigned char ac;
#define CLO ":]"
- const char * const classes[] = {
+ static const char * const classes[] = {
"alpha"CLO, "alnum"CLO, "digit"CLO, "lower"CLO, "upper"CLO, "space"CLO,
"blank"CLO, "punct"CLO, "cntrl"CLO, NULL
};
{
static char buf[16];
+//try this:
+//if (tok < TSEMI) return tokname_array[tok] + 1;
+//sprintf(buf, "\"%s\"", tokname_array[tok] + 1);
+//return buf;
+
if (tok >= TSEMI)
buf[0] = '"';
sprintf(buf + (tok >= TSEMI), "%s%c",
static int
pstrcmp(const void *a, const void *b)
{
- return strcmp((const char *) a, (*(const char *const *) b) + 1);
+ return strcmp((char*) a, (*(char**) b) + 1);
}
static const char *const *
findkwd(const char *s)
{
return bsearch(s, tokname_array + KWDOFFSET,
- (sizeof(tokname_array) / sizeof(const char *)) - KWDOFFSET,
- sizeof(const char *), pstrcmp);
+ (sizeof(tokname_array) / sizeof(char *)) - KWDOFFSET,
+ sizeof(char *), pstrcmp);
}
/*
static int expand_arguments(char *command)
{
+ static const char out_of_space[] = "out of space during expansion";
+
int total_length = 0, length, i, retval, ix = 0;
expand_t expand_result;
char *tmpcmd, *cmd, *cmd_copy;
char *src, *dst, *var;
- const char * const out_of_space = "out of space during expansion";
int flags = GLOB_NOCHECK
#ifdef GLOB_BRACE
| GLOB_BRACE
if (id < 0) {
const char *errmsg;
- const char *const what = "key";
error++;
switch (errno) {
errmsg = "unknown error in";
break;
}
- bb_error_msg("%s %s (%s)", errmsg, what, optarg);
+ bb_error_msg("%s %s (%s)", errmsg, "key", optarg);
continue;
}
} else {
for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) {
char *opteq = strchr(opt, '=');
if (opteq) {
- const char *const options[] = {
+ static const char *const options[] = {
/* 0 */ "rsize",
/* 1 */ "wsize",
/* 2 */ "timeo",
}
}
else {
- const char *const options[] = {
+ static const char *const options[] = {
"bg",
"fg",
"soft",