From 40c30921052f41a9021255f14f99af37b9826805 Mon Sep 17 00:00:00 2001 Message-Id: <40c30921052f41a9021255f14f99af37b9826805.1714327411.git.mdw@distorted.org.uk> From: Mark Wooding Date: Fri, 23 Nov 2007 14:15:43 +0000 Subject: [PATCH] 'plugins' and other _accum configuration items can now have the list cleared by supplying no arguments. This is used by the test scripts to ensure they aren't picking up install versions of the plugins. Organization: Straylight/Edgeware From: Richard Kettlewell This is on disorder.unicode rather than disorder.dev because the tests that matter are all there... --- doc/disorder_config.5.in | 30 ++++++++++++++++++++++++++++-- lib/configuration.c | 8 ++++++++ tests/dtest.py | 4 +++- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/doc/disorder_config.5.in b/doc/disorder_config.5.in index f73f0bf..badedeb 100644 --- a/doc/disorder_config.5.in +++ b/doc/disorder_config.5.in @@ -126,6 +126,10 @@ interface.) Plugins are opened the first time they are required and never after, so after changing a plugin you must restart the server before it is guaranteed to take effect. +.IP +If +.B plugins +is used without arguments the plugin path is cleared. .SS "Server Configuration" .TP .B alias \fIPATTERN\fR @@ -326,6 +330,10 @@ For the server to be able to calculate track lengths, there should be a command corresponding to each .B player command. +.IP +If +.B player +is used without arguments, the list of players is cleared. .TP .B prefsync \fISECONDS\fR The interval at which the preferences log file will be synchronised. Defaults @@ -440,14 +448,23 @@ Scratches are played using the same logic as other tracks. .IP At least for the time being, path names of scratches must be encoded using UTF-8 (which means that ASCII will do). +.IP +If \fBscratch\fR is used without arguments then the list of scratches is +cleared. .TP .B stopword \fIWORD\fR ... Specifies one or more stopwords that should not take part in searches over track names. +.IP +If \fBstopword\fR is used without arguments then the list of stopwords is +cleared. .TP .B tracklength \fIPATTERN\fR \fIMODULE\fR Specifies the module used to calculate the length of files matching \fIPATTERN\fR. \fIMODULE\fR specifies which plugin module to use. +.IP +If \fBtracklength\fR is used without arguments then the list of modules is +cleared. .SS "Client Configuration" .TP .B connect \fIHOST SERVICE\fR @@ -468,6 +485,8 @@ interface. If a template appears in more than one template directory then the one in the earliest directory specified is chosen. .IP See below for further details. +.IP +If \fBtemplates\fR is used without arguments then the template path is cleared. .TP .B transform \fITYPE\fR \fIREGEXP\fR \fISUBST\fR [\fICONTEXT\fR [\fIREFLAGS\fR]] Determines how names are sorted and displayed in track choice displays. @@ -500,6 +519,10 @@ This must be the full URL, e.g. \fBhttp://myhost/cgi-bin/jukebox\fR and not .TP .B allow \fIUSERNAME\fR \fIPASSWORD\fR Specify a username/password pair. +.IP +If +.B allow +is used without arguments, the list of allowed users is cleared. .TP .B password \fIPASSWORD\fR Specify password. @@ -507,6 +530,9 @@ Specify password. .B trust \fIUSERNAME\fR Allow \fIUSERNAME\fR to perform privileged operations such as shutting down or reconfiguring the daemon, or becoming another user. +.IP +If \fBtrust\fR is used without arguments then the list of trusted users is +cleared. .TP .B user \fIUSER\fR Specifies the user to run as. Only makes sense if invoked as root (or @@ -739,7 +765,7 @@ Expands to the filename of the current file or directory, inside the template argument to \fBchoose\fR. .TP .B @files{\fITEMPLATE\fB} -Expands \fITEMPLATE\fB once for each file indicated by the \fBdirectory\fR CGI +Expands \fITEMPLATE\fR once for each file indicated by the \fBdirectory\fR CGI arg if it is present, or otherwise for the list of files counted by \fBfiles\fR with names \fB0_file\fR, \fB1_file\fR etc. .TP @@ -984,7 +1010,7 @@ URL-quote \fISTRING\fR. Expands to \fBdisorder.cgi\fR's version string. .TP .B @volume:\fISPEAKER\fB@ -The volume on the left or right speaker. \fISPEAKER\fR must be \fBleft\fB or +The volume on the left or right speaker. \fISPEAKER\fR must be \fBleft\fR or \fBright\fR. .TP .B @when@ diff --git a/lib/configuration.c b/lib/configuration.c index 221be9c..d758751 100644 --- a/lib/configuration.c +++ b/lib/configuration.c @@ -226,6 +226,10 @@ static int set_stringlist_accum(const struct config_state *cs, struct stringlistlist *sll; sll = ADDRESS(cs->config, struct stringlistlist); + if(nvec == 0) { + sll->n = 0; + return 0; + } sll->n++; sll->s = xrealloc(sll->s, (sll->n * sizeof (struct stringlist))); s = &sll->s[sll->n - 1]; @@ -243,6 +247,10 @@ static int set_string_accum(const struct config_state *cs, struct stringlist *sl; sl = ADDRESS(cs->config, struct stringlist); + if(nvec == 0) { + sl->n = 0; + return 0; + } for(n = 0; n < nvec; ++n) { sl->n++; sl->s = xrealloc(sl->s, (sl->n * sizeof (char *))); diff --git a/tests/dtest.py b/tests/dtest.py index 68a130d..3936935 100644 --- a/tests/dtest.py +++ b/tests/dtest.py @@ -167,7 +167,9 @@ stopword the a an and to too in on of we i am as im for is username fred password fredpass allow fred fredpass +plugins plugins %s/plugins +plugins %s/plugins/.libs player *.mp3 execraw disorder-decode player *.ogg execraw disorder-decode player *.wav execraw disorder-decode @@ -176,7 +178,7 @@ tracklength *.mp3 disorder-tracklength tracklength *.ogg disorder-tracklength tracklength *.wav disorder-tracklength tracklength *.flac disorder-tracklength -""" % (testroot, testroot, testroot, testroot, top_builddir)) +""" % (testroot, testroot, testroot, testroot, top_builddir, top_builddir)) copyfile("%s/sounds/scratch.ogg" % top_srcdir, "%s/scratch.ogg" % testroot) -- [mdw]