-diff -Nur chkconfig-1.2.22.orig/chkconfig.c chkconfig-1.2.22/chkconfig.c
---- chkconfig-1.2.22.orig/chkconfig.c Sat Dec 30 05:25:26 2000
-+++ chkconfig-1.2.22/chkconfig.c Thu Apr 5 23:39:20 2001
-@@ -12,6 +12,7 @@
+diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c
+--- chkconfig-1.2.24h.orig/chkconfig.c Wed Jul 17 20:10:55 2002
++++ chkconfig-1.2.24h/chkconfig.c Wed Jan 22 11:56:32 2003
+@@ -31,6 +31,7 @@
+ #include <sys/stat.h>
#include <unistd.h>
-
static char *progname;
+extern int addItem;
+ struct config conf; // used by leveldb.c
#define _(String) gettext((String))
-
-@@ -74,12 +75,10 @@
+@@ -94,12 +95,10 @@
if (s.type == TYPE_XINETD) return 0;
- for (i = 0; i < 7; i++) {
+ for (i = 0; i <= conf.maxlevel; i++) {
- if (!isConfigured(name, i)) {
if ((1 << i) & s.levels)
doSetService(s, i, 1);
}
return 0;
-@@ -246,7 +245,7 @@
- }
-
- int main(int argc, char ** argv) {
-- int listItem = 0, addItem = 0, delItem = 0;
-+ int listItem = 0, delItem = 0;
- int rc, i, x;
- char * levels = NULL;
- int help=0, version=0;
-diff -Nur chkconfig-1.2.22.orig/leveldb.c chkconfig-1.2.22/leveldb.c
---- chkconfig-1.2.22.orig/leveldb.c Fri Feb 2 18:51:01 2001
-+++ chkconfig-1.2.22/leveldb.c Thu Apr 5 23:39:01 2001
+diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
+--- chkconfig-1.2.24h.orig/leveldb.c Fri Apr 19 03:15:55 2002
++++ chkconfig-1.2.24h/leveldb.c Wed Jan 22 12:04:47 2003
@@ -11,6 +11,10 @@
#include <stdio.h>
#include <string.h>
+int addItem = 0;
/* Changes
- 1998-09-22 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
-@@ -225,6 +229,9 @@
+ 2001-12-03 - Petter Reinholdtsen <pere@hungry.com>
+@@ -231,6 +235,9 @@
char overflow;
char levelbuf[20];
char * english_desc = NULL;
+ struct dirent *dirent;
+ int i;
- sprintf(filename, RUNLEVELS "/init.d/%s", name);
+ sprintf(filename, "%s/%s", conf.initdir, name);
-@@ -316,6 +323,21 @@
- }
+@@ -345,6 +352,21 @@
serv.name = strdup(name);
-+
+
+ if (addItem) {
-+ strcpy(levelbuf,"/etc/rc.d/rc0.d");
-+ for(i=0;i<7;i++,levelbuf[12]++) {
-+ dir=opendir(levelbuf);
-+ if (!dir) return 1;
-+ while ((dirent=readdir(dir))) {
-+ if (strlen(dirent->d_name)<4) continue;
-+ if (strcmp(dirent->d_name+3,name)) continue;
-+ if (*dirent->d_name=='K') serv.levels &= ~(1<<i);
-+ else if (*dirent->d_name=='S') serv.levels |= 1<<i;
++ strcpy(levelbuf,"/etc/rc.d/rc0.d");
++ for(i=0;i<7;i++,levelbuf[12]++) {
++ dir=opendir(levelbuf);
++ if (!dir) return 1;
++ while ((dirent=readdir(dir))) {
++ if (strlen(dirent->d_name)<4) continue;
++ if (strcmp(dirent->d_name+3,name)) continue;
++ if (*dirent->d_name=='K') serv.levels &= ~(1<<i);
++ else if (*dirent->d_name=='S') serv.levels |= 1<<i;
++ }
++ closedir(dir);
+ }
-+ closedir(dir);
-+ }
+ }
-
++
*service = serv;
return 0;
+ }
-diff -Nru chkconfig-1.2.22/chkconfig.c chkconfig-1.2.22.new/chkconfig.c
---- chkconfig-1.2.22/chkconfig.c Sun Mar 25 03:29:32 2001
-+++ chkconfig-1.2.22.new/chkconfig.c Sun Mar 25 03:31:17 2001
-@@ -51,7 +51,6 @@
+diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c
+--- chkconfig-1.2.24h.orig/chkconfig.c Wed Jul 17 20:10:55 2002
++++ chkconfig-1.2.24h/chkconfig.c Wed Jan 22 12:43:07 2003
+@@ -70,7 +70,6 @@
readServiceError(rc, name);
return 1;
}
- if (s.type == TYPE_XINETD) return 0;
- for (level = 0; level < 7; level++) {
+ for (level = 0; level <= conf.maxlevel; level++) {
if (!findServiceEntries(name, level, &globres)) {
-@@ -72,8 +71,6 @@
+@@ -90,8 +89,6 @@
+ readServiceError(rc, name);
return 1;
}
-
+-
- if (s.type == TYPE_XINETD) return 0;
--
- for (i = 0; i < 7; i++) {
- if ((1 << i) & s.levels)
- doSetService(s, i, 1);
-@@ -96,10 +93,6 @@
+
+ for (i = 0; i <= conf.maxlevel; i++) {
+ if (!isConfigured(name, i)) {
+@@ -118,10 +115,6 @@
}
printf("%-15s", s.name);
- return 0;
- }
- for (i = 0; i < 7; i++) {
+ for (i = 0; i <= conf.maxlevel; i++) {
printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off"));
-@@ -109,21 +102,6 @@
+@@ -131,21 +124,6 @@
return 0;
}
-static int isXinetdEnabled() {
-- int i;
-- struct service s;
--
-- if (readServiceInfo("xinetd", &s, 0)) {
-- return 0;
-- }
-- for (i = 0; i < 7; i++) {
-- if (isOn("xinetd", i))
-- return 1;
-- }
-- return 0;
+- int i;
+- struct service s;
+-
+- if (readServiceInfo("xinetd", &s, 0)) {
+- return 0;
+- }
+- for (i = 0; i <= conf.maxlevel; i++) {
+- if (isOn("xinetd", i))
+- return 1;
+- }
+- return 0;
-}
-
-
static int listService(char * item) {
DIR * dir;
struct dirent * ent;
-@@ -174,35 +152,6 @@
- }
+@@ -200,34 +178,6 @@
closedir(dir);
--
+
- if (isXinetdEnabled()) {
- printf(_("xinetd based services:\n"));
-- if (!(dir = opendir(XINETDDIR))) {
+- if (!(dir = opendir(conf.xinetddir))) {
- fprintf(stderr, _("failed to open directory %s: %s"),
-- XINETDDIR, strerror(err));
+- conf.xinetddir, strerror(err));
- return 1;
- }
- while ((ent = readdir(dir))) {
return 0;
}
-@@ -224,21 +173,16 @@
+@@ -249,7 +199,6 @@
return 1;
}
- if (s.type == TYPE_INIT_D) {
-- for (i = 0; i < 7; i++) {
-- if (!((1 << i) & where)) continue;
--
-- if (state == 1 || state == 0)
-- what = state;
-- else if (s.levels & (1 << i))
-- what = 1;
-- else
-- what = 0;
-- doSetService(s, i, what);
-- }
+ for (i = 0; i <= conf.maxlevel; i++) {
+ if (!((1 << i) & where)) continue;
+
+@@ -261,14 +210,6 @@
+ what = 0;
+ doSetService(s, i, what);
+ }
- } else if (s.type == TYPE_XINETD) {
+- char xinetd[250];
+-
- setXinetdService(s, state);
-- system("/etc/init.d/xinetd reload >/dev/null 2>&1");
-+ for (i = 0; i < 7; i++) {
-+ if (!((1 << i) & where)) continue;
-+
-+ if (state == 1 || state == 0)
-+ what = state;
-+ else if (s.levels & (1 << i))
-+ what = 1;
-+ else
-+ what = 0;
-+ doSetService(s, i, what);
- }
+- snprintf(xinetd, sizeof(xinetd),
+- "%s/xinetd reload >/dev/null 2>&1", conf.initdir);
+- system(xinetd);
+- }
return 0;
-diff -Nru chkconfig-1.2.22/leveldb.c chkconfig-1.2.22.new/leveldb.c
---- chkconfig-1.2.22/leveldb.c Sun Mar 25 03:29:32 2001
-+++ chkconfig-1.2.22.new/leveldb.c Sun Mar 25 03:31:47 2001
-@@ -138,88 +138,6 @@
+ }
+diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c
+--- chkconfig-1.2.24h.orig/leveldb.c Fri Apr 19 03:15:55 2002
++++ chkconfig-1.2.24h/leveldb.c Wed Jan 22 12:46:28 2003
+@@ -140,88 +140,6 @@
return 0;
}
-}
-
int readServiceInfo(char * name, struct service * service, int honorHide) {
- char * filename = alloca(strlen(name) + strlen(RUNLEVELS) + 50);
+ char * filename = alloca(strlen(name) + strlen(conf.initdir) + 50);
int fd;
-@@ -236,7 +154,7 @@
- sprintf(filename, RUNLEVELS "/init.d/%s", name);
+@@ -235,7 +153,7 @@
+ sprintf(filename, "%s/%s", conf.initdir, name);
if ((fd = open(filename, O_RDONLY)) < 0) {
- return readXinetdServiceInfo(name,service,honorHide);
}
fstat(fd, &sb);
-@@ -418,60 +336,6 @@
-
- globfree(&globres);
+@@ -427,60 +345,6 @@
return 1;
--}
--
+ }
+
-int setXinetdService(struct service s, int on) {
- int oldfd, newfd;
- char oldfname[100], newfname[100];
- chmod(newfname,0644);
- unlink(oldfname);
- return(rename(newfname,oldfname));
- }
-
+-}
+-
int doSetService(struct service s, int level, int on) {
-diff -Nru chkconfig-1.2.22/ntsysv.c chkconfig-1.2.22.new/ntsysv.c
---- chkconfig-1.2.22/ntsysv.c Mon Mar 5 06:51:54 2001
-+++ chkconfig-1.2.22.new/ntsysv.c Sun Mar 25 03:33:04 2001
-@@ -40,20 +40,14 @@
+ int priority = on ? s.sPriority : s.kPriority;
+ char linkname[200];
+diff -Nru chkconfig-1.2.24h.orig/ntsysv.c chkconfig-1.2.24h/ntsysv.c
+--- chkconfig-1.2.24h.orig/ntsysv.c Sun Jul 28 10:50:04 2002
++++ chkconfig-1.2.24h/ntsysv.c Wed Jan 22 12:50:38 2003
+@@ -64,11 +64,6 @@
states = alloca(sizeof(*states) * numServices);
for (i = 0; i < numServices; i++) {
- services[i].levels ? '*' : ' ', NULL,
- states + i);
- } else {
-- for (j = 0; j < 7; j++) {
-- if (levels & (1 << j)) {
-- if (isOn(services[i].name, j)) break;
-- }
-+ for (j = 0; j < 7; j++) {
-+ if (levels & (1 << j)) {
-+ if (isOn(services[i].name, j)) break;
- }
-- checkboxes[i] = newtCheckbox(-1, i, services[i].name,
-- (j != 7) ? '*' : ' ', NULL,
-- states + i);
- }
-+ checkboxes[i] = newtCheckbox(-1, i, services[i].name,
-+ (j != 7) ? '*' : ' ', NULL,
-+ states + i);
+ for (j = 0; j <= conf.maxlevel; j++) {
+ if (levels & (1 << j)) {
+ if (isOn(services[i].name, j)) break;
+@@ -78,7 +73,6 @@
+ (j != (conf.maxlevel+1)) ?
+ '*' : ' ', NULL,
+ states + i);
+- }
newtFormAddComponent(subform, checkboxes[i]);
}
-@@ -110,13 +104,9 @@
+@@ -135,13 +129,9 @@
if (!update) return 1;
for (i = 0; i < numServices; i++) {
- if (services[i].type == TYPE_XINETD)
- setXinetdService(services[i], states[i] == '*');
- else {
-- for (j = 0; j < 7; j++) {
-- if (levels & (1 << j))
-- doSetService(services[i], j, states[i] == '*');
+ for (j = 0; j <= conf.maxlevel; j++) {
+ if (levels & (1 << j))
+ doSetService(services[i], j, states[i] == '*');
- }
-+ for (j = 0; j < 7; j++) {
-+ if (levels & (1 << j))
-+ doSetService(services[i], j, states[i] == '*');
}
}
-@@ -186,50 +176,6 @@
- }
+@@ -212,49 +202,6 @@
closedir(dir);
--
+
- if (!stat("/usr/sbin/xinetd",&sb)) {
-- if (!(dir = opendir(XINETDDIR))) {
-- fprintf(stderr, "failed to open " XINETDDIR ": %s\n",
-- strerror(errno));
-- return 2;
-- }
+- if (!(dir = opendir(conf.xinetddir))) {
+- fprintf(stderr, "failed to open %s: %s\n", conf.xinetddir,
+- strerror(errno));
+- return 2;
+- }
-
-- while ((ent = readdir(dir))) {
-- if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') ||
-- strchr(ent->d_name, '.')) continue;
+- while ((ent = readdir(dir))) {
+- if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') ||
+- strchr(ent->d_name, '.')) continue;
-
-- sprintf(fn, "%s/%s", XINETDDIR, ent->d_name);
-- if (stat(fn, &sb))
-- {
-- err = errno;
-- continue;
-- }
-- if (!S_ISREG(sb.st_mode)) continue;
+- sprintf(fn, "%s/%s", conf.xinetddir, ent->d_name);
+- if (stat(fn, &sb))
+- {
+- err = errno;
+- continue;
+- }
+- if (!S_ISREG(sb.st_mode)) continue;
-
-- if (numServices == numServicesAlloced) {
-- numServicesAlloced += 10;
-- services = realloc(services,
-- numServicesAlloced * sizeof(*services));
-- }
+- if (numServices == numServicesAlloced) {
+- numServicesAlloced += 10;
+- services = realloc(services,
+- numServicesAlloced * sizeof(*services));
+- }
-
-- rc = readXinetdServiceInfo(ent->d_name, services + numServices, honorHide);
--
-- if (rc == -1) {
-- fprintf(stderr, _("error reading info for service %s: %s\n"),
-- ent->d_name, strerror(errno));
-- closedir(dir);
-- return 2;
-- } else if (!rc)
-- numServices++;
-- }
+- rc = readXinetdServiceInfo(ent->d_name, services + numServices, honorHide);
+-
+- if (rc == -1) {
+- fprintf(stderr, _("error reading info for service %s: %s\n"),
+- ent->d_name, strerror(errno));
+- closedir(dir);
+- return 2;
+- } else if (!rc)
+- numServices++;
+- }
-
-- if (err) {
-- fprintf(stderr, _("error reading from directory %s: %s\n"),
-- XINETDDIR, strerror(err));
-- return 1;
-- }
+- if (err) {
+- fprintf(stderr, _("error reading from directory %s: %s\n"),
+- conf.xinetddir, strerror(err));
+- return 1;
+- }
- }
-
qsort(services, numServices, sizeof(*services), serviceNameCmp);