From 6d0669d26f21eadd906e1ee05e85c7d1e55d94b7 Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Wed, 27 Mar 2013 13:53:54 +0200 Subject: [PATCH] client: Remove now obsolete client/interactive.[hc] files --- Makefile.am | 1 - client/interactive.c | 117 --------------------------------------------------- client/interactive.h | 34 --------------- 3 files changed, 152 deletions(-) delete mode 100644 client/interactive.c delete mode 100644 client/interactive.h diff --git a/Makefile.am b/Makefile.am index 4f92f85..4bc1e93 100644 --- a/Makefile.am +++ b/Makefile.am @@ -234,7 +234,6 @@ client_connmanctl_SOURCES = $(gdbus_sources) src/connman.h \ client/data_manager.h client/data_manager.c \ client/services.h client/services.c \ client/technology.h client/technology.c \ - client/interactive.h client/interactive.c \ client/commands.h client/commands.c client/main.c \ client/input.h client/input.c diff --git a/client/interactive.c b/client/interactive.c deleted file mode 100644 index 7989a01..0000000 --- a/client/interactive.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * - * Connection Manager - * - * Copyright (C) 2012 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "services.h" -#include "technology.h" -#include "data_manager.h" -#include "interactive.h" - -static DBusConnection *interactive_conn; - -static gboolean rl_handler(char *input) -{ - char **long_args = NULL; - int num_args, error; - num_args = 0; - - if (input == NULL) { - rl_newline(1, '\n'); - exit(EXIT_FAILURE); - } - - add_history(input); - long_args = g_strsplit(input, " ", 0); - - if (long_args == NULL || long_args[0] == NULL) { - g_strfreev(long_args); - free(input); - return FALSE; - } - - for (num_args = 0; long_args[num_args] != NULL; num_args++); - - error = commands(interactive_conn, long_args, num_args); - - if ((strcmp(long_args[0], "quit") == 0) - || (strcmp(long_args[0], "exit") == 0) - || (strcmp(long_args[0], "q") == 0)) { - g_strfreev(long_args); - exit(EXIT_SUCCESS); - } - if (error == -1) { - fprintf(stderr, "%s is not a valid command, check help.\n", - long_args[0]); - } - - g_strfreev(long_args); - optind = 0; - - return TRUE; -} - -static gboolean readmonitor(GIOChannel *channel, GIOCondition condition, - gpointer user_data){ - if (condition & (G_IO_HUP | G_IO_ERR | G_IO_NVAL)) { - g_io_channel_unref(channel); - return FALSE; - } - rl_callback_read_char(); - return TRUE; -} - -void show_interactive(DBusConnection *connection, GMainLoop *mainloop) -{ - GIOChannel *gchan; - int events; - gchan = g_io_channel_unix_new(fileno(stdin)); - events = G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL; - interactive_conn = connection; - - while (TRUE) { - g_io_add_watch(gchan, events, readmonitor, NULL); - rl_callback_handler_install("connmanctl> ", (void *)rl_handler); - g_main_loop_run(mainloop); - - rl_callback_handler_remove(); - g_io_channel_unref(gchan); - } -} diff --git a/client/interactive.h b/client/interactive.h deleted file mode 100644 index 394882d..0000000 --- a/client/interactive.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * - * Connection Manager - * - * Copyright (C) 2012 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include - -extern DBusConnection *connection; - -void show_interactive(DBusConnection *connection, GMainLoop *mainloop); -int commands(DBusConnection *connection, char *argv[], int argc); -int commands_no_options(DBusConnection *connection, char *argv[], int argc); -int commands_options(DBusConnection *connection, char *argv[], int argc); -int monitor_switch(int argc, char *argv[], int c, DBusConnection *conn); -int config_switch(int argc, char *argv[], int c, DBusConnection *conn); -int service_switch(int argc, char *argv[], int c, DBusConnection *conn, - struct service_data *service); -- 2.7.4