* \sa send_standard_callback_request(), send_callback_request().
*/
int send_option_arg_callback_request(struct osl_object *options,
- int argc, const char **argv, callback_function *f,
+ int argc, char * const * const argv, callback_function *f,
struct osl_object *result)
{
char *p;
* \return The return value of the underlying call to
* send_option_arg_callback_request().
*/
-int send_standard_callback_request(int argc, const char **argv,
+int send_standard_callback_request(int argc, char * const * const argv,
callback_function *f, struct osl_object *result)
{
return send_option_arg_callback_request(NULL, argc, argv, f, result);
}
/* TODO load tables after init */
-int com_init(__a_unused int fd, int argc, const char **argv)
+int com_init(__a_unused int fd, int argc, char * const * const argv)
{
int i, j, ret;
if (argc == 1)
---
T: cat
N: cat@member@
-O: int com_cat@member@(int fd, int argc, char **argv);
+O: int com_cat@member@(int fd, int argc, char * const * const argv);
P: AFS_READ
D: FIXME
U: cat@member@ @member@_name
---
T: ls
N: ls@member@
-O: int com_ls@member@(int fd, int argc, char **argv);
+O: int com_ls@member@(int fd, int argc, char * const * const argv);
P: AFS_READ
D: FIXME
U: cat@member@ <pattern>
---
T: rm
N: rm@member@
-O: int com_rm@member@(int fd, int argc, char **argv);
+O: int com_rm@member@(int fd, int argc, char * const * const argv);
P: AFS_READ | AFS_WRITE
D: FIXME
U: rm@member@ @member@_name
---
T: mv
N: mv@member@
-O: int com_mv@member@(int fd, int argc, char **argv);
+O: int com_mv@member@(int fd, int argc, char * const * const argv);
P: AFS_READ | AFS_WRITE
D: FIXME
U: mv@member@ old_@member@_name new_@member@_name
__noreturn int afs_init(uint32_t cookie, int socket_fd);
int send_callback_request(callback_function *f, struct osl_object *query,
struct osl_object *result);
-int send_standard_callback_request(int argc, const char **argv,
+int send_standard_callback_request(int argc, char * const * const argv,
callback_function *f, struct osl_object *result);
int send_option_arg_callback_request(struct osl_object *options,
- int argc, const char **argv, callback_function *f,
+ int argc, char * const * const argv, callback_function *f,
struct osl_object *result);
int stdin_command(struct osl_object *arg_obj, callback_function *f,
unsigned max_len, struct osl_object *result);
* full list: list everything, including afsi, afhi, atts as clear text
*
* */
-int com_afs_ls(int fd, int argc, const char **argv)
+int com_afs_ls(int fd, int argc, char * const * const argv)
{
int i, ret;
unsigned flags = 0;
return ret;
}
-int com_add(int fd, int argc, char **argv)
+int com_add(int fd, int argc, char * const * const argv)
{
int i, ret;
struct private_add_data pad = {.fd = fd, .flags = 0};
return 1;
}
-int com_touch(__a_unused int fd, int argc, const char **argv)
+int com_touch(__a_unused int fd, int argc, char * const * const argv)
{
struct com_touch_options cto = {
.num_played = -1,
*
* */
-int com_afs_rm(__a_unused int fd, int argc, const char **argv)
+int com_afs_rm(__a_unused int fd, int argc, char * const * const argv)
{
struct com_rm_options cro = {.flags = 0};
struct osl_object options = {.data = &cro, .size = sizeof(cro)};
}
/* FIXME: Need callback */
-int com_lsatt(int fd, int argc, const char **argv)
+int com_lsatt(int fd, int argc, char * const * const argv)
{
struct private_laa_data pld = {.fd = fd, .flags = 0};
int i;
return 1;
}
-int com_setatt(__a_unused int fd, int argc, const char **argv)
+int com_setatt(__a_unused int fd, int argc, char * const * const argv)
{
if (argc < 2)
return -E_ATTR_SYNTAX;
return mood_reload();
}
-int com_addatt(__a_unused int fd, int argc, const char **argv)
+int com_addatt(__a_unused int fd, int argc, char * const * const argv)
{
if (argc < 2)
return -E_ATTR_SYNTAX;
return mood_reload();
}
-int com_rmatt(__a_unused int fd, int argc, const char **argv)
+int com_rmatt(__a_unused int fd, int argc, char * const * const argv)
{
if (argc < 2)
return -E_ATTR_SYNTAX;
return ret;
}
-static int com_lsblob(callback_function *f, int fd, int argc, const char **argv)
+static int com_lsblob(callback_function *f, int fd, int argc, char * const * const argv)
{
struct com_lsblob_options clbo = {.flags = 0};
struct osl_object query = {.data = &clbo, .size = sizeof(clbo)},
return osl_close_disk_object(&obj);
}
static int com_catblob(callback_function *f, int fd, int argc,
- const char **argv)
+ char * const * const argv)
{
struct osl_object cat_output = {.data = NULL};
int ret;
}
static int com_addblob(callback_function *f, __a_unused int fd, int argc,
- const char **argv)
+ char * const * const argv)
{
struct osl_object arg_obj;
}
static int com_rmblob(callback_function *f, __a_unused int fd, int argc,
- const char **argv)
+ char * const * const argv)
{
if (argc < 2)
return -E_MOOD_SYNTAX;
}
static int com_mvblob(callback_function *f, __a_unused int fd,
- int argc, const char **argv)
+ int argc, char * const * const argv)
{
if (argc != 3)
return -E_MOOD_SYNTAX;
{ \
return com_ ## cmd_name ## blob_callback(table_name ## _table, query, output); \
} \
- int com_ ## cmd_name ## cmd_prefix(__a_unused int fd, int argc, const char **argv) \
+ int com_ ## cmd_name ## cmd_prefix(int fd, int argc, char * const * const argv) \
{ \
return com_ ## cmd_name ## blob(com_ ## cmd_name ## cmd_prefix ## _callback, fd, argc, argv); \
}
return ret;
}
-static int check_sender_args(int argc, char **argv, struct sender_command_data *scd)
+static int check_sender_args(int argc, char * const * argv, struct sender_command_data *scd)
{
int i;
/* this has to match sender.h */
return 1;
}
-int com_sender(int fd, int argc, char **argv)
+int com_sender(int fd, int argc, char * const * argv)
{
int i, ret;
struct sender_command_data scd;
}
/* server info */
-int com_si(int fd, int argc, __a_unused char **argv)
+int com_si(int fd, int argc, __a_unused char * const * argv)
{
int i, ret;
char *ut;
}
/* version */
-int com_version(int fd, int argc, __a_unused char **argv)
+int com_version(int fd, int argc, __a_unused char * const * argv)
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
}
/* sc */
-int com_sc(int fd, int argc, char **argv)
+int com_sc(int fd, int argc, char * const * argv)
{
char *name = NULL;
int ret, old = 0, count = -1; /* print af change forever */
}
/* sb */
-int com_sb(int fd, int argc, char **argv)
+int com_sb(int fd, int argc, char * const * argv)
{
char *sb;
int ret, nr = -1; /* status bar will be printed that many
}
/* stat */
-int com_stat(int fd, int argc, char **argv)
+int com_stat(int fd, int argc, char * const * argv)
{
int ret, num = 0;/* status will be printed that many
* times. num <= 0 means: print forever
}
/* always returns string that must be freed by the caller in handler */
-static struct server_command *get_cmd_ptr(char *name, char **handler)
+static struct server_command *get_cmd_ptr(const char *name, char **handler)
{
struct server_command *cmd;
}
/* help */
-int com_help(int fd, int argc, char **argv)
+int com_help(int fd, int argc, char * const * argv)
{
struct server_command *cmd;
char *perms, *handler;
}
/* hup */
-int com_hup(__a_unused int fd, int argc, __a_unused char **argv)
+int com_hup(__a_unused int fd, int argc, __a_unused char * const * argv)
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
}
/* term */
-int com_term(__a_unused int fd, int argc, __a_unused char **argv)
+int com_term(__a_unused int fd, int argc, __a_unused char * const * argv)
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
return 1;
}
-int com_play(__a_unused int fd, int argc, __a_unused char **argv)
+int com_play(__a_unused int fd, int argc, __a_unused char * const * argv)
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
}
/* stop */
-int com_stop(__a_unused int fd, int argc, __a_unused char **argv)
+int com_stop(__a_unused int fd, int argc, __a_unused char * const * argv)
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
}
/* pause */
-int com_pause(__a_unused int fd, int argc, __a_unused char **argv)
+int com_pause(__a_unused int fd, int argc, __a_unused char * const * argv)
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
return 1;
}
-int com_chs(int fd, int argc, char **argv)
+int com_chs(int fd, int argc, char * const * argv)
{
int i, ret;
}
/* next */
-int com_next(__a_unused int fd, int argc, __a_unused char **argv)
+int com_next(__a_unused int fd, int argc, __a_unused char * const * argv)
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
}
/* nomore */
-int com_nomore(__a_unused int fd, int argc, __a_unused char **argv)
+int com_nomore(__a_unused int fd, int argc, __a_unused char * const * argv)
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
}
/* ff */
-int com_ff(__a_unused int fd, int argc, char **argv)
+int com_ff(__a_unused int fd, int argc, char * const * argv)
{
long promille;
int ret, backwards = 0;
}
/* jmp */
-int com_jmp(__a_unused int fd, int argc, char **argv)
+int com_jmp(__a_unused int fd, int argc, char * const * argv)
{
long unsigned int i;
int ret;
*
* \sa null(4), pipe(2), dup2(2), fork(2), exec(3)
*/
-static int para_exec(pid_t *pid, const char *file, char *const args[], int *fds)
+static int para_exec(pid_t *pid, const char *file, char *const *const args, int *fds)
{
int ret, in[2] = {-1, -1}, out[2] = {-1, -1}, err[2] = {-1, -1},
null = -1; /* ;) */
int para_exec_cmdline_pid(pid_t *pid, const char *cmdline, int *fds)
{
int argc, ret;
- char **argv, *tmp = para_strdup(cmdline);
+ char **argv;
+ char *tmp = para_strdup(cmdline);
if (!tmp)
exit(EXIT_FAILURE);
/*
* new attribute
*/
-int com_na(__a_unused int fd, int argc, char *argv[])
+int com_na(__a_unused int fd, int argc, char * const * argv)
{
char *q, *tmp;
int ret;
/*
* delete attribute
*/
-int com_da(__a_unused int fd, int argc, char *argv[])
+int com_da(__a_unused int fd, int argc, char * const * argv)
{
char *q, *tmp;
int ret;
}
/* stradd/pic_add */
-static int com_stradd_picadd(int fd, int argc, char *argv[])
+static int com_stradd_picadd(int fd, int argc, char * const * argv)
{
char *blob = NULL, *esc_blob = NULL, *q = NULL, *tmp = NULL;
const char *fmt, *del_fmt;
}
/* stradd */
-int com_stradd(int fd, int argc, char *argv[])
+int com_stradd(int fd, int argc, char * const * argv)
{
return com_stradd_picadd(fd, argc, argv);
}
/* pic_add */
-int com_picadd(int fd, int argc, char *argv[])
+int com_picadd(int fd, int argc, char * const * argv)
{
return com_stradd_picadd(fd, argc, argv);
}
/*
* verbatim
*/
-int com_verb(int fd, int argc, char *argv[])
+int com_verb(int fd, int argc, char * const * argv)
{
void *result = NULL;
int ret;
/*
* list all attributes
*/
-int com_laa(int fd, int argc, __a_unused char *argv[])
+int com_laa(int fd, int argc, __a_unused char * const * argv)
{
void *result;
int ret;
/*
* history
*/
-int com_hist(int fd, int argc, char *argv[])
+int com_hist(int fd, int argc, char * const * argv)
{
int ret;
void *result = NULL;
/*
* get last num audio files
*/
-int com_last(int fd, int argc, char *argv[])
+int com_last(int fd, int argc, char * const * argv)
{
void *result = NULL;
char *q;
return ret;
}
-int com_mbox(int fd, int argc, char *argv[])
+int com_mbox(int fd, int argc, char * const * argv)
{
void *result;
MYSQL_ROW row;
* If filename is NULL, query will list everything, otherwise only
* the score of given file.
*/
-static char *get_query(char *streamname, char *filename, int with_path)
+static char *get_query(const char *streamname, char *filename, int with_path)
{
char *accept_opts = NULL, *deny_opts = NULL, *score = NULL;
char *where_clause, *order, *query;
}
/* list attributes / print database info */
-static int com_la_info(int fd, int argc, char *argv[])
+static int com_la_info(int fd, int argc, char * const * argv)
{
char *name = NULL, *meta = NULL, *atts = NULL, *dir = NULL;
int ret, la = strcmp(argv[0], "info");
}
/* list attributes */
-int com_la(int fd, int argc, char *argv[])
+int com_la(int fd, int argc, char * const * argv)
{
return com_la_info(fd, argc, argv);
}
/* print database info */
-int com_info(int fd, int argc, char *argv[])
+int com_info(int fd, int argc, char * const * argv)
{
return com_la_info(fd, argc, argv);
}
/*
* remove/add entries
*/
-static int com_rm_ne(__a_unused int fd, int argc, char *argv[])
+static int com_rm_ne(__a_unused int fd, int argc, char * const * argv)
{
int ne = !strcmp(argv[0], "ne");
int i, ret;
/*
* rm
*/
-int com_rm(int fd, int argc, char *argv[])
+int com_rm(int fd, int argc, char * const * argv)
{
return com_rm_ne(fd, argc, argv);
}
/*
* ne
*/
-int com_ne(int fd, int argc, char *argv[])
+int com_ne(int fd, int argc, char * const * argv)
{
return com_ne(fd, argc, argv);
}
/*
* mv: rename entry
*/
-int com_mv(__a_unused int fd, int argc, char *argv[])
+int com_mv(__a_unused int fd, int argc, char * const * argv)
{
char *q, *dn, *ebn1 = NULL, *ebn2 = NULL, *edn = NULL;
int ret;
/*
* set field
*/
-static int com_set(__a_unused int fd, int argc, char *argv[])
+static int com_set(__a_unused int fd, int argc, char * const * argv)
{
char *q, *ebn;
long unsigned id;
/*
* snp: set numplayed
*/
-int com_picass(int fd, int argc, char *argv[])
+int com_picass(int fd, int argc, char * const * argv)
{
return com_set(fd, argc, argv);
}
/*
* snp: set numplayed
*/
-int com_snp(int fd, int argc, char *argv[])
+int com_snp(int fd, int argc, char * const * argv)
{
int ret = com_set(fd, argc, argv);
if (ret >= 0)
/*
* picch: change entry's name in pics table
*/
-int com_picch(__a_unused int fd, int argc, char *argv[])
+int com_picch(__a_unused int fd, int argc, char * const * argv)
{
int ret;
long unsigned id;
/*
* piclist: print list of pics in db
*/
-int com_piclist(__a_unused int fd, int argc, __a_unused char *argv[])
+int com_piclist(__a_unused int fd, int argc, __a_unused char * const * argv)
{
void *result = NULL;
MYSQL_ROW row;
/*
* picdel: delete picture from database
*/
-int com_picdel(int fd, int argc, char *argv[])
+int com_picdel(int fd, int argc, char * const * argv)
{
char *q;
long unsigned id;
/*
* pic: get picture by name or by number
*/
-int com_pic(int fd, int argc, char *argv[])
+int com_pic(int fd, int argc, char * const * argv)
{
void *result = NULL;
MYSQL_ROW row;
}
/* strdel */
-int com_strdel(__a_unused int fd, int argc, char *argv[])
+int com_strdel(__a_unused int fd, int argc, char * const * argv)
{
char *q, *tmp;
int ret;
/*
* ls
*/
-int com_ls(int fd, int argc, char *argv[])
+int com_ls(int fd, int argc, char * const * argv)
{
char *q;
void *result;
/*
* summary
*/
-int com_summary(__a_unused int fd, int argc, __a_unused char *argv[])
+int com_summary(__a_unused int fd, int argc, __a_unused char * const * argv)
{
MYSQL_ROW row;
MYSQL_ROW row2;
return ret;
}
-static int update_audio_file(char *name)
+static int update_audio_file(const char *name)
{
int ret;
const char *fmt1 = "update data set lastplayed = now() where name = '%s'";
update_audio_file(name);
}
-int com_us(__a_unused int fd, int argc, char *argv[])
+int com_us(__a_unused int fd, int argc, char * const * argv)
{
char *tmp;
int ret;
}
/* select previous / next stream */
-static int com_ps_ns(__a_unused int fd, int argc, char *argv[])
+static int com_ps_ns(__a_unused int fd, int argc, char * const * argv)
{
char *query, *stream = get_current_stream();
void *result = get_result("select name from streams");
}
/* select previous stream */
-int com_ps(int fd, int argc, char *argv[])
+int com_ps(int fd, int argc, char * const * argv)
{
return com_ps_ns(fd, argc, argv);
}
/* select next stream */
-int com_ns(int fd, int argc, char *argv[])
+int com_ns(int fd, int argc, char * const * argv)
{
return com_ps_ns(fd, argc, argv);
}
/* streams */
-int com_streams(int fd, int argc, __a_unused char *argv[])
+int com_streams(int fd, int argc, __a_unused char * const * argv)
{
unsigned int num_rows;
int i, ret = -E_NORESULT;
}
/* query stream definition */
-int com_strq(int fd, int argc, char *argv[])
+int com_strq(int fd, int argc, char * const * argv)
{
MYSQL_ROW row;
char *query, *name;
}
/* change stream / change stream and play */
-static int com_cs_csp(int fd, int argc, char *argv[])
+static int com_cs_csp(int fd, int argc, char * const * argv)
{
int ret, stream_change;
char *query, *stream = NULL;
}
/* change stream */
-int com_cs(int fd, int argc, char *argv[])
+int com_cs(int fd, int argc, char * const * argv)
{
return com_cs_csp(fd, argc, argv);
}
/* change stream and play */
-int com_csp(int fd, int argc, char *argv[])
+int com_csp(int fd, int argc, char * const * argv)
{
return com_cs_csp(fd, argc, argv);
}
/* score list / skip */
-static int com_sl_skip(int fd, int argc, char *argv[])
+static int com_sl_skip(int fd, int argc, char * const * argv)
{
void *result = NULL;
MYSQL_ROW row;
}
/* score list */
-int com_sl(int fd, int argc, char *argv[])
+int com_sl(int fd, int argc, char * const * argv)
{
return com_sl_skip(fd, argc, argv);
}
/* skip */
-int com_skip(int fd, int argc, char *argv[])
+int com_skip(int fd, int argc, char * const * argv)
{
return com_sl_skip(fd, argc, argv);
}
/*
* update attributes of name
*/
-static int update_atts(int fd, char *name, char *atts)
+static int update_atts(int fd, const char *name, char *atts)
{
int ret;
char *ebn, *q, *old, *new = NULL;
/*
* set attributes
*/
-int com_sa(int fd, int argc, char *argv[])
+int com_sa(int fd, int argc, char * const * argv)
{
int i, ret;
char *atts = NULL, *name;
return -E_MYSQL_SYNTAX;
for (i = 1; i < argc; i++) {
int unset = 0;
- char *esc, *tmp, *p =argv[i];
- int len = strlen(p);
+ char *esc, *tmp, *p;
+ int len = strlen(argv[i]);
if (!len)
continue;
- switch (p[len - 1]) {
+ switch (argv[i][len - 1]) {
case '+':
unset = 0;
break;
default:
goto no_more_atts;
}
+ p = para_strdup(argv[i]);
p[len - 1] = '\0';
esc = escape_str(p);
+ free(p);
if (!esc)
return -E_ESCAPE;
tmp = make_message("%s%s='%s'", atts? "," : "", esc,
/*
* copy attributes
*/
-int com_cam(int fd, int argc, char *argv[])
+int com_cam(int fd, int argc, char * const * argv)
{
char *name = NULL, *meta = NULL, *atts = NULL;
int i, ret;
/*
* verify / clean
*/
-static int com_vrfy_clean(int fd, int argc, __a_unused char *argv[])
+static int com_vrfy_clean(int fd, int argc, __a_unused char * const * argv)
{
char *query;
int ret, vrfy_mode = strcmp(argv[0], "clean");
/*
* verify
*/
-int com_vrfy(int fd, int argc, char **argv)
+int com_vrfy(int fd, int argc, char * const * argv)
{
return com_vrfy_clean(fd, argc, argv);
}
/*
* clean
*/
-int com_clean(int fd, int argc, char **argv)
+int com_clean(int fd, int argc, char * const * argv)
{
return com_vrfy_clean(fd, argc, argv);
}
/*
* update database
*/
-int com_upd(int fd, int argc, __a_unused char *argv[])
+int com_upd(int fd, int argc, __a_unused char * const * argv)
{
char *tempname = NULL, *query = NULL;
int ret, out_fd = -1, num = 0;
}
/* create database */
-int com_cdb(int fd, int argc, char *argv[])
+int com_cdb(int fd, int argc, char * const * argv)
{
char *query;
int ret;
return ret;
}
-int com_lpl(int fd, __a_unused int argc, __a_unused char *argv[])
+int com_lpl(int fd, __a_unused int argc, __a_unused char * const * const argv)
{
unsigned loaded = 0;
size_t bufsize = 4096; /* guess that's enough */
return ret;
}
-int com_ppl(int fd, __a_unused int argc, __a_unused char *argv[])
+int com_ppl(int fd, __a_unused int argc, __a_unused char * const * const argv)
{
unsigned i;
return 1;
}
-int com_random_info(int fd, __a_unused int argc, __a_unused char *argv[])
+int com_random_info(int fd, __a_unused int argc, __a_unused char * const * const argv)
{
return send_buffer(fd, "Don't use for huge directories as it is "
"very inefficient in this case.\n");
/** the name of the command */
const char *name;
/** pointer to the function that handles the command */
- int (*handler)(int, int, char **);
+ int (*handler)(int, int, char * const * const);
/** the privileges a user must have to execute this command */
unsigned int perms;
/** one-line description of the command */
*
* \return The number of substrings found in \a args.
*/
-__must_check unsigned split_args(char *args, char ***argv_ptr, const char *delim)
+__must_check unsigned split_args(char *args, char *** const argv_ptr, const char *delim)
{
char *p = args;
char **argv;
__must_check int para_mkstemp(char *template, mode_t mode);
__must_check __malloc char *para_logname(void);
__must_check __malloc char *para_homedir(void);
-__must_check unsigned split_args(char *args, char ***argv_ptr, const char *delim);
+__must_check unsigned split_args(char *args, char *** const argv_ptr, const char *delim);
__malloc char *para_hostname(void);
void valid_fd_012(void);
__printf_2_3 int para_printf(struct para_buffer *b, const char *fmt, ...);