]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - ibod/patches/ibod-1.4-configuration-cli.patch
Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-3.x
[people/ms/ipfire-3.x.git] / ibod / patches / ibod-1.4-configuration-cli.patch
CommitLineData
b912ff3d
SS
1Author: Michael Tremer <michael.tremer@ipfire.org>
2
3diff -Nur ibod-1.4/ibod.c ibod-1.4-conf/ibod.c
4--- ibod-1.4/ibod.c 2000-04-11 05:34:17.000000000 +0000
5+++ ibod-1.4-conf/ibod.c 2011-11-11 18:50:45.510054466 +0000
6@@ -23,7 +23,7 @@
7 static void get_if_state();
8 static int bring_up_slave();
9 static int bring_down_slave();
10-static char *home;
11+static char *config_file;
12 static Conf cf;
13 static struct timeval timeout, tv_last, tv_up;
14 static int usageflags[ISDN_MAX_CHANNELS];
15@@ -48,12 +48,16 @@
16
17 channels_last = -1;
18
19+
20 /* Find out where to look for configuration file */
21- if ((home = getenv("IBOD_HOME")) == NULL)
22- home = IBOD_DEFAULT_DIR;
23+ if (argc > 1) {
24+ config_file = argv[1];
25+ } else {
26+ config_file = IBOD_DEFAULT_CONF;
27+ }
28
29 /* Setup initial attributes */
30- if (setattr(home) == -1) {
31+ if (setattr(config_file) == -1) {
32 closelog();
33 exit(1);
34 }
35@@ -185,10 +189,9 @@
36 }
37
38
39-static int setattr(char *home)
40+static int setattr(char *config_filename)
41 {
42 FILE *fd;
43- char config_filename[MAX_STR_LEN];
44 char linebuf[MAX_STR_LEN];
45 char *key, *value;
46 int val;
47@@ -202,7 +205,6 @@
48 cf.stayup_time = STAYUP_TIME;
49
50 /* Open config file */
51- sprintf(config_filename, "%s/ibod.cf", home);
52 if ((fd = fopen(config_filename, "r")) == NULL) {
53 syslog(LOG_ERR, "%s: %s\n", config_filename, strerror(errno));
54 return -1;
55@@ -288,7 +290,7 @@
56
57 static void reread(int sig)
58 {
59- (void) setattr(home);
60+ (void) setattr(config_file);
61
62 setinterval();
63
64diff -Nur ibod-1.4/ibod.h ibod-1.4-conf/ibod.h
65--- ibod-1.4/ibod.h 2011-11-11 19:00:45.623454321 +0000
66+++ ibod-1.4-conf/ibod.h 2011-11-11 18:45:39.703353901 +0000
67@@ -11,6 +11,7 @@
68 #define STAYUP_TIME 30
69
70 #define IBOD_DEFAULT_DIR "/etc/isdn"
71+#define IBOD_DEFAULT_CONF IBOD_DEFAULT_DIR "/ibod.cf"
72 #define MAX_STR_LEN 512
73 #define ISDN_INFO_DEV "/dev/isdninfo"
74 #define ISDN_CTLR_DEV "/dev/isdnctrl"