]>
Commit | Line | Data |
---|---|---|
4ebee360 | 1 | diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c |
2 | --- chkconfig-1.2.24h.orig/chkconfig.c Wed Jul 17 20:10:55 2002 | |
3 | +++ chkconfig-1.2.24h/chkconfig.c Wed Jan 22 11:56:32 2003 | |
4 | @@ -31,6 +31,7 @@ | |
5 | #include <sys/stat.h> | |
d8fc60be | 6 | #include <unistd.h> |
d8fc60be | 7 | static char *progname; |
8 | +extern int addItem; | |
4ebee360 | 9 | struct config conf; // used by leveldb.c |
d8fc60be | 10 | |
11 | #define _(String) gettext((String)) | |
4ebee360 | 12 | @@ -94,12 +95,10 @@ |
3d7305a2 AF |
13 | if (s.type == TYPE_XINETD) return 0; |
14 | ||
4ebee360 | 15 | for (i = 0; i <= conf.maxlevel; i++) { |
d8fc60be | 16 | - if (!isConfigured(name, i)) { |
17 | if ((1 << i) & s.levels) | |
18 | doSetService(s, i, 1); | |
19 | else | |
20 | doSetService(s, i, 0); | |
21 | - } | |
22 | } | |
23 | ||
24 | return 0; | |
023a4aaa JB |
25 | @@ -275,7 +274,7 @@ |
26 | ||
27 | ||
28 | int main(int argc, char ** argv) { | |
29 | - int listItem = 0, addItem = 0, delItem = 0; | |
30 | + int listItem = 0, delItem = 0; | |
31 | int rc, i, x; | |
32 | char * levels = NULL; | |
33 | int help=0, version=0; | |
4ebee360 | 34 | diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c |
35 | --- chkconfig-1.2.24h.orig/leveldb.c Fri Apr 19 03:15:55 2002 | |
36 | +++ chkconfig-1.2.24h/leveldb.c Wed Jan 22 12:04:47 2003 | |
d8fc60be | 37 | @@ -11,6 +11,10 @@ |
38 | #include <stdio.h> | |
39 | #include <string.h> | |
40 | #include <unistd.h> | |
41 | +#include <sys/types.h> | |
42 | +#include <dirent.h> | |
43 | + | |
44 | +int addItem = 0; | |
45 | ||
46 | /* Changes | |
4ebee360 | 47 | 2001-12-03 - Petter Reinholdtsen <pere@hungry.com> |
48 | @@ -231,6 +235,9 @@ | |
3d7305a2 AF |
49 | char overflow; |
50 | char levelbuf[20]; | |
51 | char * english_desc = NULL; | |
d8fc60be | 52 | + DIR *dir; |
53 | + struct dirent *dirent; | |
3d7305a2 | 54 | + int i; |
d8fc60be | 55 | |
4ebee360 | 56 | sprintf(filename, "%s/%s", conf.initdir, name); |
d8fc60be | 57 | |
4ebee360 | 58 | @@ -345,6 +352,21 @@ |
d8fc60be | 59 | |
60 | serv.name = strdup(name); | |
4ebee360 | 61 | |
d8fc60be | 62 | + if (addItem) { |
4ebee360 | 63 | + strcpy(levelbuf,"/etc/rc.d/rc0.d"); |
64 | + for(i=0;i<7;i++,levelbuf[12]++) { | |
65 | + dir=opendir(levelbuf); | |
66 | + if (!dir) return 1; | |
67 | + while ((dirent=readdir(dir))) { | |
68 | + if (strlen(dirent->d_name)<4) continue; | |
69 | + if (strcmp(dirent->d_name+3,name)) continue; | |
70 | + if (*dirent->d_name=='K') serv.levels &= ~(1<<i); | |
71 | + else if (*dirent->d_name=='S') serv.levels |= 1<<i; | |
72 | + } | |
73 | + closedir(dir); | |
d8fc60be | 74 | + } |
d8fc60be | 75 | + } |
4ebee360 | 76 | + |
d8fc60be | 77 | *service = serv; |
78 | return 0; | |
4ebee360 | 79 | } |