Exemple #1
0
// this function implements the main admin loop of pict-o-crypt,
// where we wait for and then process administrative commands.
static
void
main_run_admin(void)
{
    bool ready;
    bool autoend;
    static int first;

    // we just poll here waiting for commands
    for (;;) {
        terminal_poll();

        ready = 0;
        autoend = false;
        if (main_command) {
            terminal_poll();
            if (terminal_echo) {
                printf("\n");
            }
            admin_run(main_command);
            ready = 1;
        }

        if (autoend || ready) {
            if (! first) {
                printf(" \n"); delay(1);  // revisit -- why???
                admin_run("help about");
                first = 1;
            }
            printf("> ");
        }

        if (ready) {
            ready = 0;
            if (main_command) {
                main_command = NULL;
                terminal_command_ack(false);
            }
        }
    }
}
int main() {
	admin_run();
	return 0;
}