X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udevsettle.c;h=9e3e03b1af01a7615af3fdf6dd2545eaf49da5e5;hp=3215b3c5baa259c37da5d8d3c69d2d2151da11ba;hb=53fc01d5073962e94cb32b686c0146b08ea8fef5;hpb=fc8ec932580698a2a4274204029aebb937000c70 diff --git a/udevsettle.c b/udevsettle.c index 3215b3c5b..9e3e03b1a 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -1,6 +1,4 @@ /* - * udevsettle.c - * * Copyright (C) 2006 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ @@ -36,7 +34,6 @@ #define DEFAULT_TIMEOUT 180 #define LOOP_PER_SECOND 20 -static const char *udev_log_str; #ifdef USE_LOG void log_message(int priority, const char *format, ...) @@ -69,28 +66,30 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevsettle"); udev_config_init(); dbg("version %s", UDEV_VERSION); - - udev_log_str = getenv("UDEV_LOG"); + sysfs_init(); for (i = 1 ; i < argc; i++) { char *arg = argv[i]; if (strncmp(arg, "--timeout=", 10) == 0) { char *str = &arg[10]; + int seconds; - timeout = atoi(str); + seconds = atoi(str); + if (seconds > 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); dbg("timeout=%i", timeout); - if (timeout <= 0) { - fprintf(stderr, "Invalid timeout value.\n"); - goto exit; - } - } else { - fprintf(stderr, "Usage: udevsettle [--timeout=]\n"); + } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + printf("Usage: udevsettle [--help] [--timeout=]\n"); goto exit; + } else { + fprintf(stderr, "unrecognized option '%s'\n", arg); + err("unrecognized option '%s'\n", arg); } } - sysfs_init(); strlcpy(queuename, udev_root, sizeof(queuename)); strlcat(queuename, "/" EVENT_QUEUE_DIR, sizeof(queuename));