Lines Matching refs:state

45 static void *parse_service(struct parse_state *state, int nargs, char **args);
46 static void parse_line_service(struct parse_state *state, int nargs, char **args);
48 static void *parse_action(struct parse_state *state, int nargs, char **args);
49 static void parse_line_action(struct parse_state *state, int nargs, char **args);
172 static void parse_line_no_op(struct parse_state *state, int nargs, char **args)
295 static void parse_import(struct parse_state *state, int nargs, char **args)
297 struct listnode *import_list = state->priv;
310 state->line, state->filename);
320 static void parse_new_section(struct parse_state *state, int kw,
327 state->context = parse_service(state, nargs, args);
328 if (state->context) {
329 state->parse_line = parse_line_service;
334 state->context = parse_action(state, nargs, args);
335 if (state->context) {
336 state->parse_line = parse_line_action;
341 parse_import(state, nargs, args);
344 state->parse_line = parse_line_no_op;
349 struct parse_state state;
356 state.filename = fn;
357 state.line = 0;
358 state.ptr = s;
359 state.nexttoken = 0;
360 state.parse_line = parse_line_no_op;
363 state.priv = &import_list;
366 switch (next_token(&state)) {
368 state.parse_line(&state, 0, 0);
371 state.line++;
375 state.parse_line(&state, 0, 0);
376 parse_new_section(&state, kw, nargs, args);
378 state.parse_line(&state, nargs, args);
385 args[nargs++] = state.text;
616 static void *parse_service(struct parse_state *state, int nargs, char **args)
620 parse_error(state, "services must have a name and a program\n");
624 parse_error(state, "invalid service name '%s'\n", args[1]);
630 parse_error(state, "ignored duplicate definition of service '%s'\n", args[1]);
637 parse_error(state, "out of memory\n");
651 static void parse_line_service(struct parse_state *state, int nargs, char **args)
653 struct service *svc = state->context;
669 parse_error(state, "class option requires a classname\n");
683 parse_error(state, "ioprio optin usage: ioprio <rt|be|idle> <ioprio 0-7>\n");
688 parse_error(state, "priority value must be range 0 - 7\n");
699 parse_error(state, "ioprio option usage: ioprio <rt|be|idle> <0-7>\n");
705 parse_error(state, "group option requires a group id\n");
707 parse_error(state, "group option accepts at most %d supp. groups\n",
720 parse_error(state, "keycodes option requires atleast one keycode\n");
724 parse_error(state, "could not allocate keycodes\n");
741 parse_error(state, "invalid command '%s'\n", args[0]);
746 parse_error(state, "%s requires %d %s\n", args[0], kw_nargs - 1,
763 parse_error(state, "setenv option requires name and value arguments\n");
768 parse_error(state, "out of memory\n");
780 parse_error(state, "socket option requires name, type, perm arguments\n");
785 parse_error(state, "socket type must be 'dgram', 'stream' or 'seqpacket'\n");
790 parse_error(state, "out of memory\n");
808 parse_error(state, "user option requires a user id\n");
815 parse_error(state, "seclabel option requires a label string\n");
822 parse_error(state, "invalid option '%s'\n", args[0]);
826 static void *parse_action(struct parse_state *state, int nargs, char **args)
830 parse_error(state, "actions must have a trigger\n");
834 parse_error(state, "actions may not have extra parameters\n");
846 static void parse_line_action(struct parse_state* state, int nargs, char **args)
849 struct action *act = state->context;
859 parse_error(state, "invalid command '%s'\n", args[0]);
865 parse_error(state, "%s requires %d %s\n", args[0], n - 1,
871 cmd->line = state->line;
872 cmd->filename = state->filename;