chiark / gitweb /
[PATCH] add -V option to udev to print the version number
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Sun, 12 Dec 2004 01:27:50 +0000 (02:27 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:13:47 +0000 (23:13 -0700)
On Sat, 2004-12-11 at 18:44 +0200, Martin Schlemmer [c] wrote:
>
> Any suggestions to determining the version of the installed udev?
> This is now during startup, to see if we can make use of using
> udevsend as hotplug agent.  If the system was up, udevinfo could
> be used, but that is in /usr/bin that might be on a seperate /usr.
> I know we might move udevinfo to /bin, but that might be an issue
> for some, and adding a -V switch to /sbin/udev might be a better
> choice.

udev.c

diff --git a/udev.c b/udev.c
index 507f2be943a88e9142bc802f0f4da0ac95e53aa6..b1ba1435e7236926e905e7f20959058954b906fe 100644 (file)
--- a/udev.c
+++ b/udev.c
@@ -107,8 +107,14 @@ int main(int argc, char *argv[], char *envp[])
        const char *devpath = getenv("DEVPATH");
        const char *subsystem = argv[1];
 
        const char *devpath = getenv("DEVPATH");
        const char *subsystem = argv[1];
 
-       dbg("version %s", UDEV_VERSION);
+       if (argc == 2 && strcmp(argv[1], "-V") == 0) {
+               printf("%s\n", UDEV_VERSION);
+               exit(0);
+       }
+
        logging_init("udev");
        logging_init("udev");
+       dbg("version %s", UDEV_VERSION);
+
        udev_init_config();
 
        /* set signal handlers */
        udev_init_config();
 
        /* set signal handlers */