]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - command.c
Don't include $codename in ggo version string.
[paraslash.git] / command.c
index d4955fb696d7ff88c6f6fd1d263fbf025bcaca73..4bbf494c869b6938b596dbf9dcf45b9613fbf924 100644 (file)
--- a/command.c
+++ b/command.c
@@ -8,7 +8,6 @@
 
 #include <regex.h>
 #include <signal.h>
-#include <sys/time.h>
 #include <sys/types.h>
 #include <osl.h>
 
@@ -124,7 +123,7 @@ static unsigned get_status(struct misc_meta_data *nmmd, int parser_friendly,
                localtime_r(&nmmd->mtime, &mtime_tm);
                strftime(mtime, 29, "%b %d %Y", &mtime_tm);
        }
-       gettimeofday(&current_time, NULL);
+       clock_get_realtime(&current_time);
        /*
         * The calls to WRITE_STATUS_ITEM() below never fail because
         * b->max_size is zero (unlimited), see para_printf(). However, clang
@@ -384,7 +383,8 @@ static int com_si(struct command_context *cc)
                free(info);
        }
        ut = get_server_uptime_str(now);
-       ret = xasprintf(&msg, "version: " GIT_VERSION "\n"
+       ret = xasprintf(&msg,
+               "version: %s\n"
                "up: %s\nplayed: %u\n"
                "server_pid: %d\n"
                "afs_pid: %d\n"
@@ -392,6 +392,7 @@ static int com_si(struct command_context *cc)
                "current loglevel: %s\n"
                "supported audio formats: %s\n"
                "%s",
+               version_git(),
                ut, mmd->num_played,
                (int)getppid(),
                (int)mmd->afs_pid,
@@ -399,7 +400,7 @@ static int com_si(struct command_context *cc)
                mmd->num_commands,
                mmd->num_connects,
                conf.loglevel_arg,
-               SERVER_AUDIO_FORMATS,
+               AUDIO_FORMAT_HANDLERS,
                sender_info
        );
        mutex_unlock(mmd_mutex);
@@ -416,10 +417,8 @@ static int com_version(struct command_context *cc)
 
        if (cc->argc != 1)
                return -E_COMMAND_SYNTAX;
-       msg = VERSION_TEXT("server") "built: " BUILD_DATE "\n" UNAME_RS
-               ", " CC_VERSION "\n";
-       len = strlen(msg);
-       return send_sb(&cc->scc, msg, len, SBD_OUTPUT, true);
+       len = xasprintf(&msg, "%s", version_text("server"));
+       return send_sb(&cc->scc, msg, len, SBD_OUTPUT, false);
 }
 
 #define EMPTY_STATUS_ITEMS \
@@ -457,11 +456,8 @@ static int com_version(struct command_context *cc)
  */
 static unsigned empty_status_items(int parser_friendly, char **result)
 {
-       static char *esi;
-       static unsigned len;
-
-       if (esi)
-               goto out;
+       char *esi;
+       unsigned len;
 
        if (parser_friendly)
                len = xasprintf(&esi,
@@ -481,7 +477,6 @@ static unsigned empty_status_items(int parser_friendly, char **result)
                        EMPTY_STATUS_ITEMS
                        #undef ITEM
                );
-out:
        *result = esi;
        return len;
 }
@@ -492,7 +487,7 @@ static int com_stat(struct command_context *cc)
 {
        int i, ret;
        struct misc_meta_data tmp, *nmmd = &tmp;
-       char *s, *esi = NULL;
+       char *s;
        int32_t num = 0;
        int parser_friendly = 0;
 
@@ -527,8 +522,9 @@ static int com_stat(struct command_context *cc)
                if (ret < 0)
                        goto out;
                if (nmmd->vss_status_flags & VSS_NEXT) {
+                       char *esi;
                        ret = empty_status_items(parser_friendly, &esi);
-                       ret = send_sb(&cc->scc, esi, ret, SBD_OUTPUT, true);
+                       ret = send_sb(&cc->scc, esi, ret, SBD_OUTPUT, false);
                        if (ret < 0)
                                goto out;
                } else
@@ -542,7 +538,6 @@ static int com_stat(struct command_context *cc)
                        goto out;
        }
 out:
-       free(esi);
        return ret;
 }