File insserv-boolean.patch of Package insserv
diff -u insserv/insserv.c insserv-new/insserv.c
--- insserv/insserv.c 2024-12-21 14:25:33.000000000 -0500
+++ insserv-new/insserv.c 2025-10-28 10:25:02.850926731 -0400
@@ -182,12 +182,12 @@
/* When to be verbose, and what level of verbosity */
static int verbose = 0;
-static boolean silent_mode = false;
-static boolean dryrun = false;
+static bool silent_mode = false;
+static bool dryrun = false;
/* When paths set do not add root if any */
-static boolean set_override = false;
-static boolean set_insconf = false;
+static bool set_override = false;
+static bool set_insconf = false;
/* Legacy and current location for dependency files */
/* #define DEPENDENCY_PATH "/lib/insserv/" */
@@ -202,8 +202,8 @@
/* Wether systemd is active or not */
#if WANT_SYSTEMD
-static boolean systemd = false;
-static boolean is_overridden_by_systemd(const char *);
+static bool systemd = false;
+static bool is_overridden_by_systemd(const char *);
#endif /* WANT_SYSTEMD */
/* Search results points here */
@@ -405,14 +405,14 @@
char * tmp = strdupa(required);
list_t * ptr, * list;
ushort old = bit;
- boolean can_expand_name = false;
+ bool can_expand_name = false;
if (!tmp)
error("%s", strerror(errno));
while ((token = strsep(&tmp, delimeter)) && *token) {
service_t * req, * here, * need;
- boolean found = false;
+ bool found = false;
bit = old;
@@ -528,10 +528,10 @@
/*
* Check required services for name
*/
-static boolean chkrequired(service_t *restrict serv, const boolean recursive) attribute((nonnull(1)));
-static boolean chkrequired(service_t *restrict serv, const boolean recursive)
+static bool chkrequired(service_t *restrict serv, const bool recursive) attribute((nonnull(1)));
+static bool chkrequired(service_t *restrict serv, const bool recursive)
{
- boolean ret = true;
+ bool ret = true;
list_t * pos;
/* Technically, it is not possible for this function to be called if serv is
@@ -593,11 +593,11 @@
/*
* Check dependencies for name as a service
*/
-static boolean chkdependencies(service_t *restrict serv) attribute((nonnull(1)));
-static boolean chkdependencies(service_t *restrict serv)
+static bool chkdependencies(service_t *restrict serv) attribute((nonnull(1)));
+static bool chkdependencies(service_t *restrict serv)
{
const char * const name = serv->name;
- boolean ret = true;
+ bool ret = true;
list_t * ptr;
list_for_each(ptr, s_start) {
@@ -972,7 +972,7 @@
const service_t * lserv[100] = {0};
unsigned long lcnt = 0;
#endif /* not MINIMAL_DEPEND */
- boolean mark;
+ bool mark;
list_t * pos;
#if defined(MINIMAL_RULES) && (MINIMAL_RULES != 0)
@@ -994,7 +994,7 @@
req_t * req = getreq(pos);
service_t * dep = req->serv;
#if defined(MINIMAL_DEPEND) && (MINIMAL_DEPEND != 0)
- boolean shadow = false;
+ bool shadow = false;
unsigned long n;
#endif /* not MINIMAL_DEPEND */
const char * name;
@@ -1114,7 +1114,7 @@
const service_t * lserv[100] = {0};
unsigned long lcnt = 0;
#endif /* not MINIMAL_DEPEND */
- boolean mark;
+ bool mark;
list_t * pos;
#if defined(MINIMAL_RULES) && (MINIMAL_RULES != 0)
@@ -1139,7 +1139,7 @@
req_t * rev = getreq(pos);
service_t * dep = rev->serv;
#if defined(MINIMAL_DEPEND) && (MINIMAL_DEPEND != 0)
- boolean shadow = false;
+ bool shadow = false;
unsigned long n;
#endif /* not MINIMAL_DEPEND */
const char * name;
@@ -1267,11 +1267,11 @@
* Check for script in list.
*/
static int curr_argc = -1;
-static inline boolean chkfor(const char *restrict const script,
+static inline bool chkfor(const char *restrict const script,
char **restrict const list, const int cnt) attribute((nonnull(1,2)));
-static inline boolean chkfor(const char *restrict const script, char **restrict const list, const int cnt)
+static inline bool chkfor(const char *restrict const script, char **restrict const list, const int cnt)
{
- boolean isinc = false;
+ bool isinc = false;
register int c = cnt;
curr_argc = -1;
@@ -1343,10 +1343,10 @@
/*
* Wrapper for regexec(3)
*/
-static inline boolean regexecutor(regex_t *restrict preg,
+static inline bool regexecutor(regex_t *restrict preg,
const char *restrict string,
size_t nmatch, regmatch_t pmatch[], int eflags) attribute((nonnull(1,2)));
-static inline boolean regexecutor(regex_t *preg, const char *string,
+static inline bool regexecutor(regex_t *preg, const char *string,
size_t nmatch, regmatch_t pmatch[], int eflags)
{
register int ret = regexec(preg, string, nmatch, pmatch, eflags);
@@ -1511,9 +1511,9 @@
static int o_flags = O_RDONLY;
static uchar scan_lsb_headers(const int dfd, const char *restrict const path,
- const boolean cache, const boolean ignore) attribute((nonnull(2)));
+ const bool cache, const bool ignore) attribute((nonnull(2)));
static uchar scan_lsb_headers(const int dfd, const char *restrict const path,
- const boolean cache, const boolean ignore)
+ const bool cache, const bool ignore)
{
regmatch_t subloc[SUBNUM_SHD+1], *val = &subloc[SUBNUM-1], *shl = &subloc[SUBNUM_SHD-1];
char *upstart_job = (char*)0;
@@ -1794,10 +1794,10 @@
static uchar load_overrides(const char *restrict const dir,
const char *restrict const name,
- const boolean cache, const boolean ignore) attribute((nonnull(1,2)));
+ const bool cache, const bool ignore) attribute((nonnull(1,2)));
static uchar load_overrides(const char *restrict const dir,
const char *restrict const name,
- const boolean cache, const boolean ignore)
+ const bool cache, const bool ignore)
{
uchar ret = 0;
char fullpath[PATH_MAX+1];
@@ -1818,11 +1818,11 @@
static uchar scan_script_defaults(int dfd, const char *const restrict path,
const char *const restrict override_path,
char **restrict first,
- const boolean cache, const boolean ignore) attribute((nonnull(2,3)));
+ const bool cache, const bool ignore) attribute((nonnull(2,3)));
static uchar scan_script_defaults(int dfd, const char *restrict const path,
const char *restrict const override_path,
char **restrict first,
- const boolean cache, const boolean ignore)
+ const bool cache, const bool ignore)
{
char * name = scriptname(dfd, path, first);
uchar ret = 0;
@@ -1987,9 +1987,9 @@
*/
static void scan_script_locations(const char *const restrict path,
const char *const restrict override_path,
- const boolean ignore) attribute((nonnull(1,2)));
+ const bool ignore) attribute((nonnull(1,2)));
static void scan_script_locations(const char *const path, const char *const override_path,
- const boolean ignore)
+ const bool ignore)
{
int runlevel;
@@ -2268,7 +2268,7 @@
static int cfgfile_filter(const struct dirent *restrict d) attribute((nonnull(1)));
static int cfgfile_filter(const struct dirent *restrict d)
{
- boolean ret = false;
+ bool ret = false;
const char * name = d->d_name;
const char * end;
@@ -2298,7 +2298,7 @@
/* check loaded filters */
else if (file_filters)
{
- boolean found = false;
+ bool found = false;
int index = 0;
while ( (file_filters[index]) && (! found) )
{
@@ -2630,10 +2630,10 @@
* a sub process "/bin/sh" forked off for executing a temporary file for %preun,
* %postun, %pre, or %post scriptlet.
*/
-static inline boolean underrpm(void)
+static inline bool underrpm(void)
{
- boolean ret = false;
- boolean mnt = true;
+ bool ret = false;
+ bool mnt = true;
const pid_t pp = getppid();
char buf[PATH_MAX], *argv[3], *ptr;
# if defined(USE_RPMLIB) && (USE_RPMLIB > 0)
@@ -2724,9 +2724,9 @@
/*
* Systemd integration
*/
-static boolean is_overridden_by_systemd(const char *service) {
+static bool is_overridden_by_systemd(const char *service) {
char *p;
- boolean ret = false;
+ bool ret = false;
if (asprintf(&p, SYSTEMD_SERVICE_PATH "/%s.service", service) < 0)
error("asprintf(): %s\n", strerror(errno));
@@ -2737,7 +2737,7 @@
return ret;
}
-static void forward_to_systemd (const char *initscript, const char *verb, boolean alternative_root) {
+static void forward_to_systemd (const char *initscript, const char *verb, bool alternative_root) {
const char *name;
if (initscript == NULL)
@@ -2783,9 +2783,9 @@
stop or stop levels.
Returns true if overlap is found and false is none is found.
*/
-boolean Start_Stop_Overlap(char *start_levels, char *stop_levels)
+bool Start_Stop_Overlap(char *start_levels, char *stop_levels)
{
- boolean found_overlap = false;
+ bool found_overlap = false;
int string_index = 0;
char *found;
@@ -2865,16 +2865,16 @@
char * insconf = INSCONF;
const char *const ipath = path;
int runlevel, c, dfd;
- boolean del = false;
- boolean defaults = false;
- boolean ignore = false;
- boolean loadarg = false;
- boolean recursive = false;
- boolean showall = false;
- boolean waserr = false;
- /* boolean legacy_path = false; */
- boolean free_dependency_path = false;
- boolean overlap;
+ bool del = false;
+ bool defaults = false;
+ bool ignore = false;
+ bool loadarg = false;
+ bool recursive = false;
+ bool showall = false;
+ bool waserr = false;
+ /* bool legacy_path = false; */
+ bool free_dependency_path = false;
+ bool overlap;
myname = basename(*argv);
@@ -3231,8 +3231,8 @@
service_t * service = (service_t*)0;
char * token;
char * begin = (char*)0; /* hold start pointer of strings handled by strsep() */
- boolean hard = false;
- boolean isarg = false;
+ bool hard = false;
+ bool isarg = false;
uchar lsb = 0;
#if defined(DEBUG) && (DEBUG > 0)
int nobug = 0;
@@ -3588,7 +3588,7 @@
}
if (service) {
- boolean known = (service->attr.flags & SERV_KNOWN);
+ bool known = (service->attr.flags & SERV_KNOWN);
service->attr.flags |= SERV_KNOWN;
if (!known) {
@@ -3640,7 +3640,7 @@
* check if all services are around for this script.
*/
if (isarg && !ignore) {
- boolean ok = true;
+ bool ok = true;
if (del)
ok = chkdependencies(service);
else
@@ -3806,7 +3806,7 @@
char * ptr = argr[curr_argc];
struct _mark {
const char * wrd;
- const boolean sk;
+ const bool sk;
char * order;
char ** str;
} mark[] = {
@@ -4146,8 +4146,8 @@
script = (char*)0;
while ((serv = listscripts(&script, 'X', lvl))) {
- boolean this = chkfor(script, argv, argc);
- boolean found, slink;
+ bool this = chkfor(script, argv, argc);
+ bool found, slink;
char * clink;
if (*script == '$') /* Do not link in virtual dependencies */
@@ -4331,8 +4331,8 @@
script = (char*)0;
while ((serv = listscripts(&script, 'X', seek))) {
- boolean this = chkfor(script, argv, argc);
- boolean found;
+ bool this = chkfor(script, argv, argc);
+ bool found;
char * clink;
char mode;
diff -u insserv/listing.c insserv-new/listing.c
--- insserv/listing.c 2024-12-21 14:25:33.000000000 -0500
+++ insserv-new/listing.c 2025-10-28 10:24:09.606925027 -0400
@@ -237,10 +237,10 @@
/*
* Remember loops to warn only once
*/
-static inline boolean remembernode (handle_t *restrict const peg) attribute((always_inline,nonnull(1)));
-static inline boolean remembernode (handle_t *restrict const peg)
+static inline bool remembernode (handle_t *restrict const peg) attribute((always_inline,nonnull(1)));
+static inline bool remembernode (handle_t *restrict const peg)
{
- register boolean ret = true;
+ register bool ret = true;
if (peg->flags & DIR_LOOP)
goto out;
@@ -330,7 +330,7 @@
for (tmp = dir; tmp; tmp = getnextlink(l_list)) {
const typeof(attof(tmp)->flags) sflags = attof(tmp)->flags;
- register boolean recursion = true;
+ register bool recursion = true;
handle_t * ptmp = (mode == 'K') ? &tmp->stopp : &tmp->start;
uchar * order = &ptmp->deep;
list_t * dent;
@@ -567,7 +567,7 @@
if (dir->stopp.deep == order) {
service_t *const orig = getorig(rev->serv);
list_t * chk;
- boolean found = false;
+ bool found = false;
list_for_each_prev(chk, &sort) { /* check if service was already resorted */
req_t * this = getreq(chk);
@@ -622,7 +622,7 @@
if (dir->start.deep == order) {
service_t * orig = getorig(req->serv);
list_t * chk;
- boolean found = false;
+ bool found = false;
list_for_each_prev(chk, &sort) { /* check if service was already resorted */
req_t * this = getreq(chk);
@@ -734,7 +734,7 @@
list_for_each_safe(dent, safe, &nick->sort.req) {
req_t * this = getreq(dent);
- boolean ok = true;
+ bool ok = true;
list_t * req;
list_for_each(req, &orig->sort.req) {
if (!strcmp(this->serv->name,getreq(req)->serv->name)) {
@@ -751,7 +751,7 @@
list_for_each_safe(dent, safe, &nick->sort.rev) {
req_t * this = getreq(dent);
- boolean ok = true;
+ bool ok = true;
list_t * rev;
list_for_each(rev, &orig->sort.rev) {
if (!strcmp(this->serv->name,getreq(rev)->serv->name)) {
@@ -851,7 +851,7 @@
list_for_each_safe(dent, safe, &orv->sort.req) {
req_t * this = getreq(dent);
- boolean ok = true;
+ bool ok = true;
list_t * req;
list_for_each(req, &srv->sort.req) {
if (!strcmp(this->serv->name,getreq(req)->serv->name)) {
@@ -873,7 +873,7 @@
list_for_each_safe(dent, safe, &orv->sort.rev) {
req_t * this = getreq(dent);
- boolean ok = true;
+ bool ok = true;
list_t * rev;
list_for_each(rev, &srv->sort.rev) {
if (!strcmp(this->serv->name,getreq(rev)->serv->name)) {
@@ -926,7 +926,7 @@
}
}
-boolean is_loop_detected(void)
+bool is_loop_detected(void)
{
list_t *tmp;
list_for_each(tmp, d_start) {
@@ -1020,10 +1020,10 @@
/*
* Used within loops to get scripts not included in this runlevel
*/
-boolean notincluded(const char *restrict const script, const char mode, const int runlevel)
+bool notincluded(const char *restrict const script, const char mode, const int runlevel)
{
list_t *tmp;
- boolean ret = false;
+ bool ret = false;
const ushort lvl = map_runlevel_to_lvl (runlevel);
list_for_each_prev(tmp, d_start) {
@@ -1128,7 +1128,7 @@
* Reorder all services starting with a service
* being in same runlevels.
*/
-void setorder(const char *restrict script, const char mode, const int order, const boolean recursive)
+void setorder(const char *restrict script, const char mode, const int order, const bool recursive)
{
dir_t * dir = findscript(script);
handle_t * peg;
@@ -1194,11 +1194,11 @@
* One script and several provided facilities leads
* to the same order for those facilities.
*/
-boolean makeprov(service_t *restrict serv, const char *restrict script)
+bool makeprov(service_t *restrict serv, const char *restrict script)
{
dir_t *restrict alias = findscript(script);
dir_t *restrict dir = (dir_t *restrict)serv->dir;
- boolean ret = true;
+ bool ret = true;
if (!dir->script) {
list_t * ptr;
diff -u insserv/listing.h insserv-new/listing.h
--- insserv/listing.h 2024-12-21 14:25:33.000000000 -0500
+++ insserv-new/listing.h 2025-10-28 10:23:17.203923350 -0400
@@ -24,7 +24,6 @@
#include <sys/types.h>
#include "config.h"
-typedef enum _boolean {false, true} boolean;
typedef unsigned char uchar;
#ifndef __USE_MISC
typedef unsigned short ushort;
@@ -191,8 +190,8 @@
}
}
-static inline boolean list_empty(const list_t *restrict const head) attribute((always_inline,nonnull(1)));
-static inline boolean list_empty(const list_t *restrict const head)
+static inline bool list_empty(const list_t *restrict const head) attribute((always_inline,nonnull(1)));
+static inline bool list_empty(const list_t *restrict const head)
{
return head->next == head;
}
@@ -308,14 +307,14 @@
extern void show_all(void);
extern void requires(service_t *restrict this, service_t *restrict dep, const char mode) attribute((nonnull(1,2)));
extern void runlevels(service_t *restrict serv, const char mode, const char *restrict lvl) attribute((nonnull(1,3)));
-extern boolean makeprov(service_t *restrict serv, const char *restrict script) attribute((nonnull(1,2)));
-extern void setorder(const char *restrict script, const char mode, const int order, const boolean recursive) attribute((nonnull(1)));
+extern bool makeprov(service_t *restrict serv, const char *restrict script) attribute((nonnull(1,2)));
+extern void setorder(const char *restrict script, const char mode, const int order, const bool recursive) attribute((nonnull(1)));
extern int getorder(const char *restrict script, const char mode) attribute((nonnull(1)));
-extern boolean notincluded(const char *restrict const script, const char mode, const int runlevel) attribute((nonnull(1)));
+extern bool notincluded(const char *restrict const script, const char mode, const int runlevel) attribute((nonnull(1)));
extern const char * getscript(const char *restrict prov) attribute((nonnull(1)));
extern const char * getprovides(const char *restrict script) attribute((nonnull(1)));
extern service_t * listscripts(const char **restrict script, const char mode, const ushort lvl);
-extern boolean is_loop_detected(void);
+extern bool is_loop_detected(void);
extern service_t * addservice(const char *restrict const serv) attribute((malloc,nonnull(1)));
extern service_t * findservice(const char *restrict const name);
extern service_t * getorig(service_t *restrict serv) attribute((const,nonnull(1)));
diff -u insserv/systemd.c insserv-new/systemd.c
--- insserv/systemd.c 2024-12-21 14:25:33.000000000 -0500
+++ insserv-new/systemd.c 2025-10-28 10:25:49.058928209 -0400
@@ -43,7 +43,7 @@
{
sdserv_t *restrict this;
const char *dot;
- boolean target;
+ bool target;
list_t *ptr;
size_t len;
Common subdirectories: insserv/tests and insserv-new/tests