X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.c;h=ec822c82978d78649b6641d2206f41db44ab3bd7;hp=e051aae4e627ac1b3ef5f30581700cb9af432928;hb=24758c5f;hpb=c9df5dfaa915915e0717c1992bc8498f6432dba8 diff --git a/command.c b/command.c index e051aae4..ec822c82 100644 --- a/command.c +++ b/command.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2012 Andre Noll + * Copyright (C) 1997-2013 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -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(¤t_time, NULL); + clock_get_realtime(¤t_time); /* * The calls to WRITE_STATUS_ITEM() below never fail because * b->max_size is zero (unlimited), see para_printf(). However, clang @@ -259,6 +258,14 @@ __printf_3_4 int send_sb_va(struct stream_cipher_context *scc, int band, return send_sb(scc, msg, ret, band, false); } +/** + * Send an error message to a client. + * + * \param cc Client info. + * \param err The (positive) error code. + * + * \return The return value of the underlying call to send_sb_va(). + */ int send_strerror(struct command_context *cc, int err) { return cc->use_sideband? @@ -317,7 +324,7 @@ fail: return ret; } -int com_sender(struct command_context *cc) +static int com_sender(struct command_context *cc) { int i, ret = 0; char *msg = NULL; @@ -374,7 +381,7 @@ int com_sender(struct command_context *cc) } /* server info */ -int com_si(struct command_context *cc) +static int com_si(struct command_context *cc) { int i, ret; char *msg, *ut, *sender_info = NULL; @@ -403,7 +410,7 @@ 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); @@ -417,7 +424,7 @@ int com_si(struct command_context *cc) } /* version */ -int com_version(struct command_context *cc) +static int com_version(struct command_context *cc) { char *msg; size_t len; @@ -498,7 +505,7 @@ out: #undef EMPTY_STATUS_ITEMS /* stat */ -int com_stat(struct command_context *cc) +static int com_stat(struct command_context *cc) { int i, ret; struct misc_meta_data tmp, *nmmd = &tmp; @@ -608,7 +615,7 @@ static struct server_command *get_cmd_ptr(const char *name, char **handler) } /* help */ -int com_help(struct command_context *cc) +static int com_help(struct command_context *cc) { struct server_command *cmd; char *perms, *handler, *buf; @@ -647,7 +654,7 @@ int com_help(struct command_context *cc) } /* hup */ -int com_hup(struct command_context *cc) +static int com_hup(struct command_context *cc) { if (cc->argc != 1) return -E_COMMAND_SYNTAX; @@ -656,7 +663,7 @@ int com_hup(struct command_context *cc) } /* term */ -int com_term(struct command_context *cc) +static int com_term(struct command_context *cc) { if (cc->argc != 1) return -E_COMMAND_SYNTAX; @@ -664,7 +671,7 @@ int com_term(struct command_context *cc) return 1; } -int com_play(struct command_context *cc) +static int com_play(struct command_context *cc) { if (cc->argc != 1) return -E_COMMAND_SYNTAX; @@ -676,7 +683,7 @@ int com_play(struct command_context *cc) } /* stop */ -int com_stop(struct command_context *cc) +static int com_stop(struct command_context *cc) { if (cc->argc != 1) return -E_COMMAND_SYNTAX; @@ -689,7 +696,7 @@ int com_stop(struct command_context *cc) } /* pause */ -int com_pause(struct command_context *cc) +static int com_pause(struct command_context *cc) { if (cc->argc != 1) return -E_COMMAND_SYNTAX; @@ -704,7 +711,7 @@ int com_pause(struct command_context *cc) } /* next */ -int com_next(struct command_context *cc) +static int com_next(struct command_context *cc) { if (cc->argc != 1) return -E_COMMAND_SYNTAX; @@ -716,7 +723,7 @@ int com_next(struct command_context *cc) } /* nomore */ -int com_nomore(struct command_context *cc) +static int com_nomore(struct command_context *cc) { if (cc->argc != 1) return -E_COMMAND_SYNTAX; @@ -728,7 +735,7 @@ int com_nomore(struct command_context *cc) } /* ff */ -int com_ff(struct command_context *cc) +static int com_ff(struct command_context *cc) { long promille; int ret, backwards = 0; @@ -767,7 +774,7 @@ out: } /* jmp */ -int com_jmp(struct command_context *cc) +static int com_jmp(struct command_context *cc) { long unsigned int i; int ret; @@ -984,7 +991,7 @@ __noreturn void handle_connect(int fd, const char *peername) /* send Welcome message */ ret = write_va_buffer(fd, "This is para_server, version " PACKAGE_VERSION ".\n" - "Features: sideband,foo\n" + "Features: sideband\n" ); if (ret < 0) goto net_err;