Allow version to be returned over the control interface.

This commit is contained in:
Roy Marples 2009-01-05 08:20:53 +00:00
parent fcdf05ed93
commit f367dc38be
3 changed files with 11 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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)
{

View File

@ -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 *);