]> git.pld-linux.org Git - packages/chkconfig.git/blob - chkconfig-add.patch
91618a3f1e985ce1b11608aabfcad15504458f46
[packages/chkconfig.git] / chkconfig-add.patch
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
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  
12 @@ -74,12 +75,10 @@
13      if (s.type == TYPE_XINETD) return 0;
14      
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;
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
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>
48 @@ -225,6 +229,9 @@
49      char overflow;
50      char levelbuf[20];
51      char * english_desc = NULL;
52 +    DIR *dir;
53 +    struct dirent *dirent;
54 +    int i;
55  
56      sprintf(filename, RUNLEVELS "/init.d/%s", name);
57  
58 @@ -316,6 +323,21 @@
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;
This page took 0.064747 seconds and 2 git commands to generate.