]> git.pld-linux.org Git - packages/chkconfig.git/blob - chkconfig-add.patch
- updated
[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 diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
26 --- chkconfig-1.2.24h.orig/leveldb.c    Fri Apr 19 03:15:55 2002
27 +++ chkconfig-1.2.24h/leveldb.c Wed Jan 22 12:04:47 2003
28 @@ -11,6 +11,10 @@
29  #include <stdio.h>
30  #include <string.h>
31  #include <unistd.h>
32 +#include <sys/types.h>
33 +#include <dirent.h>
34 +
35 +int addItem = 0;
36  
37  /* Changes
38     2001-12-03 - Petter Reinholdtsen <pere@hungry.com>
39 @@ -231,6 +235,9 @@
40      char overflow;
41      char levelbuf[20];
42      char * english_desc = NULL;
43 +    DIR *dir;
44 +    struct dirent *dirent;
45 +    int i;
46  
47      sprintf(filename, "%s/%s", conf.initdir, name);
48  
49 @@ -345,6 +352,21 @@
50  
51      serv.name = strdup(name);
52  
53 +    if (addItem) {
54 +       strcpy(levelbuf,"/etc/rc.d/rc0.d");
55 +       for(i=0;i<7;i++,levelbuf[12]++) {
56 +           dir=opendir(levelbuf);
57 +           if (!dir) return 1;
58 +           while ((dirent=readdir(dir))) {
59 +               if (strlen(dirent->d_name)<4) continue;
60 +               if (strcmp(dirent->d_name+3,name)) continue;
61 +               if (*dirent->d_name=='K') serv.levels &= ~(1<<i);
62 +               else if (*dirent->d_name=='S') serv.levels |= 1<<i;
63 +           }
64 +           closedir(dir);
65 +       }
66 +    }
67 +
68      *service = serv;
69      return 0;
70  }
This page took 0.082247 seconds and 3 git commands to generate.