From d8f49a6a3eadcdbfb39f15bf9cff5f251fd16125 Mon Sep 17 00:00:00 2001 From: Andre Date: Sat, 20 Jan 2007 18:38:54 +0100 Subject: [PATCH] make the mysql_selector use command_util.sh --- Makefile.in | 14 +- configure.ac | 1 + mysql_selector.c | 712 +++++++++------------------------------------ mysql_selector.cmd | 2 +- 4 files changed, 154 insertions(+), 575 deletions(-) diff --git a/Makefile.in b/Makefile.in index e05d75b9..45dc0418 100644 --- a/Makefile.in +++ b/Makefile.in @@ -148,18 +148,28 @@ grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo --set-package="para_$(subst .cmdline,,$(*F))" \ --set-version="$V" < $< -server_command_list.c: server.cmd +server_command_list.c: server.cmd server_command_list.h echo '#include "server.h"' > $@ echo '#include "user_list.h"' >> $@ echo '#include "server_command_list.h"' >> $@ echo 'struct server_command cmd_struct[] = {' >>$@ ./command_util.sh array < $< >>$@ echo '{.name = NULL}};' >> $@ - server_command_list.h: server.cmd echo 'extern struct server_command cmd_struct[];' > $@ ./command_util.sh proto < $< >> $@ +mysql_selector_command_list.c: mysql_selector.cmd mysql_selector_command_list.h + echo '#include "server.h"' > $@ + echo '#include "user_list.h"' >> $@ + echo '#include "mysql_selector_command_list.h"' >> $@ + echo 'struct server_command cmds[] = {' >>$@ + ./command_util.sh array < $< >>$@ + echo '{.name = NULL}};' >> $@ +mysql_selector_command_list.h: mysql_selector.cmd + echo 'extern struct server_command cmds[];' > $@ + ./command_util.sh proto < $< >> $@ + ortp_recv.o: ortp_recv.c $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $< diff --git a/configure.ac b/configure.ac index ceadf367..f0c04442 100644 --- a/configure.ac +++ b/configure.ac @@ -240,6 +240,7 @@ if test "$have_mysql" = "yes"; then selectors="$selectors mysql" server_ldflags="$server_ldflags $mysql_libs -lmysqlclient" server_errlist_objs="$server_errlist_objs mysql_selector" + server_cmdline_objs="$server_cmdline_objs mysql_selector_command_list" AC_SUBST(mysql_cppflags) AC_SUBST(mysql_libs) AC_DEFINE(HAVE_MYSQL, 1, [define to 1 to turn on mysql support]) diff --git a/mysql_selector.c b/mysql_selector.c index a2a5bcdd..f1c49aa5 100644 --- a/mysql_selector.c +++ b/mysql_selector.c @@ -32,549 +32,13 @@ #include "net.h" #include "string.h" #include "user_list.h" +#include "mysql_selector_command_list.h" /** pointer to the shared memory area */ extern struct misc_meta_data *mmd; static void *mysql_ptr = NULL; -static int com_cam(int, int, char **); -static int com_cdb(int, int, char **); -static int com_cs(int, int, char **); -static int com_da(int, int, char **); -static int com_hist(int, int, char **); -static int com_info(int, int, char **); -static int com_laa(int, int, char **); -static int com_last(int, int, char **); -static int com_ls(int, int, char **); -static int com_mbox(int, int, char **); -static int com_mv(int, int, char **); -static int com_na(int, int, char **); -static int com_pic(int, int, char **); -static int com_picch(int, int, char **); -static int com_picdel(int, int, char **); -static int com_piclist(int, int, char **); -static int com_ps(int, int, char **); -static int com_rm_ne(int, int, char **); -static int com_sa(int, int, char **); -static int com_set(int, int, char **); -static int com_sl(int, int, char **); -static int com_stradd_picadd(int, int, char **); -static int com_streams(int, int, char **); -static int com_strdel(int, int, char **); -static int com_strq(int, int, char **); -static int com_summary(int, int, char **); -static int com_upd(int, int, char **); -static int com_us(int, int, char **); -static int com_verb(int, int, char **); -static int com_vrfy(int, int, char **); - -static struct server_command cmds[] = { -{ -.name = "cam", -.handler = com_cam, -.perms = DB_READ|DB_WRITE, -.description = "copy all metadata", -.synopsis = "cam source dest1 [dest2 ...]", -.help = - -"Copy attributes and other meta data from source file to destination\n" -"file(s). Useful for files that have been renamed.\n" - -}, -{ -.name = "cdb", -.handler = com_cdb, -.perms = DB_READ|DB_WRITE, -.description = "create database", -.synopsis = "cdb [name]", -.help = - -"\tCreate database name containing the initial columns for basic\n" -"\tinteroperation with server. This command has to be used only once\n" -"\twhen you use the mysql audio file selector for the very first time.\n" -"\n" -"\tThe optional name defaults to 'paraslash' if not given.\n" - -}, -{ -.name = "clean", -.handler = com_vrfy, -.perms = DB_READ | DB_WRITE, -.description = "nuke invalid entries in database", -.synopsis = "clean", -.help = - -"If the vrfy command shows you any invalid entries in your database,\n" -"you can get rid of them with clean. Always run 'upd' and 'vrfy'\n" -"before running this command. Use with caution!\n" - -}, -{ -.name = "cs", -.handler = com_cs, -.perms = VSS_WRITE | DB_READ | DB_WRITE, -.description = "change stream", -.synopsis = "cs [s]", -.help = - -"Selects stream s or prints current stream when s was not given.\n" - -}, -{ -.name = "csp", -.handler = com_cs, -.perms = VSS_WRITE | DB_READ, -.description = "change stream and play", -.synopsis = "csp s", -.help = - -"Select stream s and start playing. If this results in a stream-change,\n" -"skip rest of current audio file.\n" - -}, -{ -.name = "da", -.handler = com_da, -.perms = DB_READ | DB_WRITE, -.description = "drop attribute from database", -.synopsis = "da att", -.help = - -"Use with caution. All info on attribute att will be lost.\n" - -}, -{ -.name = "hist", -.handler = com_hist, -.perms = DB_READ, -.description = "print history", -.synopsis = "hist", -.help = - -"Print list of all audio files together with number of days since each\n" -"file was last played.\n" - -}, -{ -.name = "info", -.handler = com_info, -.perms = DB_READ, -.description = "print database info", -.synopsis = "info [af]", -.help = - -"print database informations for audio file af. Current audio file is\n" -"used if af is not given.\n" - -}, -{ -.name = "la", -.handler = com_info, -.perms = DB_READ, -.description = "list attributes", -.synopsis = "la [af]", -.help = - -"List attributes of audio file af or of current audio file when invoked\n" -"without arguments.\n" - -}, -{ -.name = "laa", -.handler = com_laa, -.perms = DB_READ, -.description = "list available attributes", -.synopsis = "laa", -.help = - -"What should I say more?\n" - -}, -{ -.name = "last", -.handler = com_last, -.perms = DB_READ, -.description = "print list of audio files, ordered by lastplayed time", -.synopsis = "last [n]", -.help = - -"The optional number n defaults to 10 if not specified.\n" - -}, -{ -.name = "ls", -.handler = com_ls, -.perms = DB_READ, -.description = "list all audio files that match a LIKE pattern", -.synopsis = "ls [pattern]", -.help = - -"\tIf pattern was not given, print list of all audio files known\n" -"\tto the mysql selector. See the documentation of mysql\n" -"\tfor the definition of LIKE patterns.\n" - -}, -{ -.name = "mbox", -.handler = com_mbox, -.perms = DB_READ, -.description = "dump audio file list in mbox format", -.synopsis = "mbox [p]", -.help = - -"\tDump list of audio files in mbox format (email) to stdout. If\n" -"\tthe optional pattern p is given, only those audio files,\n" -"\twhose basename match p are going to be included. Otherwise,\n" -"\tall files are selected.\n" -"\n" -"EXAMPLE\n" -"\tThe mbox command can be used together with your favorite\n" -"\tmailer (this example uses mutt) for browsing the audio file\n" -"\tcollection:\n" -"\n" -"\t\tpara_client mbox > ~/para_mbox\n" -"\n" -"\t\tmutt -F ~/.muttrc.para -f ~/para_mbox\n" -"\n" -"\tFor playlists, you can use mutt's powerful pattern matching\n" -"\tlanguage to select files. If you like to tag all files\n" -"\tcontaining the pattern 'foo', type 'T', then '~s foo'.\n" -"\n" -"\tWhen ready with the list, type ';|' (i.e., hit the semicolon\n" -"\tkey to apply the next mutt command to all tagged messages,\n" -"\tthen the pipe key) to pipe the selected \"mails\" to a\n" -"\tsuitable script which adds a paraslash stream where exactly\n" -"\tthese files are admissable or does whatever thou wilt.\n" - -}, -{ -.name = "mv", -.handler = com_mv, -.perms = DB_READ | DB_WRITE, -.description = "rename entry in database", -.synopsis = "mv oldname newname", -.help = - -"Rename oldname to newname. This updates the data table to reflect the\n" -"new name. All internal data (numplayed, lastplayed, picid,..) is kept.\n" -"If newname is a full path, the dir table is updated as well.\n" - -}, -{ -.name = "na", -.handler = com_na, -.perms = DB_READ | DB_WRITE, -.description = "add new attribute to database", -.synopsis = "na att", -.help = - -"This adds a column named att to your mysql database. att should only\n" -"contain letters and numbers, in paricular, '+' and '-' are not allowed.\n" - -}, -{ -.name = "ne", -.handler = com_rm_ne, -.perms = DB_READ | DB_WRITE, -.description = "add new database entries", -.synopsis = "ne file1 [file2 [...]]", -.help = - -"Add the given filename(s) to the database, where file1,... must\n" -"be full path names. This command might be much faster than 'upd'\n" -"if the number of given files is small.\n" - -}, -{ -.name = "ns", -.handler = com_ps, -.perms = VSS_WRITE | DB_READ | DB_WRITE, -.description = "change to next stream", -.synopsis = "ns", -.help = - -"Cycle forwards through stream list.\n" - -}, -{ -.name = "pic", -.handler = com_pic, -.perms = DB_READ, -.description = "get picture by name or by identifier", -.synopsis = "pic [name]", -.help = - -"\tDump jpg image that is associated to given audio file (current\n" -"\taudio file if not specified) to stdout. If name starts with\n" -"\t'#' it is interpreted as an identifier instead and the picture\n" -"\thaving that identifier is dumped to stdout.\n" -"\n" -"EXAMPLE\n" -"\n" -"\tpara_client pic '#123' > pic123.jpg\n" - -}, -{ -.name = "picadd", -.handler = com_stradd_picadd, -.perms = DB_READ | DB_WRITE, -.description = "add picture to database", -.synopsis = "picadd [picname]", -.help = - -"\tRead jpeg file from stdin and store it as picname in database.\n" -"\n" -"EXAMPLE\n" -"\n" -"\tpara_client picadd foo.jpg < foo.jpg\n" - -}, -{ -.name = "picass", -.handler = com_set, -.perms = DB_READ | DB_WRITE, -.description = "associate a picture to file(s)", -.synopsis = "picass pic_id file1 [file2...]", -.help = - -"Associate the picture given by pic_id to all given files.\n" - -}, -{ -.name = "picch", -.handler = com_picch, -.perms = DB_READ | DB_WRITE, -.description = "change name of picture", -.synopsis = "picch id new_name", -.help = - -"Asign new_name to picture with identifier id.\n" - -}, -{ -.name = "picdel", -.handler = com_picdel, -.perms = DB_READ | DB_WRITE, -.description = "delete picture from database", -.synopsis = "picdel id1 [id2...]", -.help = - -"Delete each given picture from database.\n" - -}, -{ -.name = "piclist", -.handler = com_piclist, -.perms = DB_READ, -.description = "print list of pictures", -.synopsis = "piclist", -.help = - -"Print id, name and length of each picture contained in the database.\n" - -}, -{ -.name = "ps", -.handler = com_ps, -.perms = VSS_WRITE | DB_READ | DB_WRITE, -.description = "change to previous stream", -.synopsis = "ps", -.help = - -"Cycle backwards through stream list.\n" - -}, -{ -.name = "rm", -.handler = com_rm_ne, -.perms = DB_READ | DB_WRITE, -.description = "remove entries from database", -.synopsis = "rm name1 [name2 [...]]", -.help = - -"Remove name1, name2, ... from the data table. Use with caution\n" - -}, -{ -.name = "sa", -.handler = com_sa, -.perms = DB_READ | DB_WRITE, -.description = "set/unset attributes", -.synopsis = "sa at1<'+' | '-'> [at2<'+' | '-'> ] [af1 ...]", -//.synopsis = "foo", -.help = - -"Set ('+') or unset ('-') attribute at1, at2 etc. for given list of\n" -"audio files. If no audio files were given the current audio file is\n" -"used. Example:\n" -"\n" -"sa rock+ punk+ classic- LZ__Waldsterben.mp3\n" -"\n" -"sets the 'rock' and the 'punk' attribute but unsets the 'classic'\n" -"attribute.\n" - -}, -{ -.name = "skip", -.handler = com_sl, -.perms = DB_READ | DB_WRITE, -.description = "skip subsequent audio files(s)", -.synopsis = "skip n [s]", -.help = - -"Skip the next n audio files of stream s. This is equivalent to the\n" -"command 'sl n s', followed by 'us name' for each name the output of sl.\n" - -}, -{ -.name = "sl", -.handler = com_sl, -.perms = DB_READ, -.description = "print score list", -.synopsis = "sl n [s]", -.help = - -"Print sorted list of maximal n lines. Each line is an admissible entry\n" -"with respect to stream s. The list is sorted by score-value which is\n" -"given by the definition of s. If s is not given, the current stream\n" -"is used. Example:\n" -"\n" -" sl 1\n" -"\n" -"shows you the audio file the server would select right now.\n" - -}, -{ -.name = "snp", -.handler = com_set, -.perms = DB_READ | DB_WRITE, -.description = "set numplayed", -.synopsis = "snp number af1 [af2 ...]", -.help = - -"Update the numplayed field in the data table for all given audio files.\n" - -}, -{ -.name = "stradd", -.handler = com_stradd_picadd, -.perms = DB_READ | DB_WRITE, -.description = "add stream", -.synopsis = "stradd s", -.help = - -"Add stream s to the list of available streams. The stream definition\n" -"for s is read from stdin and is then sent to para_server. Example:\n" -"\n" -" echo 'deny: NAME_LIKE(%Madonna%)' | para_client stradd no_madonna\n" -"\n" -"adds the new stream 'no_madonna' to the list of available streams. A given\n" -"audio file is admissible for this stream iff its basename does not contain the\n" -"string 'Madonna'.\n" - - -}, -{ -.name = "strdel", -.handler = com_strdel, -.perms = DB_READ | DB_WRITE, -.description = "delete stream", -.synopsis = "strdel s", -.help = - -"Remove stream s from database.\n" - -}, -{ -.name = "streams", -.handler = com_streams, -.perms = DB_READ, -.description = "list streams", -.synopsis = "streams", -.help = - -"Print list of available streams. Use 'cs' to switch to any of these.\n" - -}, -{ -.name = "strq", -.handler = com_strq, -.perms = DB_READ, -.description = "query stream definition", -.synopsis = "strq [s]", -.help = - -"Print definition of stream s to stdout. Use current stream if s was\n" -"not given.\n" - -}, -{ -.name = "summary", -.handler = com_summary, -.perms = DB_READ, -.description = "list attributes", -.synopsis = "summary", -.help = - -"\tPrint a list of attributes together with number of audio\n" -"\tfiles having that attribute set.\n" - -}, -{ -.name = "upd", -.handler = com_upd, -.perms = DB_READ | DB_WRITE, -.description = "update database", -.synopsis = "upd", -.help = - -"This command uses the --audio_file_dir option of para_server to locate\n" -"your audio files. New files are then added to the mysql database. Use\n" -"this command if you got new files or if you have moved some files\n" -"around.\n" - -}, -{ -.name = "us", -.handler = com_us, -.perms = DB_READ | DB_WRITE, -.description = "update lastplayed time", -.synopsis = "us name", -.help = - -"Update lastplayed time without actually playing the thing.\n" - -}, -{ -.name = "verb", -.handler = com_verb, -.perms = DB_READ | DB_WRITE, -.description = "send verbatim sql query", -.synopsis = "verb cmd", -.help = - -"Send cmd to mysql server. For expert/debugging only. Note that cmd\n" -"usually must be escaped. Use only if you know what you are doing!\n" - -}, -{ -.name = "vrfy", -.handler = com_vrfy, -.perms = DB_READ, -.description = "list invalid entries in database", -.synopsis = "vrfy", -.help = - -"Show what clean would delete. Run 'upd' before this command to make\n" -"sure your database is up to date.\n" - -}, -{ -.name = NULL, -} -}; - static struct para_macro macro_list[] = { { .name = "IS_N_SET", .replacement = "(data.%s != '1')" @@ -693,7 +157,7 @@ static char *escaped_basename(const char *name) /* * new attribute */ -static int com_na(__a_unused int fd, int argc, char *argv[]) +int com_na(__a_unused int fd, int argc, char *argv[]) { char *q, *tmp; int ret; @@ -714,7 +178,7 @@ static int com_na(__a_unused int fd, int argc, char *argv[]) /* * delete attribute */ -static int com_da(__a_unused int fd, int argc, char *argv[]) +int com_da(__a_unused int fd, int argc, char *argv[]) { char *q, *tmp; int ret; @@ -787,6 +251,18 @@ out: return ret; } +/* stradd */ +int com_stradd(int fd, int argc, char *argv[]) +{ + return com_stradd_picadd(fd, argc, argv); +} + +/* pic_add */ +int com_picadd(int fd, int argc, char *argv[]) +{ + return com_stradd_picadd(fd, argc, argv); +} + /* * print results to fd */ @@ -818,7 +294,7 @@ static int print_results(int fd, void *result, /* * verbatim */ -static int com_verb(int fd, int argc, char *argv[]) +int com_verb(int fd, int argc, char *argv[]) { void *result = NULL; int ret; @@ -865,7 +341,7 @@ static void *get_all_attributes(void) /* * list all attributes */ -static int com_laa(int fd, int argc, __a_unused char *argv[]) +int com_laa(int fd, int argc, __a_unused char *argv[]) { void *result; int ret; @@ -883,7 +359,7 @@ static int com_laa(int fd, int argc, __a_unused char *argv[]) /* * history */ -static int com_hist(int fd, int argc, char *argv[]) { +int com_hist(int fd, int argc, char *argv[]) { int ret; void *result = NULL; char *q, *atts; @@ -918,7 +394,7 @@ static int com_hist(int fd, int argc, char *argv[]) { /* * get last num audio files */ -static int com_last(int fd, int argc, char *argv[]) +int com_last(int fd, int argc, char *argv[]) { void *result = NULL; char *q; @@ -941,7 +417,7 @@ static int com_last(int fd, int argc, char *argv[]) return ret; } -static int com_mbox(int fd, int argc, char *argv[]) +int com_mbox(int fd, int argc, char *argv[]) { void *result; MYSQL_ROW row; @@ -1340,9 +816,8 @@ static char *get_current_audio_file(void) return name; } - -/* print database info */ -static int com_info(int fd, int argc, char *argv[]) +/* list attributes / print database info */ +static int com_la_info(int fd, int argc, char *argv[]) { char *name = NULL, *meta = NULL, *atts = NULL, *dir = NULL; int ret, com_la = strcmp(argv[0], "info"); @@ -1375,6 +850,18 @@ out: return ret; } +/* list attributes */ +int com_la(int fd, int argc, char *argv[]) +{ + return com_la_info(fd, argc, argv); +} + +/* print database info */ +int com_info(int fd, int argc, char *argv[]) +{ + return com_la_info(fd, argc, argv); +} + static int change_stream(const char *stream) { char *query; @@ -1489,10 +976,26 @@ static int com_rm_ne(__a_unused int fd, int argc, char *argv[]) return 1; } +/* + * rm + */ +int com_rm(int fd, int argc, char *argv[]) +{ + return com_rm_ne(fd, argc, argv); +} + +/* + * ne + */ +int com_ne(int fd, int argc, char *argv[]) +{ + return com_ne(fd, argc, argv); +} + /* * mv: rename entry */ -static int com_mv(__a_unused int fd, int argc, char *argv[]) +int com_mv(__a_unused int fd, int argc, char *argv[]) { char *q, *dn, *ebn1 = NULL, *ebn2 = NULL, *edn = NULL; int ret; @@ -1548,8 +1051,7 @@ out: } /* - * picass: associate pic to audio file - * snp: set numplayed + * set field */ static int com_set(__a_unused int fd, int argc, char *argv[]) { @@ -1576,10 +1078,26 @@ static int com_set(__a_unused int fd, int argc, char *argv[]) return 1; } +/* + * snp: set numplayed + */ +int com_picass(int fd, int argc, char *argv[]) +{ + return com_set(fd, argc, argv); +} + +/* + * snp: set numplayed + */ +int com_snp(int fd, int argc, char *argv[]) +{ + return com_set(fd, argc, argv); +} + /* * picch: change entry's name in pics table */ -static int com_picch(__a_unused int fd, int argc, char *argv[]) +int com_picch(__a_unused int fd, int argc, char *argv[]) { int ret; long unsigned id; @@ -1602,7 +1120,7 @@ static int com_picch(__a_unused int fd, int argc, char *argv[]) /* * piclist: print list of pics in db */ -static 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 *argv[]) { void *result = NULL; MYSQL_ROW row; @@ -1631,7 +1149,7 @@ out: /* * picdel: delete picture from database */ -static int com_picdel(int fd, int argc, char *argv[]) +int com_picdel(int fd, int argc, char *argv[]) { char *q; long unsigned id; @@ -1663,7 +1181,7 @@ static int com_picdel(int fd, int argc, char *argv[]) /* * pic: get picture by name or by number */ -static int com_pic(int fd, int argc, char *argv[]) +int com_pic(int fd, int argc, char *argv[]) { void *result = NULL; MYSQL_ROW row; @@ -1704,7 +1222,7 @@ out: } /* strdel */ -static int com_strdel(__a_unused int fd, int argc, char *argv[]) +int com_strdel(__a_unused int fd, int argc, char *argv[]) { char *q, *tmp; int ret; @@ -1724,7 +1242,7 @@ static int com_strdel(__a_unused int fd, int argc, char *argv[]) /* * ls */ -static int com_ls(int fd, int argc, char *argv[]) +int com_ls(int fd, int argc, char *argv[]) { char *q; void *result; @@ -1757,7 +1275,7 @@ static int com_ls(int fd, int argc, char *argv[]) /* * summary */ -static 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 *argv[]) { MYSQL_ROW row; MYSQL_ROW row2; @@ -1867,7 +1385,7 @@ static void update_audio_file_server_handler(char *name) update_audio_file(name); } -static int com_us(__a_unused int fd, int argc, char *argv[]) +int com_us(__a_unused int fd, int argc, char *argv[]) { char *tmp; int ret; @@ -1897,8 +1415,8 @@ static void refresh_selector_info(void) free(info); } -/* select previous/next stream */ -static int com_ps(__a_unused int fd, int argc, char *argv[]) +/* select previous / next stream */ +static int com_ps_ns(__a_unused int fd, int argc, char *argv[]) { char *query, *stream = get_current_stream(); void *result = get_result("select name from streams"); @@ -1964,8 +1482,20 @@ out: return ret; } +/* select previous stream */ +int com_ps(int fd, int argc, char *argv[]) +{ + return com_ps_ns(fd, argc, argv); +} + +/* select next stream */ +int com_ns(int fd, int argc, char *argv[]) +{ + return com_ps_ns(fd, argc, argv); +} + /* streams */ -static int com_streams(int fd, int argc, __a_unused char *argv[]) +int com_streams(int fd, int argc, __a_unused char *argv[]) { unsigned int num_rows; int i, ret = -E_NORESULT; @@ -2003,7 +1533,7 @@ out: } /* query stream definition */ -static int com_strq(int fd, int argc, char *argv[]) +int com_strq(int fd, int argc, char *argv[]) { MYSQL_ROW row; char *query, *name; @@ -2039,7 +1569,7 @@ out: } /* change stream / change stream and play */ -static int com_cs(int fd, int argc, char *argv[]) +static int com_cs_csp(int fd, int argc, char *argv[]) { int ret, stream_change; char *query, *stream = NULL; @@ -2086,10 +1616,20 @@ out: return ret; } -/* - * sl/skip - */ -static int com_sl(int fd, int argc, char *argv[]) +/* change stream */ +int com_cs(int fd, int argc, char *argv[]) +{ + return com_cs_csp(fd, argc, argv); +} + +/* change stream and play */ +int com_csp(int fd, int argc, char *argv[]) +{ + return com_cs_csp(fd, argc, argv); +} + +/* score list / skip */ +static int com_sl_skip(int fd, int argc, char *argv[]) { void *result = NULL; MYSQL_ROW row; @@ -2141,6 +1681,18 @@ out: return ret; } +/* score list */ +int com_sl(int fd, int argc, char *argv[]) +{ + return com_sl_skip(fd, argc, argv); +} + +/* skip */ +int com_skip(int fd, int argc, char *argv[]) +{ + return com_sl_skip(fd, argc, argv); +} + /* * update attributes of name */ @@ -2173,7 +1725,7 @@ out: /* * set attributes */ -static int com_sa(int fd, int argc, char *argv[]) +int com_sa(int fd, int argc, char *argv[]) { int i, ret; char *atts = NULL, *name; @@ -2230,7 +1782,7 @@ out: /* * copy attributes */ -static int com_cam(int fd, int argc, char *argv[]) +int com_cam(int fd, int argc, char *argv[]) { char *name = NULL, *meta = NULL, *atts = NULL; int i, ret; @@ -2278,7 +1830,7 @@ out: /* * verify / clean */ -static int com_vrfy(int fd, int argc, __a_unused char *argv[]) +static int com_vrfy_clean(int fd, int argc, __a_unused char *argv[]) { char *query; int ret, vrfy_mode = strcmp(argv[0], "clean"); @@ -2328,6 +1880,22 @@ out: return ret; } +/* + * verify + */ +int com_vrfy(int fd, int argc, char **argv) +{ + return com_vrfy_clean(fd, argc, argv); +} + +/* + * clean + */ +int com_clean(int fd, int argc, char **argv) +{ + return com_vrfy_clean(fd, argc, argv); +} + static FILE *out_file; static int mysql_write_tmp_file(const char *dir, const char *name) @@ -2343,7 +1911,7 @@ static int mysql_write_tmp_file(const char *dir, const char *name) /* * update database */ -static int com_upd(int fd, int argc, __a_unused char *argv[]) +int com_upd(int fd, int argc, __a_unused char *argv[]) { char *tempname = NULL, *query = NULL; int ret, out_fd = -1, num = 0; @@ -2511,7 +2079,7 @@ static void write_msg2mmd(int success) } /* create database */ -static int com_cdb(int fd, int argc, char *argv[]) +int com_cdb(int fd, int argc, char *argv[]) { char *query; int ret; diff --git a/mysql_selector.cmd b/mysql_selector.cmd index 0144c43d..84297d54 100644 --- a/mysql_selector.cmd +++ b/mysql_selector.cmd @@ -108,7 +108,7 @@ H: containing the pattern 'foo', type 'T', then '~s foo'. H: H: When ready with the list, type ';|' (i.e., hit the semicolon H: key to apply the next mutt command to all tagged messages, -H: then the pipe key) to pipe the selected \"mails\" to a +H: then the pipe key) to pipe the selected mails to a H: suitable script which adds a paraslash stream where exactly H: these files are admissable or does whatever thou wilt. --- -- 2.39.2