char *ret = NULL;
list_for_each_entry_safe(ai, tmp_ai, acl, node) {
- char *tmp = make_message("%s%s/%u ", ret? ret : "",
+ char *tmp = msg("%s%s/%u ", ret? ret : "",
inet_ntoa(ai->addr), ai->netmask);
free(ret);
ret = tmp;
PARA_ERROR_LOG("failed to fstat fd %d (%s)\n", input_fd, name);
return ret;
}
- tmp_name = make_message("%s.XXXXXX", name);
+ tmp_name = msg("%s.XXXXXX", name);
ret = mkstemp(tmp_name);
if (ret < 0) {
ret = -ERRNO_TO_PARA_ERROR(errno);
if (ret < 0)
goto out;
if (OPT_GIVEN(BACKUP)) {
- char *backup_name = make_message("%s~", name);
+ char *backup_name = msg("%s~", name);
ret = xrename(name, backup_name);
free(backup_name);
if (ret < 0)
*result = NULL;
if (!strcmp(cmd, "seconds_total")) {
- *result = make_message("%" PRIu32, pard->afhi.seconds_total);
+ *result = msg("%" PRIu32, pard->afhi.seconds_total);
return 1;
}
if (!strcmp(cmd, "chunks_total")) {
- *result = make_message("%" PRIu32, pard->afhi.chunks_total);
+ *result = msg("%" PRIu32, pard->afhi.chunks_total);
return 1;
}
if (!strcmp(cmd, "afhi")) {
{
enum play_mode mode;
int ret;
- char *msg;
+ char *errmsg;
if (!arg) { /* load dummy mood */
- ret = mood_load(NULL, NULL, &msg);
+ ret = mood_load(NULL, NULL, &errmsg);
mode = PLAY_MODE_MOOD;
} else if (!strncmp(arg, "p/", 2)) {
- ret = playlist_load(arg + 2, NULL, &msg);
+ ret = playlist_load(arg + 2, NULL, &errmsg);
mode = PLAY_MODE_PLAYLIST;
} else if (!strncmp(arg, "m/", 2)) {
- ret = mood_load(arg + 2, NULL, &msg);
+ ret = mood_load(arg + 2, NULL, &errmsg);
mode = PLAY_MODE_MOOD;
} else {
ret = -ERRNO_TO_PARA_ERROR(EINVAL);
- msg = make_message("%s: parse error\n", arg);
+ errmsg = msg("%s: parse error\n", arg);
}
if (pb)
- para_printf(pb, "%s", msg);
- free(msg);
+ para_printf(pb, "%s", errmsg);
+ free(errmsg);
if (ret < 0)
return ret;
current_play_mode = mode;
database_dir = para_strdup(OPT_STRING_VAL(AFS_DATABASE_DIR));
else {
char *home = para_homedir();
- database_dir = make_message(
- "%s/.paraslash/afs_database-0.7", home);
+ database_dir = msg("%s/.paraslash/afs_database-0.7",
+ home);
free(home);
}
}
continue;
if (!strcmp(entry->d_name, ".."))
continue;
- tmp = make_message("%s/%s", dirname, entry->d_name);
+ tmp = msg("%s/%s", dirname, entry->d_name);
ret = 0;
if (lstat(tmp, &s) != -1) {
if (S_ISREG(s.st_mode))
static int alsa_mix_open(const char *dev, struct mixer_handle **handle)
{
int ret;
- char *msg;
+ char *err;
struct mixer_handle *h;
PARA_INFO_LOG("snd_mixer_{open,attach,register,load}\n");
h->card = para_strdup(dev? dev : "hw:0");
ret = snd_mixer_open(&h->mixer, 0);
if (ret < 0) {
- msg = make_message("snd_mixer_open() failed: %s",
- snd_strerror(ret));
+ err = msg("snd_mixer_open() failed: %s", snd_strerror(ret));
goto fail;
}
ret = snd_mixer_attach(h->mixer, h->card);
if (ret < 0) {
- msg = make_message("mixer attach error (%s): %s", h->card,
+ err = msg("mixer attach error (%s): %s", h->card,
snd_strerror(ret));
goto fail;
}
ret = snd_mixer_selem_register(h->mixer, NULL, NULL);
if (ret < 0) {
- msg = make_message("mixer register error (%s): %s", h->card,
+ err = msg("mixer register error (%s): %s", h->card,
snd_strerror(ret));
goto fail;
}
ret = snd_mixer_load(h->mixer);
if (ret < 0) {
- msg = make_message("mixer load error (%s): %s", h->card,
+ err = msg("mixer load error (%s): %s", h->card,
snd_strerror(ret));
goto fail;
}
*handle = h;
return 1;
fail:
- PARA_NOTICE_LOG("%s\n", msg);
- free(msg);
+ PARA_NOTICE_LOG("%s\n", err);
+ free(err);
alsa_mix_close(&h);
return -E_ALSA_MIX_OPEN;
}
continue;
snd_mixer_selem_get_id(elem, sid);
name = snd_mixer_selem_id_get_name(sid);
- list = make_message("%s%s%s",
+ list = msg("%s%s%s",
list? list : "",
list? ", " : "",
name);
PARA_DEBUG_LOG("name: %s: %s\n", info->short_name, info->name);
PARA_DEBUG_LOG("priority: %d\n", info->priority);
for (j = 0; j < info->option_count; j++) {
- tmp = make_message("%s%s%s", keys? keys : "",
+ tmp = msg("%s%s%s", keys? keys : "",
keys? ", " : "",
info->options[j]);
free(keys);
if (ret < 0)
goto err;
if (*text) {
- char *tmp = make_message("%s%s%s", *text, delim, (char *)obj.data);
+ char *tmp = msg("%s%s%s", *text, delim, (char *)obj.data);
free(*text);
*text = tmp;
} else
history_file = para_strdup(OPT_STRING_VAL(HISTORY_FILE));
else {
char *home = para_homedir();
- history_file = make_message("%s/.paraslash/audioc.history",
+ history_file = msg("%s/.paraslash/audioc.history",
home);
free(home);
}
socket_name = para_strdup(OPT_STRING_VAL(SOCKET));
else {
char *hn = para_hostname();
- socket_name = make_message("/var/paraslash/audiod_socket.%s",
+ socket_name = msg("/var/paraslash/audiod_socket.%s",
hn);
free(hn);
}
int slot_num = get_play_time_slot_num();
struct slot_info *s = slot_num < 0? NULL : &slot[slot_num];
bool writer_active = s && s->wns && s->wns[0].btrn;
- char *msg;
+ char *result;
if (audiod_status == AUDIOD_OFF)
goto empty;
out:
seconds = PARA_MIN(seconds, length);
seconds = PARA_MAX(seconds, 0);
- msg = make_message(
+ result = msg(
"%s%d:%02d [%d:%02d] (%d%%/%d:%02d)",
s? "" : "~",
seconds / 60,
length / 60,
length % 60
);
- //PARA_DEBUG_LOG("slot %d: %s\n", slot_num, msg);
- return msg;
+ return result;
empty:
return para_strdup(NULL);
}
goto out;
}
/* add "dec" to audio format name */
- tmp = make_message("%sdec", audio_formats[i]);
+ tmp = msg("%sdec", audio_formats[i]);
for (j = 1; filter_get(j); j++)
if (!strcmp(tmp, filter_name(j)))
break;
socket_name = para_strdup(OPT_STRING_VAL(SOCKET));
else {
char *hn = para_hostname();
- socket_name = make_message("/var/paraslash/audiod_socket.%s",
+ socket_name = msg("/var/paraslash/audiod_socket.%s",
hn);
free(hn);
}
int ret = lls(lls_check_arg_count(lpr, 0, 1, &errctx));
if (ret < 0) {
- char *tmp = make_message("%s\n", errctx);
+ char *tmp = msg("%s\n", errctx);
free(errctx);
client_write(fd, tmp);
free(tmp);
return ret;
}
if (lls_num_inputs(lpr) == 0) {
- char *msg;
+ char *tmp;
ll = daemon_get_loglevel();
- msg = make_message("%s\n", sev[ll]);
- ret = client_write(fd, msg);
- free(msg);
+ tmp = msg("%s\n", sev[ll]);
+ ret = client_write(fd, tmp);
+ free(tmp);
return ret;
}
arg = lls_input(0, lpr);
static int com_version(int fd, struct lls_parse_result *lpr)
{
int ret;
- char *msg;
+ char *ver;
const struct lls_opt_result *r_v;
r_v = lls_opt_result(LSG_AUDIOD_CMD_VERSION_OPT_VERBOSE, lpr);
if (lls_opt_given(r_v))
- msg = make_message("%s", version_text("audiod"));
+ ver = msg("%s", version_text("audiod"));
else
- msg = make_message("%s\n", version_single_line("audiod"));
- ret = client_write(fd, msg);
- free(msg);
+ ver = msg("%s\n", version_single_line("audiod"));
+ ret = client_write(fd, ver);
+ free(ver);
return ret < 0? ret : 0;
}
EXPORT_AUDIOD_CMD_HANDLER(version)
if (ret < 0 && ret != -E_CLIENT_WRITE) {
char *tmp;
if (errctx) {
- tmp = make_message("%s\n", errctx);
+ tmp = msg("%s\n", errctx);
free(errctx);
client_write(clifd, tmp);
free(tmp);
}
- tmp = make_message("%s\n", para_strerror(-ret));
+ tmp = msg("%s\n", para_strerror(-ret));
client_write(clifd, tmp);
free(tmp);
}
return -E_BTR_NAVAIL;
}
}
- *result = make_message("%d", val);
+ *result = msg("%d", val);
return 1;
}
if (!orig_lpr)
orig_lpr = ct->lpr;
ct->lpr = NULL;
- cmdline = make_message("-- %s", line);
+ cmdline = msg("-- %s", line);
ret = create_shifted_argv(cmdline, " ", &argv);
free(cmdline);
if (ret < 0)
sl = arr_realloc(sl, 2 * num_atts + 1, sizeof(char *));
for (i = 0; i < num_atts; i++) {
char *orig = sl[i];
- sl[i] = make_message("%s+", orig);
- sl[num_atts + i] = make_message("%s-", orig);
+ sl[i] = msg("%s+", orig);
+ sl[num_atts + i] = msg("%s-", orig);
free(orig);
}
sl[2 * num_atts] = NULL;
n = num_moods + num_pl;
mops = arr_alloc(n + 1, sizeof(char *));
for (i = 0; i < num_moods; i++)
- mops[i] = make_message("m/%s", moods[i]);
+ mops[i] = msg("m/%s", moods[i]);
for (i = 0; i < num_pl; i++)
- mops[num_moods + i] = make_message("p/%s", playlists[i]);
+ mops[num_moods + i] = msg("p/%s", playlists[i]);
mops[n] = NULL;
i9e_extract_completions(ci->word, mops, &cr->matches);
free_argv(mops);
HISTORY_FILE, ct->lpr));
else {
char *home = para_homedir();
- ici.history_file = make_message("%s/.paraslash/client.history",
+ ici.history_file = msg("%s/.paraslash/client.history",
home);
free(home);
}
kf = para_strdup(CLIENT_OPT_STRING_VAL(KEY_FILE, lpr));
else {
struct stat statbuf;
- kf = make_message("%s/.paraslash/key.%s", home, user);
+ kf = msg("%s/.paraslash/key.%s", home, user);
if (stat(kf, &statbuf) != 0) { /* assume file does not exist */
free(kf);
- kf = make_message("%s/.ssh/id_rsa", home);
+ kf = msg("%s/.ssh/id_rsa", home);
}
}
PARA_INFO_LOG("user: %s\n", user);
if (!logfile_name)
return;
if (me->old_cwd && logfile_name[0] != '/')
- me->logfile_name = make_message("%s/%s", me->old_cwd,
+ me->logfile_name = msg("%s/%s", me->old_cwd,
logfile_name);
else
me->logfile_name = para_strdup(logfile_name);
__malloc char *daemon_get_uptime_str(const struct timeval *current_time)
{
long t = daemon_get_uptime(current_time);
- return make_message("%li:%02li:%02li", t / 86400,
- (t / 3600) % 24, (t / 60) % 60);
+ return msg("%li:%02li:%02li", t / 86400, (t / 3600) % 24, (t / 60) % 60);
}
/**
/* If CCID identifiable, present client as <host>#<port>~<ccid> */
tx_ccid = dccp_get_tx_ccid(sc->fd);
if (tx_ccid != -1) {
- char *tmp = make_message("%s~%d", sc->name, tx_ccid);
+ char *tmp = msg("%s~%d", sc->name, tx_ccid);
free(sc->name);
sc->name = tmp;
static char *dccp_status(void)
{
char *status = generic_sender_status(dss, "dccp");
- char *result = make_message("%ssupported ccids: %s\n", status,
+ char *result = msg("%ssupported ccids: %s\n", status,
dccp_list_available_ccids());
free(status);
return result;
char *result, *home = para_homedir();
srandom(clock_get_realtime(NULL)->tv_usec);
- result = make_message("%s/.paraslash/%08ld", home,
- para_random(99999999));
+ result = msg("%s/.paraslash/%08ld", home, para_random(99999999));
free(home);
return result;
}
cmd = FILTER_CMD(filter_num);
if (!filter_supported(filter_num)) {
ret = -E_UNSUPPORTED_FILTER;
- errctx = make_message("bad filter name: %s",
- lls_command_name(cmd));
+ errctx = msg("bad filter name: %s", lls_command_name(cmd));
goto free_argv;
}
ret = lls(lls_parse(argc, argv, cmd, lprp, &errctx));
if (!strcmp(cmd, "sample_rate")) {
if (sample_rate == 0)
return -E_BTR_NAVAIL;
- *result = make_message("%u", sample_rate);
+ *result = msg("%u", sample_rate);
return 1;
}
if (!strcmp(cmd, "channels")) {
if (channels == 0)
return -E_BTR_NAVAIL;
- *result = make_message("%u", channels);
+ *result = msg("%u", channels);
return 1;
}
if (!strcmp(cmd, "sample_format")) {
- *result = make_message("%d", DECODER_SAMPLE_FORMAT);
+ *result = msg("%d", DECODER_SAMPLE_FORMAT);
return 1;
}
return -ERRNO_TO_PARA_ERROR(ENOTSUP);
free_tags(&afhi->tags);
return ret;
}
- afhi->techinfo = make_message("blocksize: %u", pfad->blocksize);
+ afhi->techinfo = msg("blocksize: %u", pfad->blocksize);
afhi->seconds_total = DIV_ROUND_UP(afhi->chunks_total * pfad->blocksize,
afhi->frequency);
afhi->bitrate = pfad->map_bytes * 8 / afhi->seconds_total / 1024;
if (!curses_active() || !d.len || !c)
return;
- tmp = make_message("%s%s%s", d.prefix, c, d.postfix);
+ tmp = msg("%s%s%s", d.prefix, c, d.postfix);
wmove(top.win, d.y * top_lines / 100, d.x * COLS / 100);
wattron(top.win, COLOR_PAIR(i + 1));
align_str(top.win, tmp, d.len * COLS / 100, d.align);
{
char *file_and_args;
- file_and_args = make_message(BINDIR "/para_client -- %s", args);
+ file_and_args = msg(BINDIR "/para_client -- %s", args);
exec_and_display(file_and_args);
free(file_and_args);
}
static char *make_request_msg(void)
{
char *ret, *hn = para_hostname();
- ret = make_message("%s1.0\nHost: %s\nUser-Agent: para_recv/%s\n\n\n",
+ ret = msg("%s1.0\nHost: %s\nUser-Agent: para_recv/%s\n\n\n",
HTTP_GET_MSG, hn, PACKAGE_VERSION);
free(hn);
return ret;
cf = para_strdup(path);
else {
char *home = para_homedir();
- cf = make_message("%s/.paraslash/%s", home, dflt);
+ cf = msg("%s/.paraslash/%s", home, dflt);
free(home);
}
ret = mmap_full_file(cf, O_RDONLY, &map, &sz, NULL);
{
int ret, status, fds[3] = {0, 0, 0};
pid_t pid;
- char *cmdline = make_message("%s %s", exe, cmd);
+ char *cmdline = msg("%s %s", exe, cmd);
PARA_NOTICE_LOG("%s\n", cmdline);
ret = para_exec_cmdline_pid(&pid, cmdline, fds);
{
char *cmd;
- cmd = make_message("select %s", afs_mode);
+ cmd = msg("select %s", afs_mode);
client_cmd(cmd);
free(cmd);
}
if (!*mood_name) {
if (err)
- *err = make_message("empty mood name\n");
+ *err = msg("empty mood name\n");
return -ERRNO_TO_PARA_ERROR(EINVAL);
}
ret = mood_get_def_by_name(mood_name, &mood_def);
if (ret < 0) {
if (err)
- *err = make_message("could not read mood definition\n");
+ *err = msg("could not read mood definition\n");
return ret;
}
*m = alloc_new_mood(mood_name);
int mean_days, sigma_days;
if (n == 0)
- return make_message("no admissible files\n");
+ return msg("no admissible files\n");
mean_days = (sse - m->stats.last_played_sum / n) / 3600 / 24;
sigma_days = int_sqrt(m->stats.last_played_qd / n) / 3600 / 24;
- return make_message(
+ return msg(
"loaded mood %s (%u files)\n"
"last_played mean/sigma: %d/%d days\n"
"num_played mean/sigma: %" PRId64 "/%" PRIu64 "\n"
*
* \param mood_name The name of the mood to load.
* \param result Opaque, refers to the mood parser and the score table.
- * \param msg Error message or mood info is returned here.
+ * \param errmsg Error message or mood info is returned here.
*
* If the mood name is NULL, the dummy mood is loaded. This mood regards every
* audio file as admissible.
*
* \sa \ref mp_eval_row().
*/
-int mood_load(const char *mood_name, struct mood_instance **result, char **msg)
+int mood_load(const char *mood_name, struct mood_instance **result, char **errmsg)
{
int i, ret;
struct admissible_array aa = {.size = 0};
struct timeval rnow;
if (mood_name) {
- ret = init_mood_parser(mood_name, &aa.m, msg);
+ ret = init_mood_parser(mood_name, &aa.m, errmsg);
if (ret < 0)
return ret;
} else /* load dummy mood */
PARA_NOTICE_LOG("computing statistics of admissible files\n");
ret = audio_file_loop(&aa, add_if_admissible);
if (ret < 0) {
- if (msg) /* false if we are called via the event handler */
- *msg = make_message("audio file loop failed\n");
+ if (errmsg) /* false if we are called via the event handler */
+ *errmsg = msg("audio file loop failed\n");
goto out;
}
clock_get_realtime(&rnow);
for (i = 0; i < aa.m->stats.num; i++) {
ret = add_to_score_table(aa.array[i], aa.m);
if (ret < 0) {
- if (msg)
- *msg = make_message(
+ if (errmsg)
+ *errmsg = msg(
"could not add row to score table\n");
goto out;
}
}
/* success */
- if (msg)
- *msg = get_statistics(aa.m, rnow.tv_sec);
+ if (errmsg)
+ *errmsg = get_statistics(aa.m, rnow.tv_sec);
ret = aa.m->stats.num;
if (result)
*result = aa.m;
char *tmp = (char *)get_utf8(id3_field_getstrings(field, k));
if (result) {
char *tmp2 = result;
- result = make_message("%s %s", tmp2, tmp);
+ result = msg("%s %s", tmp2, tmp);
free(tmp);
free(tmp2);
} else
tv2ms(&afhi->chunk_tv));
set_max_chunk_size(afhi);
ret = mp3_get_id3(map, numbytes, fd, &afhi->tags);
- afhi->techinfo = make_message("%cbr, %s, %s tags", vbr? 'v' : 'c',
+ afhi->techinfo = msg("%cbr, %s, %s tags", vbr? 'v' : 'c',
header_mode(&header), tag_versions[ret]);
return 1;
err_out:
int url_port;
if (!url)
- return make_message("0.0.0.0:%d", default_port);
+ return msg("0.0.0.0:%d", default_port);
if (!parse_url(url, host, sizeof(host), &url_port))
- return make_message("?");
+ return msg("?");
if (url_port < 0)
- return make_message("%s:%d", url, default_port);
+ return msg("%s:%d", url, default_port);
else
return para_strdup(url);
}
if (ret < 0)
return ret;
afhi->channels = oh->channels;
- afhi->techinfo = make_message(
+ afhi->techinfo = msg(
"header version %d, input sample rate: %" PRIu32 "Hz",
oh->version, oh->input_sample_rate);
/*
FOR_EACH_CHANNEL(i) {
const char *name = channels[i].name;
char *tmp = list;
- list = make_message("%s%s%s",
+ list = msg("%s%s%s",
list? list : "",
list? ", " : "",
name);
free(pt->afhi_txt);
ret = btr_exec_up(pt->rn.btrn, "afhi", &pt->afhi_txt);
if (ret < 0)
- pt->afhi_txt = make_message("[afhi command failed]\n");
+ pt->afhi_txt = msg("[afhi command failed]\n");
ret = btr_exec_up(pt->rn.btrn, "seconds_total", &tmp);
if (ret < 0)
pt->seconds = 1;
return 0;
/* set up decoding filter */
af = audio_format_name(pt->audio_format_num);
- tmp = make_message("%sdec", af);
+ tmp = msg("%sdec", af);
ret = filter_setup(tmp, &pt->fn.conf, &filter_lpr);
freep(&tmp);
if (ret < 0)
history_file = para_strdup(OPT_STRING_VAL(HISTORY_FILE));
else {
char *home = para_homedir();
- char *dot_para = make_message("%s/.paraslash", home);
+ char *dot_para = msg("%s/.paraslash", home);
free(home);
ret = para_mkdir(dot_para);
if (ret < 0)
PARA_WARNING_LOG("Can not create %s: %s\n", dot_para,
para_strerror(-ret));
- history_file = make_message("%s/play.history", dot_para);
+ history_file = msg("%s/play.history", dot_para);
free(dot_para);
}
ici.history_file = history_file;
*
* \param name The name of the playlist to load.
* \param result Opaque, refers to the underlying score table.
- * \param msg Error message or playlist info is returned here.
+ * \param errmsg Error message or playlist info is returned here.
*
* \return The length of the loaded playlist on success, negative error code
* else. Files which are listed in the playlist, but are not contained in the
* database are ignored. This is not considered an error.
*/
-int playlist_load(const char *name, struct playlist_instance **result, char **msg)
+int playlist_load(const char *name, struct playlist_instance **result, char **errmsg)
{
int ret;
struct playlist_instance *pi;
struct osl_object playlist_def;
if (!name || !*name) {
- if (msg)
- *msg = make_message("empty playlist name\n");
+ if (errmsg)
+ *errmsg = msg("empty playlist name\n");
return -ERRNO_TO_PARA_ERROR(EINVAL);
}
ret = pl_get_def_by_name(name, &playlist_def);
if (pi->length == 0)
goto close_score_table;
/* success */
- if (msg)
- *msg = make_message("loaded playlist %s (%u files)\n", name,
+ if (errmsg)
+ *errmsg = msg("loaded playlist %s (%u files)\n", name,
pi->length);
pi->name = para_strdup(name);
if (result) {
free(pi);
err:
PARA_NOTICE_LOG("unable to load playlist %s\n", name);
- if (msg)
- *msg = make_message("unable to load playlist %s\n", name);
+ if (errmsg)
+ *errmsg = msg("unable to load playlist %s\n", name);
return ret;
}
char *get_task_list(struct sched *s)
{
struct task *t, *tmp;
- char *msg = NULL;
+ char *result = NULL;
list_for_each_entry_safe(t, tmp, &s->task_list, node) {
char *tmp_msg;
- tmp_msg = make_message("%s%p\t%s\t%s\n", msg? msg : "", t,
+ tmp_msg = msg("%s%p\t%s\t%s\n", result? result : "", t,
t->status == TS_DEAD? "dead" :
(t->status == TS_RUNNING? "running" : "zombie"),
t->name);
- free(msg);
- msg = tmp_msg;
+ free(result);
+ result = tmp_msg;
}
- return msg;
+ return result;
}
/**
char *acl_contents = acl_get_contents(&ss->acl);
list_for_each_entry_safe(sc, tmp_sc, &ss->client_list, node) {
- char *tmp = make_message("%s%s ", clnts? clnts : "", sc->name);
+ char *tmp = msg("%s%s ", clnts? clnts : "", sc->name);
free(clnts);
clnts = tmp;
}
FOR_EACH_LISTEN_FD(n, ss) {
char *url = format_url(ss->listen_addresses[n], ss->default_port);
- char *tmp = make_message("%s%s%s (fd %d)", addr?
+ char *tmp = msg("%s%s%s (fd %d)", addr?
addr : "", addr? ", " : "", url,
ss->listen_fds[n]);
free(url);
free(addr);
addr = tmp;
}
- ret = make_message(
+ ret = msg(
"listening address(es): %s\n"
"default port: %s\n"
"number of connected clients: %d\n"
*/
__malloc char *generic_sender_help(void)
{
- return make_message(
+ return msg(
"usage: {on|off}\n"
"usage: {allow|deny} IP[/netmask]\n"
" where mask defaults to 32\n"
user_list_file = para_strdup(OPT_STRING_VAL(USER_LIST));
else {
char *home = para_homedir();
- user_list_file = make_message("%s/.paraslash/server.users", home);
+ user_list_file = msg("%s/.paraslash/server.users", home);
free(home);
}
user_list_init(user_list_file);
afhi->channels = psd->shi.channels;
afhi->frequency = psd->shi.sample_rate;
afhi->bitrate = psd->shi.bitrate / 1000;
- afhi->techinfo = make_message("%s, v%d", psd->shi.mode->modeName,
+ afhi->techinfo = msg("%s, v%d", psd->shi.mode->modeName,
psd->shi.mode->bitstream_version);
return 1;
}
*
* \sa printf(3), \ref xasprintf().
*/
-__must_check __printf_1_2 __malloc char *make_message(const char *fmt, ...)
+__must_check __printf_1_2 __malloc char *msg(const char *fmt, ...)
{
char *msg;
va_list ap;
return para_strdup(b);
if (!b)
return a;
- tmp = make_message("%s%s", a, b);
+ tmp = msg("%s%s", a, b);
free(a);
return tmp;
}
* size-bound on \a b, i.e. if \p b->max_size is zero, this function never
* fails.
*
- * \sa make_message(), vsnprintf(3).
+ * \sa msg(), vsnprintf(3).
*/
__printf_2_3 int para_printf(struct para_buffer *b, const char *fmt, ...)
{
__printf_2_0 unsigned xvasprintf(char **result, const char *fmt, va_list ap);
__printf_2_3 unsigned xasprintf(char **result, const char *fmt, ...);
-__must_check __malloc __printf_1_2 char *make_message(const char *fmt, ...);
+__must_check __malloc __printf_1_2 char *msg(const char *fmt, ...);
__must_check __malloc char *para_strcat(char *a, const char *b);
__must_check __malloc char *para_logname(void);
__must_check __malloc char *para_homedir(void);
list_for_each_entry(sc, &targets, node) {
struct udp_target *ut = sc->private_data;
- char *tmp = make_message("%s%s/%u:%u ",
+ char *tmp = msg("%s%s/%u:%u ",
tgts ? : "", sc->name,
ut->fcp.data_slices_per_group,
ut->fcp.slices_per_group
free(tgts);
tgts = tmp;
}
- ret = make_message(
+ ret = msg(
"status: %s\n"
"port: %s\n"
"targets: %s\n",
static char *udp_help(void)
{
- return make_message(
+ return msg(
"usage: {on|off}\n"
"usage: {add|delete} ip_address[:port][/[packet_size:]k:n]\n"
" - k is the number of data slices per FEC group\n"
src_db_dir = para_strdup(OPT_STRING_VAL(SRC_DATABASE_DIR,
lpr));
else
- src_db_dir = make_message(
- "%s/.paraslash/afs_database-0.4", home);
+ src_db_dir = msg( "%s/.paraslash/afs_database-0.4", home);
if (OPT_GIVEN(DST_DATABASE_DIR, lpr))
dst_db_dir = para_strdup(OPT_STRING_VAL(DST_DATABASE_DIR,
lpr));
else
- dst_db_dir = make_message(
- "%s/.paraslash/afs_database-0.7", home);
+ dst_db_dir = msg( "%s/.paraslash/afs_database-0.7", home);
free(home);
- src_aft_dir = make_message("%s/audio_files", src_db_dir);
- dst_aft_dir = make_message("%s/audio-files", src_db_dir);
+ src_aft_dir = msg("%s/audio_files", src_db_dir);
+ dst_aft_dir = msg("%s/audio-files", src_db_dir);
PARA_NOTICE_LOG("source aft dir: %s\n", src_aft_dir);
PARA_NOTICE_LOG("destination aft dir: %s\n", dst_aft_dir);
}
pid_t pid;
int fds[3] = {-1, -1, -1}; /* no redirection of stdin/stdout/stderr */
int ret, wstatus;
- char *cmdline = make_message("rm -rf %s", src_aft_dir);
+ char *cmdline = msg("rm -rf %s", src_aft_dir);
PARA_NOTICE_LOG("removing %s\n", src_aft_dir);
ret = para_exec_cmdline_pid(&pid, cmdline, fds);
afhi->channels = ahi.channels;
afhi->header_len = ahi.header_len;
- afhi->techinfo = make_message("%s%s%s%s%s",
+ afhi->techinfo = msg("%s%s%s%s%s",
ahi.use_exp_vlc? "exp vlc" : "",
(ahi.use_bit_reservoir && ahi.use_exp_vlc)? ", " : "",
ahi.use_bit_reservoir? "bit reservoir" : "",
cmd = WRITE_CMD(writer_num);
if (!writer_supported(writer_num)) {
ret = -ERRNO_TO_PARA_ERROR(EINVAL);
- errctx = make_message("%s writer is not supported",
+ errctx = msg("%s writer is not supported",
lls_command_name(cmd));
goto free_argv;
}