Пример #1
0
int Parser_execarg(int argc, char **argv, command_t cmds[])
{
        command_t *cmd;

        cmd = Parser_findargcmd(argv[0], cmds);
        if ( cmd ) {
                int rc = (cmd->pc_func)(argc, argv);
                if (rc == CMD_HELP)
                        fprintf(stderr, "%s\n", cmd->pc_help);
                return rc;
        } else {
		printf("Try interactive use without arguments or use one of:\n");
                for (cmd = cmds; cmd->pc_name; cmd++)
                        printf("\"%s\"\n", cmd->pc_name);
                printf("as argument.\n");
        }
        return -1;
}
Пример #2
0
int Parser_execarg(int argc, char **argv, argcmd_t cmds[])
{
	argcmd_t *cmd;
	int i;

        cmd = Parser_findargcmd(argv[0], cmds);
	if ( cmd )
		return (cmd->ac_func)(argc, argv);

	printf("Try interactive use without arguments or use one of: ");
	for (i=0 ; cmds[i].ac_name ; i++) {
	    cmd = &cmds[i];
	    printf("\"%s\" ", cmd->ac_name);
	}
	printf("as argument.\n");

	return -1;
}