]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Allow version to be returned over the control interface.
authorRoy Marples <roy@marples.name>
Mon, 5 Jan 2009 08:20:53 +0000 (08:20 +0000)
committerRoy Marples <roy@marples.name>
Mon, 5 Jan 2009 08:20:53 +0000 (08:20 +0000)
control.c
dhcpcd.c
dhcpcd.h

index 9ea2a55d8162db63ac94caceabad9010afa73818..185638ff5f777c878e9586b69b2ea4447f251ad4 100644 (file)
--- a/control.c
+++ b/control.c
@@ -1,6 +1,6 @@
 /* 
  * dhcpcd - DHCP client daemon
- * Copyright 2006-2008 Roy Marples <roy@marples.name>
+ * Copyright 2006-2009 Roy Marples <roy@marples.name>
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -84,7 +84,7 @@ handle_control_data(void *arg)
                        *ap++ = p;
                        p += strlen(p) + 1;
                }
-               handle_args(argc, argvp);
+               handle_args(*s, argc, argvp);
        }
 }
 
index aa2a6020359bdf2dd7e11336f8c048a199c8ef5a..7ef6ae5b9b860a92e9c9ef3406b8b5273567005d 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1098,11 +1098,18 @@ handle_signal(_unused void *arg)
 }
 
 int
-handle_args(int argc, char **argv)
+handle_args(int fd, int argc, char **argv)
 {
        struct interface *ifs, *ifp, *ifl, *ifn, *ift;
        int do_exit = 0, do_release = 0, do_reboot = 0, opt, oi = 0;
 
+       if (strcmp(*argv, "--version") == 0) {
+               if (fd != -1) {
+                       write(fd, VERSION, strlen(VERSION));
+                       return 0;
+               }
+       }
+
        optind = 0;
        while ((opt = getopt_long(argc, argv, IF_OPTS, cf_options, &oi)) != -1)
        {
index 0bcb280da9df39b1fc24fcd45ae68431086d6764..21a3f4c20b95caa63ab1de0aa7c29cd84c825660 100644 (file)
--- a/dhcpcd.h
+++ b/dhcpcd.h
@@ -113,7 +113,7 @@ extern int ifdc;
 extern char **ifdv;
 extern struct interface *ifaces;
 
-int handle_args(int, char **);
+int handle_args(int, int, char **);
 void handle_exit_timeout(void *);
 void start_interface(void *);
 void start_discover(void *);