Hi,

On Thu, 2012-08-23 at 11:30 -0700, Ceara Chewning wrote:
> +static void show_interactive_help(void)
> +{
> +fprintf(stdout, "\n\t\t\tWelcome to Connman interactive mode.\n\n"
> +"Helpful commands:\n"
> +"    services                     Display list of all services\n"
> +"    state                        Shows if the system is online or offline\n"
> +"    tech                         Current technology on the system\n"
> +"    scan                         Scan for new networks\n"
> +"    enable/disable <technology>  Enables/disables given technology\n"
> +"    connect/disconnect <service> Connect/disconnect to a given service\n"
> +"    help, h                      Show this menu\n"
> +"    quit, exit                Exit program\n");
> +}

Here you should not create a new set of commands for interactive mode.
Please exploit the fact that command line arguments are parsed in patch
6/8 and reuse the code in there.

> +void show_interactive(DBusConnection *connection)
> +{
> +     static char *input;
> +     char *token;
> +     show_interactive_help();
> +     while (TRUE) {
> +             input = readline("\r> ");
> +             token = strtok(input, " ");
> +
> +             if (token)
> +                     handle_commands(connection, token);

A nice return value from handle_commands indicating exit.

Cheers,

        Patrik

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to