]>
Commit | Line | Data |
---|---|---|
5b309978 JB |
1 | diff -Nur chkconfig-1.2.22.orig/chkconfig.c chkconfig-1.2.22/chkconfig.c |
2 | --- chkconfig-1.2.22.orig/chkconfig.c Sat Dec 30 05:25:26 2000 | |
3 | +++ chkconfig-1.2.22/chkconfig.c Thu Apr 5 23:39:20 2001 | |
d8fc60be | 4 | @@ -12,6 +12,7 @@ |
5 | #include <unistd.h> | |
6 | ||
7 | static char *progname; | |
8 | +extern int addItem; | |
9 | ||
10 | #define _(String) gettext((String)) | |
11 | ||
5b309978 | 12 | @@ -74,12 +75,10 @@ |
3d7305a2 AF |
13 | if (s.type == TYPE_XINETD) return 0; |
14 | ||
d8fc60be | 15 | for (i = 0; i < 7; i++) { |
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; | |
5b309978 JB |
25 | @@ -246,7 +245,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; | |
34 | diff -Nur chkconfig-1.2.22.orig/leveldb.c chkconfig-1.2.22/leveldb.c | |
35 | --- chkconfig-1.2.22.orig/leveldb.c Fri Feb 2 18:51:01 2001 | |
36 | +++ chkconfig-1.2.22/leveldb.c Thu Apr 5 23:39:01 2001 | |
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 | |
47 | 1998-09-22 - Arnaldo Carvalho de Melo <acme@conectiva.com.br> | |
3d7305a2 AF |
48 | @@ -225,6 +229,9 @@ |
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 | |
56 | sprintf(filename, RUNLEVELS "/init.d/%s", name); | |
57 | ||
5b309978 | 58 | @@ -316,6 +323,21 @@ |
d8fc60be | 59 | } |
60 | ||
61 | serv.name = strdup(name); | |
62 | + | |
63 | + if (addItem) { | |
64 | + strcpy(levelbuf,"/etc/rc.d/rc0.d"); | |
65 | + for(i=0;i<7;i++,levelbuf[12]++) { | |
66 | + dir=opendir(levelbuf); | |
67 | + if (!dir) return 1; | |
68 | + while ((dirent=readdir(dir))) { | |
69 | + if (strlen(dirent->d_name)<4) continue; | |
70 | + if (strcmp(dirent->d_name+3,name)) continue; | |
71 | + if (*dirent->d_name=='K') serv.levels &= ~(1<<i); | |
72 | + else if (*dirent->d_name=='S') serv.levels |= 1<<i; | |
73 | + } | |
74 | + closedir(dir); | |
75 | + } | |
76 | + } | |
77 | ||
78 | *service = serv; | |
79 | return 0; |