From: Richard Kettlewell Date: Sun, 7 Aug 2011 13:55:08 +0000 (+0100) Subject: cgi: remove obsolete 'columns' option. X-Git-Tag: branchpoint-5.1~26 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/7800abb34c5ad639a4ab0d22da044767b56a1c78 cgi: remove obsolete 'columns' option. Its functionality was replaced by the more sophisticated template system ages ago. --- diff --git a/cgi/disorder-cgi.h b/cgi/disorder-cgi.h index 4587e78..7788578 100644 --- a/cgi/disorder-cgi.h +++ b/cgi/disorder-cgi.h @@ -77,7 +77,6 @@ struct queue_entry *dcgi_findtrack(const char *id); void option_set(const char *name, const char *value); const char *option_label(const char *key); int option_label_exists(const char *key); -char **option_columns(const char *name, int *ncolumns); #define DCGI_QUEUE 0x0001 #define DCGI_PLAYING 0x0002 diff --git a/cgi/options.c b/cgi/options.c index 5517c76..2403833 100644 --- a/cgi/options.c +++ b/cgi/options.c @@ -1,6 +1,6 @@ /* * This file is part of DisOrder. - * Copyright (C) 2004-2008 Richard Kettlewell + * Copyright (C) 2004-2008, 2011 Richard Kettlewell * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,18 +24,12 @@ #include "disorder-cgi.h" -struct column { - int ncolumns; - char **columns; -}; - struct read_options_state { const char *name; int line; }; static hash *labels; -static hash *columns; static void option__readfile(const char *name); @@ -49,15 +43,6 @@ static void option__include(int attribute((unused)) nvec, option__readfile(vec[0]); } -static void option__columns(int nvec, - char **vec) { - struct column c; - - c.ncolumns = nvec - 1; - c.columns = &vec[1]; - hash_add(columns, vec[0], &c, HASH_INSERT_OR_REPLACE); -} - /** @brief Definition of an option command */ static struct option { /** @brief Command name */ @@ -69,7 +54,6 @@ static struct option { /** @brief Command handler */ void (*handler)(int nvec, char **vec); } options[] = { - { "columns", 1, INT_MAX, option__columns }, { "include", 1, 1, option__include }, { "label", 2, 2, option__label }, }; @@ -124,7 +108,6 @@ static void option__init(void) { if(!have_read_options) { have_read_options = 1; labels = hash_new(sizeof (char *)); - columns = hash_new(sizeof (struct column)); option__readfile("options"); } } @@ -192,27 +175,6 @@ int option_label_exists(const char *key) { return !!hash_find(labels, key); } -/** @brief Return a column list - * @param name Context (playing/recent/etc) - * @param ncolumns Where to store column count or NULL - * @return Pointer to column list - */ -char **option_columns(const char *name, int *ncolumns) { - struct column *c; - - option__init(); - c = hash_find(columns, name); - if(c) { - if(ncolumns) - *ncolumns = c->ncolumns; - return c->columns; - } else { - if(ncolumns) - *ncolumns = 0; - return 0; - } -} - /* Local Variables: c-basic-offset:2 diff --git a/doc/disorder_options.5.in b/doc/disorder_options.5.in index b8492b6..242c0b0 100644 --- a/doc/disorder_options.5.in +++ b/doc/disorder_options.5.in @@ -1,5 +1,5 @@ .\" -.\" Copyright (C) 2008 Richard Kettlewell +.\" Copyright (C) 2008, 2011 Richard Kettlewell .\" .\" This program is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by @@ -25,15 +25,6 @@ The general syntax is the same as the main configuration file (see .SH DIRECTIVES Valid directives are: .TP -.B columns \fINAME\fR \fIHEADING\fR... -Defines the columns used in \fB@playing@\fR and \fB@recent@\fB. -\fINAME\fR must be either \fBplaying\fR, \fBrecent\fR or \fBsearch\fR. -\fIHEADING\fR... is a list of heading names. -If a column is defined more than once then the last definitions is used. -.IP -The heading names \fBbutton\fR, \fBlength\fR, \fBwhen\fR and \fBwho\fR -are built in. -.TP .B include \fIPATH\fR Includes another file. If \fIPATH\fR starts with a \fB/\fR then it is taken as is, otherwise @@ -54,7 +45,7 @@ Otherwise the whole name is used as the value. Labels are not individually documented here, see the shipped \fIoptions.labels\fR file instead. .SH "OPTION FILES" -The shipped \fIoptions\fR file includes four standard options files. +The shipped \fIoptions\fR file includes two standard options files. In order, they are: .TP .I options.labels diff --git a/templates/Makefile.am b/templates/Makefile.am index 1f93947..0ce7a54 100644 --- a/templates/Makefile.am +++ b/templates/Makefile.am @@ -19,8 +19,7 @@ pkgdata_DATA=about.tmpl choose.tmpl playing.tmpl recent.tmpl \ prefs.tmpl help.tmpl error.tmpl \ new.tmpl login.tmpl macros.tmpl \ - options options.labels \ - options.columns + options options.labels pkghttp_DATA=disorder.css EXTRA_DIST=${pkgdata_DATA} $(pkghttp_DATA) diff --git a/templates/options b/templates/options index e7313b0..ff61a54 100644 --- a/templates/options +++ b/templates/options @@ -1,8 +1,5 @@ # default label values include options.labels -# default columns -include options.columns - # user overrides - you supply this include options.user diff --git a/templates/options.columns b/templates/options.columns deleted file mode 100644 index 53badbd..0000000 --- a/templates/options.columns +++ /dev/null @@ -1,3 +0,0 @@ -columns playing when who artist album title length button -columns recent when who artist album title length -columns search artist album title