aboutsummaryrefslogtreecommitdiff
path: root/src/sysvinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysvinit.c')
-rw-r--r--src/sysvinit.c64
1 files changed, 57 insertions, 7 deletions
diff --git a/src/sysvinit.c b/src/sysvinit.c
index 3ba986b..c5d25da 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -55,13 +55,13 @@ static int boot_trans_tab[max_boot_state][sizeof(valid_runlevels)-1] = {
55}; 55};
56 56
57enum boot_state boot_state; 57enum boot_state boot_state;
58int runlevel = 0; 58static int runlevel = 0;
59int prevlevel = 'N'; 59static int prevlevel = 'N';
60 60
61int initdefault; /* Default runlevel */ 61int initdefault;
62int dfl_level; 62static int dfl_level;
63char *emergency_shell = EMERGENCY_SHELL; 63static char *emergency_shell = EMERGENCY_SHELL;
64int emergency; 64static int emergency;
65 65
66static int inittrans (void); 66static int inittrans (void);
67 67
@@ -340,7 +340,7 @@ is_valid_runlevel (int c)
340{ 340{
341 return !!strchr (valid_runlevel_arg, c); 341 return !!strchr (valid_runlevel_arg, c);
342} 342}
343 343
344#define ENVAR_CONSOLE "CONSOLE=" 344#define ENVAR_CONSOLE "CONSOLE="
345#define ENVTMPL_CONSOLE "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 345#define ENVTMPL_CONSOLE "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
346 346
@@ -1283,3 +1283,53 @@ sysvinit_parse_argv (int argc, char **argv)
1283 dfl_level = c; 1283 dfl_level = c;
1284 } 1284 }
1285} 1285}
1286
1287int
1288cb_initdefault (enum grecs_callback_command cmd,
1289 grecs_node_t *node,
1290 void *varptr, void *cb_data)
1291{
1292 grecs_locus_t *locus = &node->locus;
1293 grecs_value_t *value = node->v.value;
1294
1295 if (grecs_assert_node_value_type (cmd, node, GRECS_TYPE_STRING))
1296 return 1;
1297 if (strlen (value->v.string) != 1)
1298 {
1299 grecs_error (locus, 0, _("argument must be a single character"));
1300 return 1;
1301 }
1302 if (!is_valid_runlevel (value->v.string[0]))
1303 {
1304 grecs_error (locus, 0, _("not a valid runlevel"));
1305 return 1;
1306 }
1307 initdefault = toupper (value->v.string[0]);
1308 return 0;
1309}
1310
1311int
1312cb_runlevels (enum grecs_callback_command cmd,
1313 grecs_node_t *node,
1314 void *varptr, void *cb_data)
1315{
1316 grecs_locus_t *locus = &node->locus;
1317 grecs_value_t *value = node->v.value;
1318 char **sptr = varptr, *p;
1319
1320 if (grecs_assert_node_value_type (cmd, node, GRECS_TYPE_STRING))
1321 return 1;
1322 for (p = value->v.string; *p; p++)
1323 {
1324 if (!is_valid_runlevel (*p))
1325 {
1326 grecs_error (locus, 0, _("not a valid runlevel: %c"), *p);
1327 return 1;
1328 }
1329 }
1330 *sptr = grecs_strdup (value->v.string);
1331 for (p = *sptr; *p; p++)
1332 *p = toupper (*p);
1333 return 0;
1334}
1335

Return to:

Send suggestions and report system problems to the System administrator.