the paraslash-0.2.11 release tarball
[paraslash.git] / command.c
index 3fe6e5d..d317c34 100644 (file)
--- a/command.c
+++ b/command.c
@@ -44,7 +44,7 @@ static unsigned char rc4_buf[2 * RC4_KEY_LEN];
 extern const char *status_item_list[NUM_STAT_ITEMS];
 extern struct misc_meta_data *mmd;
 extern struct gengetopt_args_info conf;
-extern struct dbtool dblist[];
+extern struct audio_file_selector dblist[];
 extern struct audio_format afl[];
 extern struct sender senders[];
 extern char *user_list;
@@ -63,7 +63,7 @@ static int com_stop(int, int, char **);
 static int com_pause(int, int, char **);
 static int com_next(int, int, char **);
 static int com_nomore(int, int, char **);
-static int com_cdt(int, int, char **);
+static int com_chs(int, int, char **);
 static int com_ff(int, int, char **);
 static int com_jmp(int, int, char **);
 static int com_sender(int, int, char **);
@@ -72,14 +72,14 @@ static int com_sender(int, int, char **);
 /* commands that are handled by the server itself */
 static struct server_command cmd_struct[] = {
 {
-.name = "cdt",
-.handler = com_cdt,
+.name = "chs",
+.handler = com_chs,
 .perms = DB_READ | DB_WRITE,
-.description = "change database tool",
-.synopsis = "cdt [name_of_new_dbtool]",
+.description = "change the current audio file selector",
+.synopsis = "chs [new_selector]",
 .help =
-"Deactivate current dbtool and activate name_of_new_dbtool. If no\n"
-"argument was given, print the current database tool.\n"
+"Shutdown the current selector and activate new_selector. If no\n"
+"argument was given, print the name of the current selector.\n"
 },
 
 {
@@ -426,11 +426,11 @@ static char *get_status(struct misc_meta_data *nmmd)
                status_item_list[SI_STATUS_BAR], bar ? bar : "(none)",
                status_item_list[SI_STATUS], status,
                status_item_list[SI_STATUS_FLAGS], flags,
-               status_item_list[SI_DBTOOL], dblist[nmmd->dbt_num].name,
+               status_item_list[SI_SELECTOR], dblist[nmmd->selector_num].name,
 
                status_item_list[SI_OFFSET], offset,
                status_item_list[SI_FORMAT], audio_format_name(nmmd->audio_format),
-               nmmd->dbinfo,
+               nmmd->selector_info,
                nmmd->audio_file_info,
 
                status_item_list[SI_UPTIME], ut,
@@ -559,15 +559,15 @@ static int com_si(int fd, int argc, __unused char **argv)
 {
        int i, ret;
        char *ut;
-       char *dbtools = NULL, *sender_info = NULL, *sender_list = NULL;
+       char *selectors = NULL, *sender_info = NULL, *sender_list = NULL;
        struct mallinfo mi = mallinfo();
 
        if (argc)
                return -E_COMMAND_SYNTAX;
        mmd_lock();
        for (i = 0; dblist[i].name; i++) {
-               dbtools = para_strcat(dbtools, dblist[i].name);
-               dbtools = para_strcat(dbtools, " ");
+               selectors = para_strcat(selectors, dblist[i].name);
+               selectors = para_strcat(selectors, " ");
        }
        for (i = 0; senders[i].name; i++) {
                char *info = senders[i].info();
@@ -582,7 +582,7 @@ static int com_si(int fd, int argc, __unused char **argv)
                "mallinfo: %d\n"
                "connections (active/accepted/total): %u/%u/%u\n"
                "current loglevel: %i\n"
-               "supported database tools: %s\n"
+               "supported audio file selectors: %s\n"
                "supported audio formats: %s\n"
                "supported senders: %s\n"
                "%s",
@@ -593,14 +593,14 @@ static int com_si(int fd, int argc, __unused char **argv)
                mmd->num_commands,
                mmd->num_connects,
                conf.loglevel_arg,
-               dbtools,
+               selectors,
                SUPPORTED_AUDIO_FORMATS,
                sender_list,
                sender_info
        );
        mmd_unlock();
        free(ut);
-       free(dbtools);
+       free(selectors);
        free(sender_list);
        free(sender_info);
        return ret;
@@ -676,7 +676,6 @@ static int com_sb(int socket_fd, int argc, char **argv)
 /* stat */
 static int com_stat(int socket_fd, int argc, char **argv)
 {
-//     char *old_stat = NULL, *old_dbinfo = NULL;
        int ret, num = 0;/* status will be printed that many
                          * times. num <= 0 means: print forever
                          */
@@ -732,11 +731,12 @@ static struct server_command *get_cmd_ptr(char *name, char **handler)
                                *handler = para_strdup("para_server"); /* server commands */
                        return cmd;
                }
-       /* not found, look for dbtool commands */
+       /* not found, look for commands supported by the current selector */
        mmd_lock();
        if (handler)
-               *handler = make_message("the %s database tool", dblist[mmd->dbt_num].name);
-       cmd = dblist[mmd->dbt_num].cmd_list;
+               *handler = make_message("the %s selector",
+                       dblist[mmd->selector_num].name);
+       cmd = dblist[mmd->selector_num].cmd_list;
        mmd_unlock();
        for (; cmd->name; cmd++)
                if (!strcmp(cmd->name, name))
@@ -756,8 +756,8 @@ static int com_help(int fd, int argc, char **argv)
                if ((ret = send_description(fd, cmd_struct, "server", 0)) < 0)
                        return ret;
                mmd_lock();
-               handler = para_strdup(dblist[mmd->dbt_num].name);
-               cmd = dblist[mmd->dbt_num].cmd_list;
+               handler = para_strdup(dblist[mmd->selector_num].name);
+               cmd = dblist[mmd->selector_num].cmd_list;
                mmd_unlock();
                ret = send_description(fd, cmd, handler, 0);
                free(handler);
@@ -848,29 +848,29 @@ static int com_pause(__unused int socket_fd, int argc, __unused char **argv)
        return 1;
 }
 
-static int com_cdt(int fd, int argc, char **argv)
+static int com_chs(int fd, int argc, char **argv)
 {
        int i, ret;
 
        if (!argc) {
-               char *dbtool;
+               char *selector;
                mmd_lock();
-               dbtool = para_strdup(dblist[mmd->dbt_num].name);
+               selector = para_strdup(dblist[mmd->selector_num].name);
                mmd_unlock();
-               ret = send_va_buffer(fd, "%s\n", dbtool);
-               free(dbtool);
+               ret = send_va_buffer(fd, "%s\n", selector);
+               free(selector);
                return ret;
        }
        for (i = 0; dblist[i].name; i++) {
                if (strcmp(dblist[i].name, argv[1]))
                        continue;
                mmd_lock();
-               mmd->dbt_change = i;
+               mmd->selector_change = i;
                mmd->events++;
                mmd_unlock();
                return 1;
        }
-       return -E_BAD_DBTOOL;
+       return -E_BAD_SELECTOR;
 }
 
 /* next */