diff --git a/prog/sensord/args.c b/prog/sensord/args.c index 3d3b1562..b9b7793a 100644 --- a/prog/sensord/args.c +++ b/prog/sensord/args.c @@ -51,257 +51,271 @@ int debug = 0; sensors_chip_name chipNames[MAX_CHIP_NAMES]; int numChipNames = 0; -static int -parseTime -(char *arg) { - char *end; - int value = strtoul (arg, &end, 10); - if ((end > arg) && (*end == 's')) { - ++ end; - } else if ((end > arg) && (*end == 'm')) { - value *= 60; - ++ end; - } else if ((end > arg) && (*end == 'h')) { - value *= 60 * 60; - ++ end; - } - if ((end == arg) || *end) { - fprintf (stderr, "Error parsing time value `%s'.\n", arg); - return -1; - } - return value; +static int parseTime(char *arg) +{ + char *end; + int value = strtoul(arg, &end, 10); + if ((end > arg) && (*end == 's')) { + ++ end; + } else if ((end > arg) && (*end == 'm')) { + value *= 60; + ++ end; + } else if ((end > arg) && (*end == 'h')) { + value *= 60 * 60; + ++ end; + } + if ((end == arg) || *end) { + fprintf(stderr, "Error parsing time value `%s'.\n", arg); + return -1; + } + return value; } static struct { - const char *name; - int id; + const char *name; + int id; } facilities[] = { - { "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, - { "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, - { "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, - { "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, - { "daemon", LOG_DAEMON }, { "user", LOG_USER }, - { NULL, 0 } + { "local0", LOG_LOCAL0 }, + { "local1", LOG_LOCAL1 }, + { "local2", LOG_LOCAL2 }, + { "local3", LOG_LOCAL3 }, + { "local4", LOG_LOCAL4 }, + { "local5", LOG_LOCAL5 }, + { "local6", LOG_LOCAL6 }, + { "local7", LOG_LOCAL7 }, + { "daemon", LOG_DAEMON }, + { "user", LOG_USER }, + { NULL, 0 } }; -static int -parseFacility -(char *arg) { - int i = 0; - while (facilities[i].name && strcasecmp (arg, facilities[i].name)) - ++ i; - if (!facilities[i].name) { - fprintf (stderr, "Error parsing facility value `%s'.\n", arg); - return -1; - } - return facilities[i].id; +static int parseFacility(char *arg) +{ + int i = 0; + while (facilities[i].name && strcasecmp(arg, facilities[i].name)) + ++ i; + if (!facilities[i].name) { + fprintf(stderr, "Error parsing facility value `%s'.\n", arg); + return -1; + } + return facilities[i].id; } static const char *daemonSyntax = - " -i, --interval