]> git.pld-linux.org Git - packages/chkconfig.git/blob - chkconfig-add.patch
- argh, fixed broken add patch
[packages/chkconfig.git] / chkconfig-add.patch
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>
6  #include <unistd.h>
7  static char *progname;
8 +extern int addItem;
9  struct config conf;            // used by leveldb.c
10  
11  #define _(String) gettext((String)) 
12 @@ -94,12 +95,10 @@
13      if (s.type == TYPE_XINETD) return 0;
14      
15      for (i = 0; i <= conf.maxlevel; 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 @@ -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;
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
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     2001-12-03 - Petter Reinholdtsen <pere@hungry.com>
48 @@ -231,6 +235,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, "%s/%s", conf.initdir, name);
57  
58 @@ -345,6 +352,21 @@
59  
60      serv.name = strdup(name);
61  
62 +    if (addItem) {
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);
74 +       }
75 +    }
76 +
77      *service = serv;
78      return 0;
79  }
This page took 0.038468 seconds and 3 git commands to generate.