chiark / gitweb /
Source code reorganization:
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 25 May 2008 18:03:06 +0000 (19:03 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 25 May 2008 18:03:06 +0000 (19:03 +0100)
  - almost all headers now include common.h, which includes a number
    of universally necessary headers and declarations
  - the server programs now have a single disorder-server.h header
  - the cgi is now in its own directory
  - plugin exports are limited to those programs that actually need them

148 files changed:
.bzrignore
cgi/Makefile.am [new file with mode: 0644]
cgi/actions.c [moved from server/actions.c with 100% similarity]
cgi/cgimain.c [moved from server/cgimain.c with 100% similarity]
cgi/disorder-cgi.h [moved from server/disorder-cgi.h with 97% similarity]
cgi/login.c [moved from server/login.c with 100% similarity]
cgi/lookup.c [moved from server/lookup.c with 100% similarity]
cgi/macros-disorder.c [moved from server/macros-disorder.c with 100% similarity]
cgi/options.c [moved from server/options.c with 100% similarity]
clients/authorize.c
clients/disorder.c
clients/disorderfm.c
clients/filename-bytes.c
clients/playrtp-alsa.c
clients/playrtp-coreaudio.c
clients/playrtp-mem.c
clients/playrtp-oss.c
clients/playrtp.c
clients/test-eclient.c
configure.ac
disobedience/disobedience.h
doc/Makefile.am
driver/disorder.c
lib/Makefile.am
lib/addr.c
lib/addr.h
lib/alsabg.c
lib/asprintf.c
lib/authhash.c
lib/base64.c
lib/basen.c
lib/bits.c
lib/bits.h
lib/cache.c
lib/cgi.c
lib/charset.c
lib/charset.h
lib/client-common.c
lib/client-common.h
lib/client.c
lib/client.h
lib/common.h [moved from lib/types.h with 92% similarity]
lib/configuration.c
lib/configuration.h
lib/cookies.c
lib/cookies.h
lib/dateparse.c
lib/dateparse.h
lib/defs.c
lib/eclient.c
lib/event.c
lib/eventlog.c
lib/filepart.c
lib/fprintf.c
lib/hash.c
lib/heap.h
lib/hex.c
lib/hostname.c
lib/ifreq.c
lib/ifreq.h
lib/inputline.c
lib/kvp.c
lib/log.c
lib/logfd.c
lib/macros-builtin.c
lib/macros.c
lib/mem.c
lib/mime.c
lib/mixer-alsa.c
lib/mixer-oss.c
lib/mixer.c
lib/plugin.h [deleted file]
lib/printf.c
lib/printf.h
lib/queue-rights.c
lib/queue.c
lib/queue.h
lib/random.c
lib/regsub.c
lib/regsub.h
lib/rights.c
lib/selection.c
lib/selection.h
lib/sendmail.c
lib/signame.c
lib/sink.c
lib/sink.h
lib/snprintf.c
lib/speaker-protocol.c
lib/split.c
lib/syscalls.c
lib/syscalls.h
lib/table.c
lib/table.h
lib/timeval.h
lib/trackdb-int.h
lib/trackdb-stub.c
lib/trackdb.c
lib/trackname.c
lib/trackorder.c
lib/unicode.c
lib/unidata.c
lib/url.c
lib/user.c
lib/vector.c
lib/vector.h
lib/version.c
lib/wav.c
lib/wstat.c
libtests/test.h
plugins/notify.c
scripts/make-unidata
server/Makefile.am
server/api-client.c
server/api-server.c
server/api.c
server/choose.c
server/daemonize.c
server/daemonize.h [deleted file]
server/dbupgrade.c
server/deadlock.c
server/decode.c
server/disorder-server.h [new file with mode: 0644]
server/disorderd.c
server/dump.c
server/normalize.c
server/play.c
server/play.h [deleted file]
server/plugin.c [moved from lib/plugin.c with 96% similarity]
server/queue-ops.c [new file with mode: 0644]
server/rescan.c
server/schedule.c
server/schedule.h [deleted file]
server/server-queue.c
server/server-queue.h [deleted file]
server/server.c
server/server.h [deleted file]
server/speaker-alsa.c
server/speaker-command.c
server/speaker-coreaudio.c
server/speaker-network.c
server/speaker-oss.c
server/speaker.c
server/state.c
server/state.h [deleted file]
server/stats.c
server/trackname.c
tests/udplog.c

index 9a5ff0e20daf3ef9dbcbde977b6c9df26ff60adf..8824dd58daffd7d5b3b750c3075122b9ea36c984 100644 (file)
@@ -77,7 +77,7 @@ server/disorder-deadlock
 server/disorder-dump
 server/disorder-rescan
 server/disorder-speaker
 server/disorder-dump
 server/disorder-rescan
 server/disorder-speaker
-server/disorder.cgi
+cgi/disorder.cgi
 server/disorderd
 server/trackname
 sounds/Makefile
 server/disorderd
 server/trackname
 sounds/Makefile
@@ -192,3 +192,4 @@ libtests/t-charset
 libtests/t-event
 libtests/t-dateparse
 libtests/Makefile
 libtests/t-event
 libtests/t-dateparse
 libtests/Makefile
+cgi/Makefile
diff --git a/cgi/Makefile.am b/cgi/Makefile.am
new file mode 100644 (file)
index 0000000..2e126de
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# This file is part of DisOrder.
+# Copyright (C) 2004-2008 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+
+noinst_PROGRAMS=disorder.cgi
+
+AM_CPPFLAGS=-I${top_srcdir}/lib -I../lib
+
+disorder_cgi_SOURCES=macros-disorder.c macros-disorder.h lookup.c      \
+       lookup.h options.c options.h actions.c actions.h login.c        \
+       login.h cgimain.c
+disorder_cgi_LDADD=../lib/libdisorder.a \
+       $(LIBPCRE) $(LIBGCRYPT) $(LIBDL) $(LIBDB)
+disorder_cgi_LDFLAGS=-export-dynamic
+disorder_cgi_DEPENDENCIES=../lib/libdisorder.a
+
+cgi.o: ../lib/definitions.h
similarity index 100%
rename from server/actions.c
rename to cgi/actions.c
similarity index 100%
rename from server/cgimain.c
rename to cgi/cgimain.c
similarity index 97%
rename from server/disorder-cgi.h
rename to cgi/disorder-cgi.h
index beb858148a3488d99fbdd3e58e7236623ba0febf..73a761df382152e1bb39ed56628bfc451c1da138 100644 (file)
 #ifndef DISORDER_CGI_H
 #define DISORDER_CGI_H
 
 #ifndef DISORDER_CGI_H
 #define DISORDER_CGI_H
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
 #include <stdarg.h>
 #include <stdarg.h>
-#include <string.h>
 #include <time.h>
 #include <errno.h>
 #include <ctype.h>
 #include <time.h>
 #include <errno.h>
 #include <ctype.h>
similarity index 100%
rename from server/login.c
rename to cgi/login.c
similarity index 100%
rename from server/lookup.c
rename to cgi/lookup.c
similarity index 100%
rename from server/options.c
rename to cgi/options.c
index 1a0717eef246290a1e6a0d15fb64d83c1757f708..fe908bcd88d170f4c30f895dc2ef490874a02b55 100644 (file)
@@ -18,8 +18,7 @@
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <pwd.h>
 #include <gcrypt.h>
 
 #include <pwd.h>
 #include <gcrypt.h>
@@ -27,7 +26,6 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <stdio.h>
 
 #include "client.h"
 #include "authorize.h"
 
 #include "client.h"
 #include "authorize.h"
index 1bac10b125dac329fa7e377d956ba4549361303b..be075f1a51050d696da24e370ff14c5b79cad948 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <getopt.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 
 #include <getopt.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <stdio.h>
 #include <errno.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <string.h>
 #include <locale.h>
 #include <time.h>
 #include <stddef.h>
 #include <unistd.h>
 #include <locale.h>
 #include <time.h>
 #include <stddef.h>
 #include <unistd.h>
-#include <assert.h>
 #include <pcre.h>
 #include <ctype.h>
 
 #include <pcre.h>
 #include <ctype.h>
 
@@ -48,7 +43,6 @@
 #include "kvp.h"
 #include "split.h"
 #include "sink.h"
 #include "kvp.h"
 #include "split.h"
 #include "sink.h"
-#include "plugin.h"
 #include "mem.h"
 #include "defs.h"
 #include "authorize.h"
 #include "mem.h"
 #include "defs.h"
 #include "authorize.h"
index b834be60072fd8de6c65de0bb0d0382b7f9f6253..b29330181e047ed3347f9085588d8274bc2ecf63 100644 (file)
@@ -18,8 +18,7 @@
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <getopt.h>
 #include <unistd.h>
 
 #include <getopt.h>
 #include <unistd.h>
@@ -29,7 +28,6 @@
 #include <dirent.h>
 #include <sys/stat.h>
 #include <langinfo.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <langinfo.h>
-#include <string.h>
 #include <fnmatch.h>
 
 #include "syscalls.h"
 #include <fnmatch.h>
 
 #include "syscalls.h"
index 91c33c0194ae3e91640beb5119c73ec43722139e..8bba942aa7b4b4684fbffffca4029f8653bec74d 100644 (file)
@@ -1,10 +1,9 @@
 /* Grotty program to print out the bytes making up filenames in some
  * directory */
 
 /* Grotty program to print out the bytes making up filenames in some
  * directory */
 
-#include "config.h"
+#include "common.h"
 
 #include <dirent.h>
 
 #include <dirent.h>
-#include <stdio.h>
 #include <ctype.h>
 
 int main(int attribute((unused)) argc, char **argv) {
 #include <ctype.h>
 
 int main(int attribute((unused)) argc, char **argv) {
index 3c9b67f9d64e9ac536a8fd55fff79ac442d042f9..a3995e9e4eddd07b9a28ae4ff48e655f82ff962c 100644 (file)
  * wrapping OSS the whole of playrtp could probably be greatly simplified.
  */
 
  * wrapping OSS the whole of playrtp could probably be greatly simplified.
  */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_ALSA_ASOUNDLIB_H 
 
 #if HAVE_ALSA_ASOUNDLIB_H 
-#include "types.h"
 
 #include <poll.h>
 #include <alsa/asoundlib.h>
 
 #include <poll.h>
 #include <alsa/asoundlib.h>
-#include <assert.h>
 #include <pthread.h>
 #include <arpa/inet.h>
 
 #include <pthread.h>
 #include <arpa/inet.h>
 
index c0f18193eee5fe37d27a41b3c46032c3bc13a113..f490a0f28731ba244960ce310062b6138c942adb 100644 (file)
  * @brief RTP player - Core Audio support
  */
 
  * @brief RTP player - Core Audio support
  */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_COREAUDIO_AUDIOHARDWARE_H
 
 #if HAVE_COREAUDIO_AUDIOHARDWARE_H
-#include "types.h"
-
-#include <assert.h>
 #include <pthread.h>
 #include <CoreAudio/AudioHardware.h>
 
 #include <pthread.h>
 #include <CoreAudio/AudioHardware.h>
 
index 74657079c42042b28d34623cef27d5e4ae52c92c..2a868de87bd1d1874e868782582a23fc77e32835 100644 (file)
  * @brief RTP player memory management
  */
 
  * @brief RTP player memory management
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <pthread.h>
 
 #include <pthread.h>
-#include <assert.h>
-#include <string.h>
 
 #include "mem.h"
 #include "vector.h"
 
 #include "mem.h"
 #include "vector.h"
index 15f6b53bc969f998bcc9c5edc6fbcb99cc114972..199487f6993efe800b9c063d3aea24556d4ceee9 100644 (file)
  * @brief RTP player - OSS and empeg support
  */
 
  * @brief RTP player - OSS and empeg support
  */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_SYS_SOUNDCARD_H || EMPEG_HOST
 
 #if HAVE_SYS_SOUNDCARD_H || EMPEG_HOST
-#include "types.h"
 
 #include <poll.h>
 #include <sys/ioctl.h>
 #if !EMPEG_HOST
 #include <sys/soundcard.h>
 #endif
 
 #include <poll.h>
 #include <sys/ioctl.h>
 #if !EMPEG_HOST
 #include <sys/soundcard.h>
 #endif
-#include <assert.h>
 #include <pthread.h>
 #include <pthread.h>
-#include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
index 3f02e0c007eb81477448eceb6b5ec318ffc984a7..cbc24aef4118c770762b8eb0379c026132cbc0be 100644 (file)
  * - it is safe to read uint32_t values without a lock protecting them
  */
 
  * - it is safe to read uint32_t values without a lock protecting them
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <getopt.h>
 
 #include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -62,8 +59,6 @@
 #include <pthread.h>
 #include <locale.h>
 #include <sys/uio.h>
 #include <pthread.h>
 #include <locale.h>
 #include <sys/uio.h>
-#include <string.h>
-#include <assert.h>
 #include <errno.h>
 #include <netinet/in.h>
 #include <sys/time.h>
 #include <errno.h>
 #include <netinet/in.h>
 #include <sys/time.h>
index bae789a683d7b89b4eae8993fc2eafdc21f72991..b5742a3a14c13378ead6dd834e3fdd31e1bca302 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <sys/select.h>
 
 #include <sys/select.h>
-#include <stdio.h>
-#include <assert.h>
 #include <errno.h>
 #include <errno.h>
-#include <stdlib.h>
 #include <time.h>
 
 #include "queue.h"
 #include <time.h>
 
 #include "queue.h"
index beb2803bf74c895b7171c7129b5fb6032fcbe497..2d193ad1d401fa4a77f30882a903d7ed7255a159 100644 (file)
@@ -178,7 +178,7 @@ fi
 subdirs="${subdirs} clients doc examples debian"
 
 if test $want_server = yes; then
 subdirs="${subdirs} clients doc examples debian"
 
 if test $want_server = yes; then
-  subdirs="${subdirs} server plugins driver templates sounds images"
+  subdirs="${subdirs} server cgi plugins driver templates sounds images"
 fi
 if test $want_gtk = yes; then
   subdirs="${subdirs} disobedience"
 fi
 if test $want_gtk = yes; then
   subdirs="${subdirs} disobedience"
@@ -589,6 +589,7 @@ AC_CONFIG_FILES([Makefile
                 scripts/Makefile
                 lib/Makefile
                 server/Makefile
                 scripts/Makefile
                 lib/Makefile
                 server/Makefile
+                cgi/Makefile
                 clients/Makefile
                 disobedience/Makefile
                 doc/Makefile
                 clients/Makefile
                 disobedience/Makefile
                 doc/Makefile
index ccb9acc3d7258b4df8fe3c8e8d40284343aa98db..db1e8e9284223d1a63496aedf933405b9c7bf56c 100644 (file)
 #ifndef DISOBEDIENCE_H
 #define DISOBEDIENCE_H
 
 #ifndef DISOBEDIENCE_H
 #define DISOBEDIENCE_H
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
 #include <time.h>
 #include <time.h>
-#include <string.h>
-#include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 #include <math.h>
 #include <ctype.h>
 #include <errno.h>
 #include <math.h>
index 4b01791ebfab3e7b4955cb3694beb276845ad334..7ae24e4051083c28c8f9aa01becb8048985f90cc 100644 (file)
@@ -53,24 +53,24 @@ $(TMPLMAN) : %.tmpl : % $(top_srcdir)/scripts/htmlman
 
 disorder_templates.5.in: disorder_templates.5.head disorder_templates.5.tail \
                $(top_srcdir)/lib/macros-builtin.c \
 
 disorder_templates.5.in: disorder_templates.5.head disorder_templates.5.tail \
                $(top_srcdir)/lib/macros-builtin.c \
-               $(top_srcdir)/server/macros-disorder.c \
+               $(top_srcdir)/cgi/macros-disorder.c \
                $(top_srcdir)/scripts/macro-docs
        rm -f disorder_templates.5.new
        cat ${srcdir}/disorder_templates.5.head >> disorder_templates.5.new
        $(top_srcdir)/scripts/macro-docs >> disorder_templates.5.new \
                $(top_srcdir)/lib/macros-builtin.c \
                $(top_srcdir)/scripts/macro-docs
        rm -f disorder_templates.5.new
        cat ${srcdir}/disorder_templates.5.head >> disorder_templates.5.new
        $(top_srcdir)/scripts/macro-docs >> disorder_templates.5.new \
                $(top_srcdir)/lib/macros-builtin.c \
-               $(top_srcdir)/server/macros-disorder.c 
+               $(top_srcdir)/cgi/macros-disorder.c 
        cat ${srcdir}/disorder_templates.5.tail >> disorder_templates.5.new
        mv disorder_templates.5.new disorder_templates.5.in
 
 disorder_actions.5.in: disorder_actions.5.head disorder_actions.5.tail \
                $(top_srcdir)/lib/macros-builtin.c \
        cat ${srcdir}/disorder_templates.5.tail >> disorder_templates.5.new
        mv disorder_templates.5.new disorder_templates.5.in
 
 disorder_actions.5.in: disorder_actions.5.head disorder_actions.5.tail \
                $(top_srcdir)/lib/macros-builtin.c \
-               $(top_srcdir)/server/actions.c \
+               $(top_srcdir)/cgi/actions.c \
                $(top_srcdir)/scripts/macro-docs
        rm -f disorder_actions.5.new
        cat ${srcdir}/disorder_actions.5.head >> disorder_actions.5.new
        $(top_srcdir)/scripts/macro-docs >> disorder_actions.5.new \
                $(top_srcdir)/scripts/macro-docs
        rm -f disorder_actions.5.new
        cat ${srcdir}/disorder_actions.5.head >> disorder_actions.5.new
        $(top_srcdir)/scripts/macro-docs >> disorder_actions.5.new \
-               $(top_srcdir)/server/actions.c 
+               $(top_srcdir)/cgi/actions.c 
        cat ${srcdir}/disorder_actions.5.tail >> disorder_actions.5.new
        mv disorder_actions.5.new disorder_actions.5.in
 
        cat ${srcdir}/disorder_actions.5.tail >> disorder_actions.5.new
        mv disorder_actions.5.new disorder_actions.5.in
 
index fb05b591d79b1eb2db1429f79ff405f808a4fff3..d075a03c1aaf2445b76bf96bb4b0f9d48e1ceba9 100644 (file)
  * disorder-normalize to convert to the confnigured target format.
  */
 
  * disorder-normalize to convert to the confnigured target format.
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <string.h>
-#include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
 #include <poll.h>
 #include <errno.h>
 #include <unistd.h>
 #include <poll.h>
index 27ecb2c30e87e4fb0692feda66d84c33844aaae4..7f25cdde488b08a477f452eb81b6b32b165a896c 100644 (file)
@@ -60,7 +60,6 @@ libdisorder_a_SOURCES=charset.c charset.h             \
        mem.c mem.h mem-impl.h                          \
        mime.h mime.c                                   \
        mixer.c mixer.h mixer-oss.c mixer-alsa.c        \
        mem.c mem.h mem-impl.h                          \
        mime.h mime.c                                   \
        mixer.c mixer.h mixer-oss.c mixer-alsa.c        \
-       plugin.c plugin.h                               \
        printf.c printf.h                               \
        asprintf.c fprintf.c snprintf.c                 \
        queue.c queue.h                                 \
        printf.c printf.h                               \
        asprintf.c fprintf.c snprintf.c                 \
        queue.c queue.h                                 \
index c0bc19098e4fd22437d1831016fdb04a1adbe41c..c7a1e7445ed45a017ab87496a68521fa8f772edf 100644 (file)
 /** @file lib/addr.c
  * @brief Socket address support */
 
 /** @file lib/addr.c
  * @brief Socket address support */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
-#include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#include <netdb.h>
 #include <arpa/inet.h>
 #include <sys/un.h>
 
 #include "log.h"
 #include "printf.h"
 #include <arpa/inet.h>
 #include <sys/un.h>
 
 #include "log.h"
 #include "printf.h"
-#include "configuration.h"
 #include "addr.h"
 #include "mem.h"
 
 #include "addr.h"
 #include "mem.h"
 
index 8bd703f033b8f2135a2b409d0ed033cc432bc28b..4049b078dba343f6eaa4180bdfb1190153927ab9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder.
 /*
  * This file is part of DisOrder.
- * Copyright (C) 2004, 2007 Richard Kettlewell
+ * Copyright (C) 2004, 2007, 2008 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
  *
  * 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
 #ifndef ADDR_H
 #define ADDR_H
 
 #ifndef ADDR_H
 #define ADDR_H
 
+#include <netdb.h>
+
+#include "configuration.h"
+
 struct addrinfo *get_address(const struct stringlist *a,
                             const struct addrinfo *pref,
                             char **namep);
 struct addrinfo *get_address(const struct stringlist *a,
                             const struct addrinfo *pref,
                             char **namep);
index be589ce9e3be659d1660d1a2a6e885061a418b53..336c2a3320adb6c77699d045ed89759744aa4131 100644 (file)
  * @brief Background-thread interface to ALSA
  */
 
  * @brief Background-thread interface to ALSA
  */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_ALSA_ASOUNDLIB_H
 
 #if HAVE_ALSA_ASOUNDLIB_H
-#include "types.h"
-
 #include <alsa/asoundlib.h>
 #include <pthread.h>
 
 #include <alsa/asoundlib.h>
 #include <pthread.h>
 
index f3bebd5a14d08054fe7bf28431985ec808afa17b..7d7bd315e541f7e0a4de5b559953d8c05a82ed1c 100644 (file)
  */
 /** @file lib/asprintf.c @brief printf() workalikes */
 
  */
 /** @file lib/asprintf.c @brief printf() workalikes */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
-#include <string.h>
 #include <stdarg.h>
 #include <stddef.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <stddef.h>
 #include <errno.h>
index 24c40f08d22981700fd5ed1757e88087b36e2f6b..a08390255971175291142bcdcbf59133bb95e3d0 100644 (file)
  */
 /** @file lib/authhash.c @brief The authorization hash */
 
  */
 /** @file lib/authhash.c @brief The authorization hash */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <stddef.h>
 #include <gcrypt.h>
 
 #include <stddef.h>
 #include <gcrypt.h>
-#include <assert.h>
 
 #include "hex.h"
 #include "log.h"
 
 #include "hex.h"
 #include "log.h"
index 7909b4f6240e447c5371a6e383da38f265a869d4..297533363b1ef92921abe03a0c9d663f4e66d5b6 100644 (file)
  * @brief Support for MIME base64
  */
 
  * @brief Support for MIME base64
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
-
-#include <stdio.h>
+#include "common.h"
 
 #include "mem.h"
 #include "base64.h"
 
 #include "mem.h"
 #include "base64.h"
index 74cb8366d4a24967ace7b610d62846e46c47e07d..a41a73bc37391f3062336a243566e6ffedb4ae03 100644 (file)
  * words.  The words themselves use the native byte order.
  */
 
  * words.  The words themselves use the native byte order.
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
+#include "common.h"
 
 #include "basen.h"
 
 
 #include "basen.h"
 
index 6b5273b5d4fd6e5ef33304b6ea815f348825f40a..4ed2402cae9f89613ce230ea0d317a4c6f3a45b0 100644 (file)
@@ -22,8 +22,7 @@
  * @brief Bit operations
  */
 
  * @brief Bit operations
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <math.h>
 
 
 #include <math.h>
 
index 0965cb602f044f664de5edbe3392b5951feeb106..e0f7c6289991d093833e2886588a3315aca9d0a8 100644 (file)
@@ -25,8 +25,6 @@
 #ifndef BITS_H
 #define BITS_H
 
 #ifndef BITS_H
 #define BITS_H
 
-#include <string.h>                     /* for fls() */
-
 #if HAVE_FLS
 static inline int leftmost_bit(uint32_t n) {
   return fls(n) - 1;
 #if HAVE_FLS
 static inline int leftmost_bit(uint32_t n) {
   return fls(n) - 1;
index 60c2600af102e04e50b44bd7dc5c340915140dd9..f812dc6b7e660c8814956a1c90c327e7a7d5d697 100644 (file)
@@ -19,8 +19,7 @@
  */
 /** @file lib/cache.c @brief Object caching */
 
  */
 /** @file lib/cache.c @brief Object caching */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <time.h>
 
 
 #include <time.h>
 
index c3a7680efef8d04a41fbb6544ac0db5ad6997f60..8cb04bb8f9170aa30bc4df9251ba01e837c17f7e 100644 (file)
--- a/lib/cgi.c
+++ b/lib/cgi.c
  * @brief CGI tools
  */
 
  * @brief CGI tools
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
 #include <unistd.h>
 #include <errno.h>
 #include <unistd.h>
 #include <errno.h>
-#include <stdio.h>
 
 #include "cgi.h"
 #include "mem.h"
 
 #include "cgi.h"
 #include "mem.h"
index 1dc42318083e810a6935a3df12abd4a566226f25..3c5f88b79cae97c747af797d65df9c384c7d10e2 100644 (file)
  */
 /** @file lib/charset.c @brief Character set conversion */
 
  */
 /** @file lib/charset.c @brief Character set conversion */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <iconv.h>
 
 #include <iconv.h>
-#include <string.h>
 #include <errno.h>
 #include <langinfo.h>
 
 #include <errno.h>
 #include <langinfo.h>
 
index e4c72a9f1c4954d63081b13e0f0ea69b12a5c2df..db5e7375ae6c9d238a7a54380e6b15bde14f3f11 100644 (file)
@@ -1,3 +1,4 @@
+
 /*
  * This file is part of DisOrder.
  * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
 /*
  * This file is part of DisOrder.
  * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
@@ -20,6 +21,8 @@
 #ifndef CHARSET_H
 #define CHARSET_H
 
 #ifndef CHARSET_H
 #define CHARSET_H
 
+#include "log.h"
+
 struct dynstr;
 
 /* Character encoding conversion routines */
 struct dynstr;
 
 /* Character encoding conversion routines */
index f5ace3e6d7517e8e5dc69c5da2c6b680c2bdeee5..53da8acc66899da0287e19a9280de85188e6c7a2 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <sys/types.h>
-#include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
 #include <netinet/in.h>
 #include <sys/un.h>
-#include <string.h>
 #include <errno.h>
 #include <netdb.h>
 
 #include <errno.h>
 #include <netdb.h>
 
index 271e28fa59deb2543b3cfb75ec1c7fa1648603da..dc50ee99c97ec52e8bfd10a6a2e55e1fedc46352 100644 (file)
@@ -21,6 +21,9 @@
 #ifndef CLIENT_COMMON_H
 #define CLIENT_COMMON_H
 
 #ifndef CLIENT_COMMON_H
 #define CLIENT_COMMON_H
 
+#include <sys/types.h>
+#include <sys/socket.h>
+
 socklen_t find_server(struct sockaddr **sap, char **namep);
 
 #endif /* CLIENT_COMMON_H */
 socklen_t find_server(struct sockaddr **sap, char **namep);
 
 #endif /* CLIENT_COMMON_H */
index d357a8ca67af471db37307bd33e70bebff37d7af..84eb77e539310175b8aeaf94b9d303f98ad8200c 100644 (file)
  * implementation.
  */
 
  * implementation.
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
-#include <string.h>
-#include <stdio.h>
 #include <unistd.h>
 #include <errno.h>
 #include <netdb.h>
 #include <unistd.h>
 #include <errno.h>
 #include <netdb.h>
-#include <stdlib.h>
 #include <pcre.h>
 
 #include "log.h"
 #include <pcre.h>
 
 #include "log.h"
index abadef6691ee0d9d807efd3f7ef950510f3a67c5..912fa3255280cb82abc5bad727a0b2829d69eaf6 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef CLIENT_H
 #define CLIENT_H
 
 #ifndef CLIENT_H
 #define CLIENT_H
 
+#include <time.h>
+
 /** @brief Client data */
 typedef struct disorder_client disorder_client;
 
 /** @brief Client data */
 typedef struct disorder_client disorder_client;
 
similarity index 92%
rename from lib/types.h
rename to lib/common.h
index 6b3dc37adbcdc386cb2a4391aa4923effd9ac9b4..77a2cd9ccca803fb99028fb2150b14148d9a6993 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
+/** @file lib/common.h
+ * @brief Common includes and definitions
+ */
+
+#ifndef COMMON_H
+#define COMMON_H
 
 
-#ifndef TYPES_H
-#define TYPES_H
+#include <config.h>
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h>
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h>
@@ -29,6 +34,9 @@
 
 /* had better be before atol/atoll redefinition */
 #include <stdlib.h>
 
 /* had better be before atol/atoll redefinition */
 #include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
 
 #if HAVE_LONG_LONG
 typedef long long long_long;
 
 #if HAVE_LONG_LONG
 typedef long long long_long;
@@ -104,7 +112,7 @@ typedef unsigned char uint32_t;
 # endif
 #endif
 
 # endif
 #endif
 
-#endif /* TYPES_H */
+#endif /* COMMENT_H */
 
 /*
 Local Variables:
 
 /*
 Local Variables:
index ca7d86e7dd4cc22d2d7b6e993616f61ac4d72096..c66f66bf04f8c44709a69ad35585349ddd562df1 100644 (file)
  * @brief Configuration file support
  */
 
  * @brief Configuration file support
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
index bf3a493b394922d0f96fa9299d344a0ee6dbceef..51dc835341221168139f0c5623e1cf2a3f3b1f5e 100644 (file)
 #ifndef CONFIGURATION_H
 #define CONFIGURATION_H
 
 #ifndef CONFIGURATION_H
 #define CONFIGURATION_H
 
+#include <pcre.h>
+
 #include "speaker-protocol.h"
 #include "rights.h"
 
 #include "speaker-protocol.h"
 #include "rights.h"
 
-struct real_pcre;
-
 /* Configuration is kept in a @struct config@; the live configuration
  * is always pointed to by @config@.  Values in @config@ are UTF-8 encoded.
  */
 /* Configuration is kept in a @struct config@; the live configuration
  * is always pointed to by @config@.  Values in @config@ are UTF-8 encoded.
  */
@@ -70,7 +70,7 @@ struct collectionlist {
 
 struct namepart {
   char *part;                          /* part */
 
 struct namepart {
   char *part;                          /* part */
-  struct real_pcre *re;                        /* regexp */
+  pcre *re;                            /* regexp */
   char *replace;                       /* replacement string */
   char *context;                       /* context glob */
   unsigned reflags;                    /* regexp flags */
   char *replace;                       /* replacement string */
   char *context;                       /* context glob */
   unsigned reflags;                    /* regexp flags */
@@ -85,7 +85,7 @@ struct transform {
   char *type;                          /* track or dir */
   char *context;                       /* sort or choose */
   char *replace;                       /* substitution string */
   char *type;                          /* track or dir */
   char *context;                       /* sort or choose */
   char *replace;                       /* substitution string */
-  struct real_pcre *re;                        /* compiled re */
+  pcre *re;                            /* compiled re */
   unsigned flags;                      /* regexp flags */
 };
 
   unsigned flags;                      /* regexp flags */
 };
 
index c98db8f96da9655a9a0e44484e02c0459e7041c8..40e3c3ee7cbd0ed45bb641ec7d547f1f862ea44b 100644 (file)
  * @brief Cookie support
  */
 
  * @brief Cookie support
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
 #include <errno.h>
 #include <time.h>
 #include <gcrypt.h>
 #include <pcre.h>
 
 #include <errno.h>
 #include <time.h>
 #include <gcrypt.h>
 #include <pcre.h>
 
-#include "rights.h"
 #include "cookies.h"
 #include "hash.h"
 #include "mem.h"
 #include "cookies.h"
 #include "hash.h"
 #include "mem.h"
@@ -41,7 +36,6 @@
 #include "base64.h"
 #include "configuration.h"
 #include "kvp.h"
 #include "base64.h"
 #include "configuration.h"
 #include "kvp.h"
-#include "rights.h"
 #include "trackdb.h"
 
 /** @brief Hash function used in signing HMAC */
 #include "trackdb.h"
 
 /** @brief Hash function used in signing HMAC */
index f02013dfca946064308a59cd9576e4be6f0414cc..ea6e41277748be998f91a3886ac1efd813bf38cb 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef COOKIES_H
 #define COOKIES_H
 
 #ifndef COOKIES_H
 #define COOKIES_H
 
+#include "rights.h"
+
 char *make_cookie(const char *user);
 char *verify_cookie(const char *cookie, rights_type *rights);
 void revoke_cookie(const char *cookie);
 char *make_cookie(const char *user);
 char *verify_cookie(const char *cookie, rights_type *rights);
 void revoke_cookie(const char *cookie);
index 45de40c6542903ac0c7a303f89f021c5d455c969..2a25292228a2be673d0f2887a492c30658c75444 100644 (file)
@@ -22,8 +22,7 @@
  * @brief Date parsing
  */
 
  * @brief Date parsing
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <time.h>
 
 
 #include <time.h>
 
index 2f52dacf3baa448c992f35e17ff23afce9a3e2af..7b96fe9b0688996786074c86427c3a50efafc1b0 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
-
 /** @file lib/dateparse.h
  * @brief Date parsing
  */
 
 /** @file lib/dateparse.h
  * @brief Date parsing
  */
 
+#ifndef DATEPARSE_H
+#define DATEPARSE_H
+
+#include <time.h>
+
 time_t dateparse(const char *s);
 #if 0
 struct tm *xgetdate(const char *string,
 time_t dateparse(const char *s);
 #if 0
 struct tm *xgetdate(const char *string,
@@ -31,6 +35,8 @@ int xgetdate_r(const char *string,
               struct tm *tp,
               const char *const *template);
 
               struct tm *tp,
               const char *const *template);
 
+#endif /* DATEPARSE_H */
+
 /*
 Local Variables:
 c-basic-offset:2
 /*
 Local Variables:
 c-basic-offset:2
index b5e1eff92e1ce045646b06fd343677a2f27b9c77..084bf0a43ef8dbf3de2947ad8f3a43f360f766c4 100644 (file)
@@ -23,8 +23,7 @@
  * (see fix_path()), not so that the path can be ignored.
  */
 
  * (see fix_path()), not so that the path can be ignored.
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include "defs.h"
 #include "definitions.h"
 
 #include "defs.h"
 #include "definitions.h"
index 941849c7502f1ec51b96f40644fee5943e158831..a9805f7c4f5948d78e8703c6f93f800f4aedf4cb 100644 (file)
  * @brief Client code for event-driven programs
  */
 
  * @brief Client code for event-driven programs
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
-#include <string.h>
-#include <stdio.h>
 #include <unistd.h>
 #include <errno.h>
 #include <netdb.h>
 #include <unistd.h>
 #include <errno.h>
 #include <netdb.h>
-#include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 #include <stddef.h>
 #include <time.h>
 #include <inttypes.h>
 #include <stddef.h>
 #include <time.h>
index 4c3e9af2708b03ccb61fa9256ca1afc71c2bd06b..7c12b6fc41ae47aa53a60dbe87685259be506623 100644 (file)
@@ -21,7 +21,7 @@
  * @brief DisOrder event loop
  */
 
  * @brief DisOrder event loop
  */
 
-#include <config.h>
+#include "common.h"
 
 #include <unistd.h>
 #include <fcntl.h>
 
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <assert.h>
 #include <signal.h>
 #include <errno.h>
 #include <signal.h>
 #include <errno.h>
-#include <string.h>
-#include <limits.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/un.h>
-#include <stdio.h>
 #include "event.h"
 #include "mem.h"
 #include "log.h"
 #include "event.h"
 #include "mem.h"
 #include "log.h"
index d22a1440ba7e8d4acd3bde14168ad1aa7861de5e..9c7f4fb72c93e3a9fa8a3b1ed19ba6db079dbf17 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <stdarg.h>
 
 #include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
 
 #include "mem.h"
 #include "vector.h"
 
 #include "mem.h"
 #include "vector.h"
index 7af7de02974089f2c68aa72a723b1a58b7ccdee3..b772002e828045874b018351a31af7caf6113523 100644 (file)
  * @brief Filename parsing
  */
 
  * @brief Filename parsing
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
+#include "common.h"
 
 #include "filepart.h"
 #include "mem.h"
 
 #include "filepart.h"
 #include "mem.h"
index 1e1b93ca80e6c2b8807dcf44d2b1a10c3c26f4de..741a31e4115f18d477ce462b9de4880da15aeca6 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
-#include <string.h>
 #include <stdarg.h>
 #include <stddef.h>
 
 #include <stdarg.h>
 #include <stddef.h>
 
index f38e1d9cec35e06d6381ba8dfa0051ce363cc442..f730a585da12a34dd8acdb1cdebdee9c61832c32 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
+#include "common.h"
 
 #include "hash.h"
 #include "mem.h"
 
 #include "hash.h"
 #include "mem.h"
index 6f9bcab7c1e6fd6866178fb950bc6ef2bd080870..c6504efedba2af5e1e501eca0c9048832aec6d18 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef HEAP_H
 #define HEAP_H
 
 #ifndef HEAP_H
 #define HEAP_H
 
+#include "vector.h"
+
 /** @brief Binary heap template.
  * @param NAME name of type to define
  * @param ETYPE element type
 /** @brief Binary heap template.
  * @param NAME name of type to define
  * @param ETYPE element type
index 15860ad9bdc3099c5ab880697276ae90490ef193..e0542ce1c73d067d62ebe1fec7d3b6a1d941b634 100644 (file)
--- a/lib/hex.c
+++ b/lib/hex.c
  */
 /** @file lib/hex.c @brief Hexadecimal encoding and decoding */
 
  */
 /** @file lib/hex.c @brief Hexadecimal encoding and decoding */
 
-#include <config.h>
-#include "types.h"
-
-#include <stdio.h>
-#include <string.h>
+#include "common.h"
 
 #include "hex.h"
 #include "mem.h"
 
 #include "hex.h"
 #include "mem.h"
index 536bb8e29583ba51dec34160562174fe4ff94615..ee7ed49cb4b5125f9c4f089c7b4c095edf2feafd 100644 (file)
@@ -18,8 +18,7 @@
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <sys/utsname.h>
 #include <errno.h>
 
 #include <sys/utsname.h>
 #include <errno.h>
index 7071a0e0ef95aa7306108ab535d8d948629aba5a..3ec92b0163a4d2f211da655c8d02a72da6655b36 100644 (file)
  * @brief Network interface support
  */
 
  * @brief Network interface support
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <errno.h>
 
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <errno.h>
-#include <string.h>
 
 #include "ifreq.h"
 #include "mem.h"
 
 #include "ifreq.h"
 #include "mem.h"
index 7a65d80939681d8a242b1f016ae0a748086a825d..3f2dd9dc38f50ca0569b42db43bb21bccc398022 100644 (file)
@@ -23,8 +23,6 @@
 #ifndef IFREQ_H
 #define IFREQ_H
 
 #ifndef IFREQ_H
 #define IFREQ_H
 
-struct ifreq;
-
 /** @brief Return true if two socket addresses match */
 int sockaddr_equal(const struct sockaddr *a, const struct sockaddr *b);
 
 /** @brief Return true if two socket addresses match */
 int sockaddr_equal(const struct sockaddr *a, const struct sockaddr *b);
 
index 5af46f957fe687b7ef20501b69a495a725a6345f..8882f573fcd5e45a8de5f8da8846cf4badf9b0e8 100644 (file)
  * @brief Line input
  */
 
  * @brief Line input
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
 #include <errno.h>
 #include <errno.h>
-#include <string.h>
 
 #include "log.h"
 #include "mem.h"
 
 #include "log.h"
 #include "mem.h"
index 4aa31a1ee7a76b066efb0d0b87b3c84172d32103..9cd05542d69ea1bc54a91f3f017a10e2b7a1dd2d 100644 (file)
--- a/lib/kvp.c
+++ b/lib/kvp.c
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
-#include <stdio.h>
+#include "common.h"
 
 #include "mem.h"
 #include "kvp.h"
 
 #include "mem.h"
 #include "kvp.h"
index cae84a7e232074f4ad27f68ff28d23908fb3224b..24f9427f3c808ae9fc3e8917e5240a2b934f2c0a 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
 #define NO_MEMORY_ALLOCATION
 /* because the memory allocation functions report errors */
 
 #define NO_MEMORY_ALLOCATION
 /* because the memory allocation functions report errors */
 
-#include <config.h>
+#include "common.h"
 
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <errno.h>
 #include <syslog.h>
 #include <sys/time.h>
 #include <errno.h>
 #include <syslog.h>
 #include <sys/time.h>
index a0a608fd549603ee3cf277e1606e006d4eba7886..1baaff2bbf930a3df6b4ac646687e1aee4e8013a 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <unistd.h>
 
 #include <unistd.h>
-#include <string.h>
 #include <errno.h>
 
 #include "syscalls.h"
 #include <errno.h>
 
 #include "syscalls.h"
index 04ea4900a09d85e37d4835190fe08837cebec1cb..8123f2b930ca06e8d4a4ef5246ca21a5730c3a6c 100644 (file)
  * generated from the comments at the head of each function.
  */
 
  * generated from the comments at the head of each function.
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
-#include <string.h>
 #include <errno.h>
 #include <errno.h>
-#include <assert.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
index 4d3b9a0f1c9d713e4f52224d9186d2086f722979..7b7714423ac02c6a45544d74453b7b255c6d16ff 100644 (file)
  * @brief Macro expansion
  */
 
  * @brief Macro expansion
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <string.h>
 #include <ctype.h>
 #include <ctype.h>
-#include <assert.h>
-#include <stdio.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
index 6d531ccaa3905d0ad7fa1849734084217116e82c..10fffe3ba5f8ad278266db873dd701be40dbda7f 100644 (file)
--- a/lib/mem.c
+++ b/lib/mem.c
  * @brief Memory management
  */
 
  * @brief Memory management
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #if GC
 #include <gc.h>
 #endif
 #include <errno.h>
 
 #if GC
 #include <gc.h>
 #endif
 #include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
 
 #include "mem.h"
 #include "log.h"
 
 #include "mem.h"
 #include "log.h"
index 5db7585f32215cdeb99a03d55c3e99c60d691029..b7975f2097cfa1f7b9c2b380cce6492fd57f58ab 100644 (file)
  * @brief Support for MIME and allied protocols
  */
 
  * @brief Support for MIME and allied protocols
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <string.h>
 #include <ctype.h>
 
 #include <ctype.h>
 
-#include <stdio.h>
-
 #include "mem.h"
 #include "mime.h"
 #include "vector.h"
 #include "mem.h"
 #include "mime.h"
 #include "vector.h"
index 40103e04d9382d786fe0a63c5af8b4d86d8f367a..4ba684f75eb0808a605f5f47e54e842cb466824f 100644 (file)
  * (as I don't one).
  */
 
  * (as I don't one).
  */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_ALSA_ASOUNDLIB_H
 
 
 #if HAVE_ALSA_ASOUNDLIB_H
 
-#include "types.h"
-
-#include <stdio.h>
-#include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <stdlib.h>
 #include <errno.h>
 #include <stddef.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stddef.h>
 #include <ctype.h>
index e1c8b19547dfd7351a1351d79d2a1e21137b9a65..158b6f610c7efb9eb413bcdcff8ba60f19e82b51 100644 (file)
  * nonetheless).
  */
 
  * nonetheless).
  */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_SYS_SOUNDCARD_H
 
 
 #if HAVE_SYS_SOUNDCARD_H
 
-#include "types.h"
-
-#include <stdio.h>
-#include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <stdlib.h>
 #include <errno.h>
 #include <stddef.h>
 #include <sys/ioctl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <sys/ioctl.h>
index ee88fbbec63a951bd666df0a2d1ab985cad1dc52..36acd7337feda5f03067f86e70b6a4e1b94c5ee3 100644 (file)
@@ -21,8 +21,7 @@
  * @brief Mixer support
  */
 
  * @brief Mixer support
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include "configuration.h"
 #include "mixer.h"
 
 #include "configuration.h"
 #include "mixer.h"
diff --git a/lib/plugin.h b/lib/plugin.h
deleted file mode 100644 (file)
index 1283555..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004-2008 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef PLUGIN_H
-#define PLUGIN_H
-
-/* general ********************************************************************/
-
-struct plugin;
-
-typedef void *plugin_handle;
-typedef void function_t(void);
-
-const struct plugin *open_plugin(const char *name,
-                                unsigned flags);
-#define PLUGIN_FATAL 0x0001            /* fatal() on error */
-/* Open a plugin.  Returns a null pointer on error or a handle to it
- * on success. */
-
-function_t *get_plugin_function(const struct plugin *handle,
-                               const char *symbol);
-const void *get_plugin_object(const struct plugin *handle,
-                             const char *symbol);
-/* Look up a function or an object in a plugin */
-
-/* track length computation ***************************************************/
-
-long tracklength(const char *plugin, const char *track, const char *path);
-
-/* collection interface *******************************************************/
-
-void scan(const char *module, const char *root);
-/* write a list of path names below @root@ to standard output. */
-  
-int check(const char *module, const char *root, const char *path);
-/* Recheck a track, given its root and path name.  Return 1 if it
- * exists, 0 if it does not exist and -1 if an error occurred. */
-
-/* notification interface *****************************************************/
-
-void notify_play(const char *track,
-                const char *submitter);
-/* we're going to play @track@.  It was submitted by @submitter@
- * (might be a null pointer) */
-
-void notify_scratch(const char *track,
-                   const char *submitter,
-                   const char *scratcher,
-                   int seconds);
-/* @scratcher@ scratched @track@ after @seconds@.  It was submitted by
- * @submitter@ (might be a null pointer) */
-
-void notify_not_scratched(const char *track,
-                         const char *submitter);
-/* @track@ (submitted by @submitter@, which might be a null pointer)
- * was not scratched. */
-
-void notify_queue(const char *track,
-                 const char *submitter);
-/* @track@ was queued by @submitter@ */
-
-void notify_queue_remove(const char *track,
-                        const char *remover);
-/* @track@ removed from the queue by @remover@ (never a null pointer) */
-
-void notify_queue_move(const char *track,
-                      const char *mover);
-/* @track@ moved in the queue by @mover@ (never a null pointer) */
-
-void notify_pause(const char *track,
-                 const char *pauser);
-/* TRACK was paused by PAUSER (might be a null pointer) */
-
-void notify_resume(const char *track,
-                  const char *resumer);
-/* TRACK was resumed by PAUSER (might be a null pointer) */
-
-/* track playing **************************************************************/
-
-unsigned long play_get_type(const struct plugin *pl);
-/* Get the type word for this plugin */
-
-void *play_prefork(const struct plugin *pl,
-                  const char *track);
-/* Call the prefork function for PL and return the user data */
-
-void play_track(const struct plugin *pl,
-               const char *const *parameters,
-               int nparameters,
-               const char *path,
-               const char *track);
-/* play a track.  Called inside a fork. */
-
-void play_cleanup(const struct plugin *pl, void *data);
-/* Call the cleanup function for PL if necessary */
-
-int play_pause(const struct plugin *pl, long *playedp, void *data);
-/* Pause track. */
-
-void play_resume(const struct plugin *pl, void *data);
-/* Resume track. */
-
-#endif /* PLUGIN_H */
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-End:
-*/
index c5b9ebd36ec5f04636806d49cd49b91bb7d96e94..ed6af66c78f44b4b491f2cdfa50971f9a6388af6 100644 (file)
 #define NO_MEMORY_ALLOCATION
 /* because byte_snprintf used from log.c */
 
 #define NO_MEMORY_ALLOCATION
 /* because byte_snprintf used from log.c */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
 #include <stdarg.h>
 #include <stdarg.h>
-#include <string.h>
 #include <errno.h>
 #include <errno.h>
-#include <stdlib.h>
 #include <stddef.h>
 
 #include "printf.h"
 #include <stddef.h>
 
 #include "printf.h"
index 3b3b7c1568a21e4d30b8aace861b55af518505d2..fd052b0a37e12b39b8d3db566ba1060f24bd60d0 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef PRINTF_H
 #define PRINTF_H
 
 #ifndef PRINTF_H
 #define PRINTF_H
 
+#include <stdarg.h>
+
 struct sink;
 
 int byte_vsinkprintf(struct sink *output,
 struct sink;
 
 int byte_vsinkprintf(struct sink *output,
index 523a4ad8748d2c9b4960e5c7d7c2a09d038dfb69..4205d26f07400d503c0f9154cb16f992e8f51dc7 100644 (file)
  * @brief Various rights-checking operations
  */
 
  * @brief Various rights-checking operations
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
+#include "common.h"
 
 #include "queue.h"
 #include "rights.h"
 
 #include "queue.h"
 #include "rights.h"
index a98bec135bb0ca2b8bea9fb1795bb3fb3543e310..084907023222b3e421795c07e5e41c001306b8bb 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <string.h>
-#include <stdio.h>
 #include <errno.h>
 #include <stddef.h>
 
 #include <errno.h>
 #include <stddef.h>
 
@@ -49,6 +46,20 @@ const char *playing_states[] = {
 
 #define VALUE(q, offset, type) *(type *)((char *)q + offset)
 
 
 #define VALUE(q, offset, type) *(type *)((char *)q + offset)
 
+/* add new entry @n@ to a doubly linked list just after @b@ */
+void queue_insert_entry(struct queue_entry *b, struct queue_entry *n) {
+  n->prev = b;
+  n->next = b->next;
+  n->next->prev = n;
+  n->prev->next = n;
+}
+
+/* remove an entry from a doubly-linked list */
+void queue_delete_entry(struct queue_entry *node) {
+  node->next->prev = node->prev;
+  node->prev->next = node->next;
+}
+
 static int unmarshall_long(char *data, struct queue_entry *q,
                           size_t offset,
                           void (*error_handler)(const char *, void *),
 static int unmarshall_long(char *data, struct queue_entry *q,
                           size_t offset,
                           void (*error_handler)(const char *, void *),
index 6bcbeedb88683b516505bf92dc97a2f260e5d14b..e466c954685a802930013a569069c0c3a884e3fe 100644 (file)
@@ -21,6 +21,9 @@
 #ifndef QUEUE_H
 #define QUEUE_H
 
 #ifndef QUEUE_H
 #define QUEUE_H
 
+#include <time.h>
+
+
 enum playing_state {
   playing_failed,                      /* failed to play */
   playing_isscratch,                   /* this is a scratch track */
 enum playing_state {
   playing_failed,                      /* failed to play */
   playing_isscratch,                   /* this is a scratch track */
@@ -62,6 +65,9 @@ struct queue_entry {
   struct queuelike *ql;                        /* owning queue */
 };
 
   struct queuelike *ql;                        /* owning queue */
 };
 
+void queue_insert_entry(struct queue_entry *b, struct queue_entry *n);
+void queue_delete_entry(struct queue_entry *node);
+
 int queue_unmarshall(struct queue_entry *q, const char *s,
                     void (*error_handler)(const char *, void *),
                     void *u);
 int queue_unmarshall(struct queue_entry *q, const char *s,
                     void (*error_handler)(const char *, void *),
                     void *u);
index 69e14095d81665562830276471330cb01be4bb56..ce87abd00c3aa73e9ac876f2ad88a0e489fcc667 100644 (file)
  *
  */
 
  *
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
 
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
-#include <string.h>
 
 #include "random.h"
 #include "log.h"
 
 #include "random.h"
 #include "log.h"
index 6345725aecea79ab2ba4104a227351dc0403dfff..bb90f431ec851576209d01b9c2bb9b84e247747a 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <string.h>
 #include <pcre.h>
 
 #include "regsub.h"
 #include <pcre.h>
 
 #include "regsub.h"
index e85a597c4683ef382639728c87da779c77d9c08a..2e13930514c47497f6d94221ad67c3e417730874 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef REGSUB_H
 #define REGSUB_H
 
 #ifndef REGSUB_H
 #define REGSUB_H
 
+#include <pcre.h>
+
 #define REGSUB_GLOBAL          0x0001  /* global replace */
 #define REGSUB_MUST_MATCH      0x0002  /* return 0 if no match */
 #define REGSUB_CASE_INDEPENDENT        0x0004  /* case independent */
 #define REGSUB_GLOBAL          0x0001  /* global replace */
 #define REGSUB_MUST_MATCH      0x0002  /* return 0 if no match */
 #define REGSUB_CASE_INDEPENDENT        0x0004  /* case independent */
index f0dc8924d4dff4bbec69db2d2e0912293d06dfba..416c6a7e30a31b8a2551673972b8a3d02390a766 100644 (file)
  * @brief User rights
  */
 
  * @brief User rights
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <string.h>
 
 #include "mem.h"
 #include "log.h"
 
 #include "mem.h"
 #include "log.h"
index 58ff5d1fa37bca9c8785a7334c4eca9fe303acb7..6d0a588ecc585602ff3bf23d626e10ed30461da4 100644 (file)
@@ -21,8 +21,7 @@
  * @brief Select management for Disobedience
  */
 
  * @brief Select management for Disobedience
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include "mem.h"
 #include "hash.h"
 
 #include "mem.h"
 #include "hash.h"
index 6618b176535ac1334b17617877adf8309c69541c..099950109e1f98dc0fedd51ab294247d9ad2f67a 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef SELECTION_H
 #define SELECTION_H
 
 #ifndef SELECTION_H
 #define SELECTION_H
 
+#include "hash.h"
+
 /* Represent a selection using a hash */
 
 hash *selection_new(void);
 /* Represent a selection using a hash */
 
 hash *selection_new(void);
index 2e0df8f933ba531873ec18f519366e4922c579b5..8f753431c520ce4d41549c1d37915f789daa9cc5 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <sys/socket.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <sys/socket.h>
index cc1b339fe548c2f0811992b24b92ec567d9b279a..047e625c6bbd3ad829a2f072b47bd16cd3f3628d 100644 (file)
@@ -18,8 +18,7 @@
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <signal.h>
 #include <stddef.h>
 
 #include <signal.h>
 #include <stddef.h>
index 2c1279b728d471456c74045fc881e9b3f4ee87d6..925bb013c7cf74abf0146d1846d815fa5b05f9ec 100644 (file)
  * @brief Abstract output sink type
  */
 
  * @brief Abstract output sink type
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
 #include <stdarg.h>
 #include <stdarg.h>
-#include <string.h>
 #include <errno.h>
 
 #include "mem.h"
 #include <errno.h>
 
 #include "mem.h"
index 13ea7d4cb422e0b481c70ca2e73b8a15582e348f..aab645b73d74b4699e260c7b4b40bc07716e7266 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef SINK_H
 #define SINK_H
 
 #ifndef SINK_H
 #define SINK_H
 
+#include <stdarg.h>
+
 struct dynstr;
 
 /** @brief Sink type
 struct dynstr;
 
 /** @brief Sink type
index 3b41af7e9c16eb8cc74365cec1327f70dc830710..f738bed275443e1783ba0440e8e61f5b3d28a302 100644 (file)
 #define NO_MEMORY_ALLOCATION
 /* because used from log.c */
 
 #define NO_MEMORY_ALLOCATION
 /* because used from log.c */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
-#include <string.h>
 #include <stdarg.h>
 #include <stddef.h>
 
 #include <stdarg.h>
 #include <stddef.h>
 
index ab8b4ee9354d85e9dbb08583a5b06591ee290609..ef66ed6b89163b77a366a1c2ad165f3c9c2c46b0 100644 (file)
  * @brief Speaker/server protocol support
  */
 
  * @brief Speaker/server protocol support
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <sys/socket.h>
 
 #include <sys/socket.h>
-#include <string.h>
 #include <errno.h>
 #include <unistd.h>
 #include <stddef.h>
 #include <errno.h>
 #include <unistd.h>
 #include <stddef.h>
index 610fb3eb351c5b2f43e326cfc31cc9a1e27a0077..90036d45b4c71322d98bc36a865a4ba46700e9b5 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <ctype.h>
 
 #include <ctype.h>
-#include <string.h>
 #include <errno.h>
 
 #include "mem.h"
 #include <errno.h>
 
 #include "mem.h"
index c398c93cacf586846dc821b6ada761b3e6337ff6..2d0245d5e3e05a46d99078bdefc74166caf03633 100644 (file)
@@ -18,7 +18,7 @@
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
+#include "common.h"
 
 #include <unistd.h>
 #include <errno.h>
 
 #include <unistd.h>
 #include <errno.h>
@@ -27,8 +27,6 @@
 #include <sys/socket.h>
 #include <sys/time.h>
 #include <signal.h>
 #include <sys/socket.h>
 #include <sys/time.h>
 #include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
 
 #include "syscalls.h"
 #include "log.h"
 
 #include "syscalls.h"
 #include "log.h"
index 8e9d9b831ab1b5c133cbb24003c7ba2ae3a90de3..f1f33836241d40e6ee38c655baea9091fdf7d338 100644 (file)
@@ -29,9 +29,6 @@ struct timezone;
 
 #include <sys/socket.h>
 #include <signal.h>
 
 #include <sys/socket.h>
 #include <signal.h>
-#include <stdio.h>
-
-#include "types.h"
 
 pid_t xfork(void);
 void xclose_guts(const char *, int, int);
 
 pid_t xfork(void);
 void xclose_guts(const char *, int, int);
index f2835cbb6d309180d43c3b4df8b9ba5e3e243c7f..d37ffe36960e7fb4ab71c8c66bb70be0d4ca4b04 100644 (file)
@@ -18,9 +18,7 @@
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-
-#include <string.h>
+#include "common.h"
 
 #include "table.h"
 
 
 #include "table.h"
 
index 8cdfcfd985707602cfae7c7cc292dcebef9e5042..a301db70a1280af3faae84613b5574a7d9986e5b 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef TABLE_H
 #define TABLE_H
 
 #ifndef TABLE_H
 #define TABLE_H
 
+#include <stddef.h>
+
 #define TABLE_FIND(TABLE, FIELD, NAME)                 \
   table_find((void *)TABLE,                            \
             offsetof(typeof((TABLE)[0]), FIELD),       \
 #define TABLE_FIND(TABLE, FIELD, NAME)                 \
   table_find((void *)TABLE,                            \
             offsetof(typeof((TABLE)[0]), FIELD),       \
index c2cd10696f4b9cbc6bfc7902290f1f3c03d06093..10b02ea2080693692241ba8addf6aabd432e765d 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef TIMEVAL_H
 #define TIMEVAL_H
 
 #ifndef TIMEVAL_H
 #define TIMEVAL_H
 
+#include <time.h>
+
 static inline struct timeval tvsub(const struct timeval a,
                                    const struct timeval b) {
   struct timeval r;
 static inline struct timeval tvsub(const struct timeval a,
                                    const struct timeval b) {
   struct timeval r;
index 1cfadbc80f48cbf2df270e1e1e3d6d790fa30d08..32a6ca4fc2436490ead8ef76fb196b861e6767d6 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef TRACKDB_INT_H
 #define TRACKDB_INT_H
 
 #ifndef TRACKDB_INT_H
 #define TRACKDB_INT_H
 
+#include <db.h>
+
 #include "kvp.h"
 
 struct vector;                          /* forward declaration */
 #include "kvp.h"
 
 struct vector;                          /* forward declaration */
index 3b92c97627277d14bf921ea88967e2edbee86ca5..6ddb6af2d2479383287842c7baa2df0baffdbd13 100644 (file)
@@ -23,8 +23,7 @@
  * Stubs for non-server builds
  */
 
  * Stubs for non-server builds
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <pcre.h>
 
 
 #include <pcre.h>
 
index e1a0c8039027aac90898b7bdde48e5bababafd5b..689af09853ea92e34b8c214cc940d102ffdb66c6 100644 (file)
  * This file is getting in desparate need of splitting up...
  */
 
  * This file is getting in desparate need of splitting up...
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <string.h>
-#include <stdio.h>
 #include <db.h>
 #include <sys/socket.h>
 #include <pcre.h>
 #include <db.h>
 #include <sys/socket.h>
 #include <pcre.h>
-#include <assert.h>
 #include <unistd.h>
 #include <errno.h>
 #include <stddef.h>
 #include <unistd.h>
 #include <errno.h>
 #include <stddef.h>
index 0aef934824209425e88659fd3ec6f5df7f0e102e..14de98568d4ea33e2a1c369e203d1b0be10b7218 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <pcre.h>
 #include <fnmatch.h>
 
 #include <pcre.h>
 #include <fnmatch.h>
-#include <string.h>
-#include <assert.h>
 
 #include "trackname.h"
 #include "configuration.h"
 
 #include "trackname.h"
 #include "configuration.h"
index a61b89c6c88b1478746438344c596eb295e058d8..80c5b92f6d676393001ceb544afd8e0c3fca6e3b 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <pcre.h>
 #include <fnmatch.h>
 
 #include <pcre.h>
 #include <fnmatch.h>
-#include <string.h>
-#include <assert.h>
 
 #include "trackname.h"
 #include "log.h"
 
 #include "trackname.h"
 #include "log.h"
index 5803926cdce6f124b111f7b37fdf88c32ff0fb14..417ae0780a36a532c38ff0fd3856e43cc6f8f830 100644 (file)
  * - @ref utf8
  */
 
  * - @ref utf8
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
-#include <stdio.h>             /* TODO */
+#include "common.h"
 
 #include "mem.h"
 #include "vector.h"
 
 #include "mem.h"
 #include "vector.h"
index d7bed16aab9c2cfc0fe59e3be6d02abeca022d9a..db4334d1080c4061ec6105a03138230e91b55602 100644 (file)
@@ -1,6 +1,5 @@
 /* Automatically generated file, see scripts/make-unidata */
 /* Automatically generated file, see scripts/make-unidata */
-#include <config.h>
-#include "types.h"
+#include "common.h"
 #include "unidata.h"
 #define Cc unicode_General_Category_Cc
 #define Cf unicode_General_Category_Cf
 #include "unidata.h"
 #define Cc unicode_General_Category_Cc
 #define Cf unicode_General_Category_Cf
index 16f3257d25883ae577feffaab1fb06c58ee6e2d5..b7772829e64a293a30ec21ba8fc25ce9004527f2 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
  * @brief URL support functions
  */
 
  * @brief URL support functions
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
-#include <stdlib.h>
 #include <errno.h>
 #include <errno.h>
-#include <string.h>
 
 #include "mem.h"
 #include "log.h"
 
 #include "mem.h"
 #include "log.h"
index ec01a339bc6a7259294b07d9b98d8d51ce426672..512aaa13489d235fa22b2882b1cab2c2220464d1 100644 (file)
@@ -21,8 +21,7 @@
  * @brief Jukebox user management
  */
 
  * @brief Jukebox user management
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
index 6f397cebb4af5c1ff61d02dc99d5d207a5957c5a..d9fd18b314eb0455fee12efa90ef36e92f8403b3 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <stddef.h>
 
 #include <stddef.h>
-#include <string.h>
 
 #include "mem.h"
 #include "log.h"
 
 #include "mem.h"
 #include "log.h"
index 33f3d353db02242d45a2e8e7aa0bd6a92411dc87..d89376cd7a62e35296c35ac9e32923c273ab0ff4 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef VECTOR_H
 #define VECTOR_H
 
 #ifndef VECTOR_H
 #define VECTOR_H
 
+#include "mem.h"
+
 /** @brief Dynamic array template
  * @param NAME type name
  * @param ETYPE element type
 /** @brief Dynamic array template
  * @param NAME type name
  * @param ETYPE element type
index f92e0c78c01c59d7bb7330294498b09a0b2ab653..a8e2ad1d3c98546e51a7e19dcfc075099dc09195 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <stdio.h>
-#include <stdlib.h>
+#include "common.h"
 
 #include "syscalls.h"
 #include "version.h"
 
 #include "syscalls.h"
 #include "version.h"
index c7d4b9397fa42f9b3ff696adf95e123989aa2a8a..d0f3acf79111b650dea17c4d9eb25c73b0401a8c 100644 (file)
--- a/lib/wav.c
+++ b/lib/wav.c
  * orderings of different channels.
  */
 
  * orderings of different channels.
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
 
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <string.h>
 
 #include "log.h"
 #include "wav.h"
 
 #include "log.h"
 #include "wav.h"
index 67de318acdc3926a325bb92d27d438ba1ff9e60f..0e33d1f652fed5936c01d009825fa1be1270660d 100644 (file)
  * @brief Convert wait status to text
  */
 
  * @brief Convert wait status to text
  */
 
-#include <config.h>
+#include "common.h"
 
 #include <sys/wait.h>
 
 #include <sys/wait.h>
-#include <stdio.h>
-#include <string.h>
 #include <signal.h>
 
 #include "mem.h"
 #include <signal.h>
 
 #include "mem.h"
index 7a0ef5dae61733fce51d76ea0f79e822ea30a0a7..cb26b62068369aa3f8fef7a7ad768f82afc90f49 100644 (file)
 #ifndef TEST_H
 #define TEST_H
 
 #ifndef TEST_H
 #define TEST_H
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
 #include <errno.h>
 #include <ctype.h>
 #include <errno.h>
 #include <ctype.h>
-#include <assert.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
index 4f80cc229ca2cef9ef39f391018be916d12178a4..15ef47c518351539c7807e6c1a915925956bd46b 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <stddef.h>
 
 #include <stddef.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
 
 #include <stdlib.h>
 #include <time.h>
 
index 1230aa76cc3eb09b8a54f5275675e6d8053c8bf4..5611b0d0d6899f7f59d096703760ca71dfef518d 100755 (executable)
@@ -439,8 +439,7 @@ print STDERR "Generating unidata.c...\n";
 open(STDOUT, ">unidata.c") or die "unidata.c: $!\n";
 
 out("/* Automatically generated file, see scripts/make-unidata */\n",
 open(STDOUT, ">unidata.c") or die "unidata.c: $!\n";
 
 out("/* Automatically generated file, see scripts/make-unidata */\n",
-    "#include <config.h>\n",
-    "#include \"types.h\"\n",
+    "#include \"common.h\"\n",
     "#include \"unidata.h\"\n");
 
 # Short aliases to keep .c file small
     "#include \"unidata.h\"\n");
 
 # Short aliases to keep .c file small
index a2b5acf825f2048144832edd7bd8b9122a9ee41a..35571586a5635c17ff53fa8bd3a3b03acb7d4b59 100644 (file)
 sbin_PROGRAMS=disorderd disorder-deadlock disorder-rescan disorder-dump \
              disorder-speaker disorder-decode disorder-normalize \
              disorder-stats disorder-dbupgrade disorder-choose
 sbin_PROGRAMS=disorderd disorder-deadlock disorder-rescan disorder-dump \
              disorder-speaker disorder-decode disorder-normalize \
              disorder-stats disorder-dbupgrade disorder-choose
-noinst_PROGRAMS=disorder.cgi trackname
+noinst_PROGRAMS=trackname
 
 AM_CPPFLAGS=-I${top_srcdir}/lib -I../lib
 
 
 AM_CPPFLAGS=-I${top_srcdir}/lib -I../lib
 
-disorderd_SOURCES=disorderd.c                          \
-       api.c api-server.c                              \
-       daemonize.c daemonize.h                         \
-       play.c play.h                                   \
-       server.c server.h                               \
-       server-queue.c server-queue.h                   \
-       state.c state.h                                 \
-       schedule.c                                      \
-       exports.c                                       \
-       ../lib/memgc.c
+disorderd_SOURCES=disorderd.c api.c api-server.c daemonize.c play.c    \
+       server.c server-queue.c queue-ops.c state.c plugin.c            \
+       schedule.c exports.c ../lib/memgc.c
 disorderd_LDADD=$(LIBOBJS) ../lib/libdisorder.a \
        $(LIBPCRE) $(LIBDB) $(LIBAO) $(LIBGC) $(LIBGCRYPT) $(LIBICONV) \
        $(LIBASOUND) $(COREAUDIO)
 disorderd_LDADD=$(LIBOBJS) ../lib/libdisorder.a \
        $(LIBPCRE) $(LIBDB) $(LIBAO) $(LIBGC) $(LIBGCRYPT) $(LIBICONV) \
        $(LIBASOUND) $(COREAUDIO)
@@ -66,20 +59,14 @@ disorder_normalize_LDADD=$(LIBOBJS) ../lib/libdisorder.a \
        $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT)
 disorder_normalize_DEPENDENCIES=../lib/libdisorder.a
 
        $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT)
 disorder_normalize_DEPENDENCIES=../lib/libdisorder.a
 
-disorder_rescan_SOURCES=rescan.c                        \
-       api.c api-server.c                              \
-       exports.c                                       \
+disorder_rescan_SOURCES=rescan.c plugin.c api.c api-server.c exports.c \
        ../lib/memgc.c
 disorder_rescan_LDADD=$(LIBOBJS) ../lib/libdisorder.a \
        $(LIBDB) $(LIBGC) $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT)
 disorder_rescan_LDFLAGS=-export-dynamic
 disorder_rescan_DEPENDENCIES=../lib/libdisorder.a
 
        ../lib/memgc.c
 disorder_rescan_LDADD=$(LIBOBJS) ../lib/libdisorder.a \
        $(LIBDB) $(LIBGC) $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT)
 disorder_rescan_LDFLAGS=-export-dynamic
 disorder_rescan_DEPENDENCIES=../lib/libdisorder.a
 
-disorder_choose_SOURCES=choose.c                        \
-       server-queue.c server-queue.h                   \
-        api.c api-server.c                              \
-        exports.c                                      \
-       ../lib/memgc.c
+disorder_choose_SOURCES=choose.c server-queue.c ../lib/memgc.c
 disorder_choose_LDADD=$(LIBOBJS) ../lib/libdisorder.a   \
        $(LIBDB) $(LIBGC) $(LIBPCRE) $(LIBGCRYPT)
 disorder_choose_LDFLAGS=-export-dynamic
 disorder_choose_LDADD=$(LIBOBJS) ../lib/libdisorder.a   \
        $(LIBDB) $(LIBGC) $(LIBPCRE) $(LIBGCRYPT)
 disorder_choose_LDFLAGS=-export-dynamic
@@ -101,15 +88,6 @@ disorder_dbupgrade_LDADD=$(LIBOBJS) ../lib/libdisorder.a \
        $(LIBDB) $(LIBGC) $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT)
 disorder_dbupgrade_DEPENDENCIES=../lib/libdisorder.a
 
        $(LIBDB) $(LIBGC) $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT)
 disorder_dbupgrade_DEPENDENCIES=../lib/libdisorder.a
 
-disorder_cgi_SOURCES=macros-disorder.c macros-disorder.h lookup.c      \
-       lookup.h options.c options.h actions.c actions.h login.c        \
-       login.h api.c                                                   \
-       api-client.c api-client.h cgimain.c exports.c
-disorder_cgi_LDADD=../lib/libdisorder.a \
-       $(LIBPCRE) $(LIBGCRYPT) $(LIBDL) $(LIBDB)
-disorder_cgi_LDFLAGS=-export-dynamic
-disorder_cgi_DEPENDENCIES=../lib/libdisorder.a
-
 trackname_SOURCES=trackname.c
 trackname_LDADD=../lib/libdisorder.a $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT)
 trackname_DEPENDENCIES=../lib/libdisorder.a
 trackname_SOURCES=trackname.c
 trackname_LDADD=../lib/libdisorder.a $(LIBPCRE) $(LIBICONV) $(LIBGCRYPT)
 trackname_DEPENDENCIES=../lib/libdisorder.a
@@ -157,6 +135,4 @@ check-decode: disorder-decode disorder-normalize
        cmp decoded.raw oggdec.raw
        rm -f scratch.wav config decoded.raw oggdec.raw
 
        cmp decoded.raw oggdec.raw
        rm -f scratch.wav config decoded.raw oggdec.raw
 
-cgi.o: ../lib/definitions.h
-
 EXTRA_DIST=README.dbversions
 EXTRA_DIST=README.dbversions
index 2f6a01f4f62bc0ec47993a1b60390ec9b6df70f4..174ed88cc0a76dc0f81a7f50fad45e2acefeeb76 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 
-#include <stdio.h>
 #include <errno.h>
 #include <errno.h>
-#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <locale.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <locale.h>
index bc8144e5b8e551e5bb52242bbb14dea9aa2d2f16..173c82e4f183bc0fc01d796cc50484c117e96378 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <pcre.h>
-
-#include "log.h"
-#include "mem.h"
-#include "disorder.h"
-#include "event.h"
-#include "rights.h"
-#include "trackdb.h"
+#include "disorder-server.h"
 
 int disorder_track_exists(const char *track)  {
   return trackdb_exists(track);
 
 int disorder_track_exists(const char *track)  {
   return trackdb_exists(track);
index 536646813971984709fb0f2016b1160c5657a5a5..11564f85cb1da0e5716bcae2efb768387e16089a 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <syslog.h>
-
-#include "log.h"
-#include "mem.h"
-#include "disorder.h"
-#include "printf.h"
+#include "disorder-server.h"
 
 /* shared implementation of vararg functions */
 #include "log-impl.h"
 
 /* shared implementation of vararg functions */
 #include "log-impl.h"
index c39e27b583a7a8ea62312a5c38cbf8cc23af28ca..f1d06b80c6723fffb465e982a495e954397a0133 100644 (file)
  * deadlock - it just exits and expects the server to try again.
  */
 
  * deadlock - it just exits and expects the server to try again.
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <db.h>
-#include <locale.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <pcre.h>
-#include <string.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <time.h>
-
-#include "configuration.h"
-#include "log.h"
-#include "defs.h"
-#include "mem.h"
-#include "kvp.h"
-#include "syscalls.h"
-#include "printf.h"
-#include "trackdb.h"
-#include "trackdb-int.h"
-#include "version.h"
-#include "trackname.h"
-#include "queue.h"
-#include "server-queue.h"
-#include "random.h"
+#include "disorder-server.h"
 
 #define BASE_WEIGHT 90000
 
 
 #define BASE_WEIGHT 90000
 
index 7dea7000706c25977a5611fab9b73970e970f59f..5f6e2260640b69909968f39f23dd85614aedc337 100644 (file)
  * @brief Go into background
  */
 
  * @brief Go into background
  */
 
-#include <config.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/wait.h>
-#include <syslog.h>
-
-#include "daemonize.h"
-#include "syscalls.h"
-#include "log.h"
+#include "disorder-server.h"
 
 /** @brief Go into background
  * @param tag Message tag, or NULL
 
 /** @brief Go into background
  * @param tag Message tag, or NULL
diff --git a/server/daemonize.h b/server/daemonize.h
deleted file mode 100644 (file)
index 23d88a6..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004, 2007, 2008 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-/** @file server/daemonize.h
- * @brief Go into background
- */
-
-#ifndef DAEMONIZE_H
-#define DAEMONIZE_H
-
-void daemonize(const char *tag, int fac, const char *pidfile);
-/* Go into background.  Send stdout/stderr to syslog.
- * If @pri@ is non-null, it should be "facility.level"
- * If @tag@ is non-null, it is used as a tag to each message
- * If @pidfile@ is non-null, the PID is written to that file.
- */
-
-#endif /* DAEMONIZE_H */
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-End:
-*/
index f972b5984f25e5746e6fef8274fc5b9c7388106b..74354b714d82615ebef824846d86eedcc2d8d664 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
-
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
-#include <getopt.h>
-#include <db.h>
-#include <locale.h>
-#include <errno.h>
-#include <syslog.h>
-#include <pcre.h>
-#include <unistd.h>
-
-#include "syscalls.h"
-#include "log.h"
-#include "defs.h"
-#include "kvp.h"
-#include "rights.h"
-#include "trackdb.h"
-#include "trackdb-int.h"
-#include "mem.h"
-#include "configuration.h"
-#include "unicode.h"
-#include "version.h"
+#include "disorder-server.h"
 
 static DB_TXN *global_tid;
 
 
 static DB_TXN *global_tid;
 
@@ -138,9 +115,9 @@ static int scan_core(const char *name, DB *db,
  * Everything happens inside the @p global_tid tranasction.  @p callback
  * should return 0 or DB_LOCK_DEADLOCK.
  */
  * Everything happens inside the @p global_tid tranasction.  @p callback
  * should return 0 or DB_LOCK_DEADLOCK.
  */
-static void scan(const char *name, DB *db,
-                 int (*callback)(const char *name, DB *db, DBC *c,
-                                 DBT *k, DBT *d)) {
+static void scandb(const char *name, DB *db,
+                   int (*callback)(const char *name, DB *db, DBC *c,
+                                   DBT *k, DBT *d)) {
   info("scanning %s", name);
   for(;;) {
     global_tid = trackdb_begin_transaction();
   info("scanning %s", name);
   for(;;) {
     global_tid = trackdb_begin_transaction();
@@ -312,16 +289,16 @@ static void upgrade(void) {
   /* Normalize keys and values as required.  We will also remove aliases as
    * they will be regenerated when we re-noticed the tracks. */
   info("renormalizing keys");
   /* Normalize keys and values as required.  We will also remove aliases as
    * they will be regenerated when we re-noticed the tracks. */
   info("renormalizing keys");
-  scan("tracks.db", trackdb_tracksdb, remove_aliases_normalize_keys);
-  scan("prefs.db", trackdb_prefsdb, normalize_keys);
-  scan("global.db", trackdb_globaldb, normalize_keys);
-  scan("noticed.db", trackdb_noticeddb, normalize_values);
+  scandb("tracks.db", trackdb_tracksdb, remove_aliases_normalize_keys);
+  scandb("prefs.db", trackdb_prefsdb, normalize_keys);
+  scandb("global.db", trackdb_globaldb, normalize_keys);
+  scandb("noticed.db", trackdb_noticeddb, normalize_values);
   /* search.db and tags.db we will rebuild */
   info("regenerating search database and aliases");
   truncate_database("search.db", trackdb_searchdb);
   truncate_database("tags.db", trackdb_tagsdb);
   /* Regenerate the search database and aliases */
   /* search.db and tags.db we will rebuild */
   info("regenerating search database and aliases");
   truncate_database("search.db", trackdb_searchdb);
   truncate_database("tags.db", trackdb_tagsdb);
   /* Regenerate the search database and aliases */
-  scan("tracks.db", trackdb_tracksdb, renotice);
+  scandb("tracks.db", trackdb_tracksdb, renotice);
   /* Finally update the database version */
   snprintf(buf, sizeof buf, "%ld", config->dbversion);
   trackdb_set_global("_dbversion", buf, 0);
   /* Finally update the database version */
   snprintf(buf, sizeof buf, "%ld", config->dbversion);
   trackdb_set_global("_dbversion", buf, 0);
index dba28d3e7e3b846847e5d1dd5c74bb4f88c82f28..1a473018feb0129555c1a78d1706fc2a9a32b73e 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <db.h>
-#include <locale.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <pcre.h>
-#include <string.h>
-#include <syslog.h>
-
-#include "configuration.h"
-#include "syscalls.h"
-#include "log.h"
-#include "defs.h"
-#include "mem.h"
-#include "kvp.h"
-#include "rights.h"
-#include "trackdb.h"
-#include "trackdb-int.h"
-#include "version.h"
+#include "disorder-server.h"
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
index c693c759f6f3321fc70aae38a4dd72e7b045f12f..3a1e1a9f6a891b41105875cf42defe6c2c954e55 100644 (file)
  * @brief General-purpose decoder for use by speaker process
  */
 
  * @brief General-purpose decoder for use by speaker process
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <getopt.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <locale.h>
-#include <assert.h>
-#include <fnmatch.h>
+#include "disorder-server.h"
+
 #include <mad.h>
 #include <vorbis/vorbisfile.h>
 #include <mad.h>
 #include <vorbis/vorbisfile.h>
-#include <string.h>
 
 /* libFLAC has had an API change and stupidly taken away the old API */
 #if HAVE_FLAC_FILE_DECODER_H
 
 /* libFLAC has had an API change and stupidly taken away the old API */
 #if HAVE_FLAC_FILE_DECODER_H
 #define FLAC__FileDecoderState FLAC__StreamDecoderState
 #endif
 
 #define FLAC__FileDecoderState FLAC__StreamDecoderState
 #endif
 
-#include "log.h"
-#include "syscalls.h"
-#include "defs.h"
 #include "wav.h"
 #include "speaker-protocol.h"
 #include "wav.h"
 #include "speaker-protocol.h"
-#include "version.h"
 
 /** @brief Encoding lookup table type */
 struct decoder {
 
 /** @brief Encoding lookup table type */
 struct decoder {
diff --git a/server/disorder-server.h b/server/disorder-server.h
new file mode 100644 (file)
index 0000000..361bd4f
--- /dev/null
@@ -0,0 +1,332 @@
+/*
+ * This file is part of DisOrder
+ * Copyright (C) 2008 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef DISORDER_SERVER_H
+#define DISORDER_SERVER_H
+
+#include "common.h"
+
+#include <db.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <fnmatch.h>
+#include <gcrypt.h>
+#include <getopt.h>
+#include <grp.h>
+#include <locale.h>
+#include <netinet/in.h>
+#include <pcre.h>
+#include <pwd.h>
+#include <signal.h>
+#include <stddef.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <syslog.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "addr.h"
+#include "authhash.h"
+#include "base64.h"
+#include "cache.h"
+#include "charset.h"
+#include "configuration.h"
+#include "cookies.h"
+#include "defs.h"
+#include "disorder.h"
+#include "event.h"
+#include "eventlog.h"
+#include "eventlog.h"
+#include "hash.h"
+#include "hex.h"
+#include "inputline.h"
+#include "kvp.h"
+#include "log.h"
+#include "logfd.h"
+#include "mem.h"
+#include "mime.h"
+#include "mixer.h"
+#include "printf.h"
+#include "queue.h"
+#include "random.h"
+#include "rights.h"
+#include "sendmail.h"
+#include "sink.h"
+#include "speaker-protocol.h"
+#include "split.h"
+#include "syscalls.h"
+#include "table.h"
+#include "trackdb-int.h"
+#include "trackdb.h"
+#include "trackname.h"
+#include "unicode.h"
+#include "user.h"
+#include "vector.h"
+#include "version.h"
+#include "wstat.h"
+
+void daemonize(const char *tag, int fac, const char *pidfile);
+/* Go into background.  Send stdout/stderr to syslog.
+ * If @pri@ is non-null, it should be "facility.level"
+ * If @tag@ is non-null, it is used as a tag to each message
+ * If @pidfile@ is non-null, the PID is written to that file.
+ */
+
+void quit(ev_source *ev) attribute((noreturn));
+/* terminate the daemon */
+
+int reconfigure(ev_source *ev, int reload);
+/* reconfigure.  If @reload@ is nonzero, update the configuration. */
+
+extern struct queue_entry qhead;
+/* queue of things yet to be played.  the head will be played
+ * soonest. */
+
+extern struct queue_entry phead;
+/* things that have been played in the past.  the head is the oldest. */
+
+extern long pcount;
+
+void queue_read(void);
+/* read the queue in.  Calls @fatal@ on error. */
+
+void queue_write(void);
+/* write the queue out.  Calls @fatal@ on error. */
+
+void recent_read(void);
+/* read the recently played list in.  Calls @fatal@ on error. */
+
+void recent_write(void);
+/* write the recently played list out.  Calls @fatal@ on error. */
+
+struct queue_entry *queue_add(const char *track, const char *submitter,
+                             int where);
+#define WHERE_START 0                  /* Add to head of queue */
+#define WHERE_END 1                    /* Add to end of queue */
+#define WHERE_BEFORE_RANDOM 2          /* End, or before random track */
+/* add an entry to the queue.  Return a pointer to the new entry. */
+
+void queue_remove(struct queue_entry *q, const char *who);
+/* remove an from the queue */
+
+struct queue_entry *queue_find(const char *key);
+/* find a track in the queue by name or ID */
+
+void queue_played(struct queue_entry *q);
+/* add @q@ to the played list */
+
+int queue_move(struct queue_entry *q, int delta, const char *who);
+/* move element @q@ in the queue towards the front (@delta@ > 0) or towards the
+ * back (@delta@ < 0).  The return value is the leftover delta once we've hit
+ * the end in whichever direction we were going. */
+
+void queue_moveafter(struct queue_entry *target,
+                    int nqs, struct queue_entry **qs, const char *who);
+/* Move all the elements QS to just after TARGET, or to the head if
+ * TARGET=0. */
+
+void queue_fix_sofar(struct queue_entry *q);
+/* Fix up the sofar field for standalone players */
+
+void schedule_init(ev_source *ev);
+const char *schedule_add(ev_source *ev,
+                        struct kvp *actiondata);
+int schedule_del(const char *id);
+struct kvp *schedule_get(const char *id);
+char **schedule_list(int *neventsp);
+
+extern struct queue_entry *playing;    /* playing track or 0 */
+extern int paused;                     /* non-0 if paused */
+
+void play(ev_source *ev);
+/* try to play something, if playing is enabled and nothing is playing
+ * already */
+
+int playing_is_enabled(void);
+/* return true iff playing is enabled */
+
+void enable_playing(const char *who, ev_source *ev);
+/* enable playing */
+
+void disable_playing(const char *who);
+/* disable playing. */
+
+int random_is_enabled(void);
+/* return true iff random play is enabled */
+
+void enable_random(const char *who, ev_source *ev);
+/* enable random play */
+
+void disable_random(const char *who);
+/* disable random play */
+
+void scratch(const char *who, const char *id);
+/* scratch the playing track.  @who@ identifies the scratcher. @id@ is
+ * the ID or a null pointer. */
+
+void quitting(ev_source *ev);
+/* called to terminate current track and shut down speaker process
+ * when quitting */
+
+void speaker_setup(ev_source *ev);
+/* set up the speaker subprocess */
+
+void speaker_reload(void);
+/* Tell the speaker process to reload its configuration. */
+
+int pause_playing(const char *who);
+/* Pause the current track.  Return 0 on success, -1 on error.  WHO
+ * can be 0. */
+
+void resume_playing(const char *who);
+/* Resume after a pause.  WHO can be 0. */
+
+int prepare(ev_source *ev,
+           struct queue_entry *q);
+/* Prepare to play Q */
+
+void abandon(ev_source *ev,
+            struct queue_entry *q);
+/* Abandon a possibly-prepared track. */
+
+void add_random_track(ev_source *ev);
+/* If random play is enabled then try to add a track to the queue. */
+
+int server_start(ev_source *ev, int pf,
+                size_t socklen, const struct sockaddr *sa,
+                const char *name);
+/* start listening.  Return the fd. */
+
+int server_stop(ev_source *ev, int fd);
+/* Stop listening on @fd@ */
+
+extern int volume_left, volume_right;  /* last known volume */
+
+extern int wideopen;                   /* blindly accept all logins */
+
+/* plugins */
+
+struct plugin;
+
+typedef void *plugin_handle;
+typedef void function_t(void);
+
+const struct plugin *open_plugin(const char *name,
+                                unsigned flags);
+#define PLUGIN_FATAL 0x0001            /* fatal() on error */
+/* Open a plugin.  Returns a null pointer on error or a handle to it
+ * on success. */
+
+function_t *get_plugin_function(const struct plugin *handle,
+                               const char *symbol);
+const void *get_plugin_object(const struct plugin *handle,
+                             const char *symbol);
+/* Look up a function or an object in a plugin */
+
+/* track length computation ***************************************************/
+
+long tracklength(const char *plugin, const char *track, const char *path);
+
+/* collection interface *******************************************************/
+
+void scan(const char *module, const char *root);
+/* write a list of path names below @root@ to standard output. */
+  
+int check(const char *module, const char *root, const char *path);
+/* Recheck a track, given its root and path name.  Return 1 if it
+ * exists, 0 if it does not exist and -1 if an error occurred. */
+
+/* notification interface *****************************************************/
+
+void notify_play(const char *track,
+                const char *submitter);
+/* we're going to play @track@.  It was submitted by @submitter@
+ * (might be a null pointer) */
+
+void notify_scratch(const char *track,
+                   const char *submitter,
+                   const char *scratcher,
+                   int seconds);
+/* @scratcher@ scratched @track@ after @seconds@.  It was submitted by
+ * @submitter@ (might be a null pointer) */
+
+void notify_not_scratched(const char *track,
+                         const char *submitter);
+/* @track@ (submitted by @submitter@, which might be a null pointer)
+ * was not scratched. */
+
+void notify_queue(const char *track,
+                 const char *submitter);
+/* @track@ was queued by @submitter@ */
+
+void notify_queue_remove(const char *track,
+                        const char *remover);
+/* @track@ removed from the queue by @remover@ (never a null pointer) */
+
+void notify_queue_move(const char *track,
+                      const char *mover);
+/* @track@ moved in the queue by @mover@ (never a null pointer) */
+
+void notify_pause(const char *track,
+                 const char *pauser);
+/* TRACK was paused by PAUSER (might be a null pointer) */
+
+void notify_resume(const char *track,
+                  const char *resumer);
+/* TRACK was resumed by PAUSER (might be a null pointer) */
+
+/* track playing **************************************************************/
+
+unsigned long play_get_type(const struct plugin *pl);
+/* Get the type word for this plugin */
+
+void *play_prefork(const struct plugin *pl,
+                  const char *track);
+/* Call the prefork function for PL and return the user data */
+
+void play_track(const struct plugin *pl,
+               const char *const *parameters,
+               int nparameters,
+               const char *path,
+               const char *track);
+/* play a track.  Called inside a fork. */
+
+void play_cleanup(const struct plugin *pl, void *data);
+/* Call the cleanup function for PL if necessary */
+
+int play_pause(const struct plugin *pl, long *playedp, void *data);
+/* Pause track. */
+
+void play_resume(const struct plugin *pl, void *data);
+/* Resume track. */
+
+#endif /* DISORDER_SERVER_H */
+
+/*
+Local Variables:
+c-basic-offset:2
+comment-column:40
+fill-column:79
+indent-tabs-mode:nil
+End:
+*/
index 9f444b683dd84d246cd6342f6804d5ea713c9d85..e78c28fc69ea511f76f78b8d28803682b73445e8 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
-
-#include <config.h>
-#include "types.h"
-
-#include <stdio.h>
-#include <getopt.h>
-#include <pwd.h>
-#include <grp.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <time.h>
-#include <locale.h>
-#include <syslog.h>
-#include <sys/time.h>
-#include <pcre.h>
-#include <fcntl.h>
-#include <gcrypt.h>
-
-#include "daemonize.h"
-#include "event.h"
-#include "log.h"
-#include "configuration.h"
-#include "rights.h"
-#include "trackdb.h"
-#include "queue.h"
-#include "mem.h"
-#include "play.h"
-#include "server.h"
-#include "state.h"
-#include "syscalls.h"
-#include "defs.h"
-#include "user.h"
-#include "mixer.h"
-#include "eventlog.h"
-#include "printf.h"
-#include "version.h"
+#include "disorder-server.h"
 
 static ev_source *ev;
 
 
 static ev_source *ev;
 
index 7b4b3a49a90eb02b7c8e241d5d275d747a0bb9e1..aec180407c40554d8f55480b9206160db5a99703 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <getopt.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <pcre.h>
-#include <unistd.h>
-#include <db.h>
-#include <fcntl.h>
-
-#include "configuration.h"
-#include "syscalls.h"
-#include "log.h"
-#include "client.h"
-#include "sink.h"
-#include "mem.h"
-#include "defs.h"
-#include "printf.h"
-#include "kvp.h"
-#include "vector.h"
-#include "inputline.h"
-#include "rights.h"
-#include "trackdb.h"
-#include "trackdb-int.h"
-#include "charset.h"
-#include "version.h"
+#include "disorder-server.h"
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
index 6d8823ebcc5f039490fe960dd6a142b9ef6715b8..956eb6b7a973a89e50fa67e08243981da767ef2c 100644 (file)
  * and eliminate the dependency on sox.
  */
 
  * and eliminate the dependency on sox.
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <getopt.h>
-#include <locale.h>
-#include <errno.h>
-#include <unistd.h>
-#include <syslog.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "syscalls.h"
-#include "log.h"
-#include "configuration.h"
-#include "speaker-protocol.h"
-#include "defs.h"
-#include "version.h"
+#include "disorder-server.h"
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
index df9158b4fb0eab63c5d124d7dfc8ba11b884d284..756031de34951b1f9e887fa2444dd1198a88c8dd 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fnmatch.h>
-#include <time.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <sys/socket.h>
-#include <string.h>
-#include <stdio.h>
-#include <pcre.h>
+#include "disorder-server.h"
 #include <ao/ao.h>
 #include <ao/ao.h>
-#include <sys/wait.h>
-#include <sys/un.h>
-
-#include "event.h"
-#include "log.h"
-#include "mem.h"
-#include "configuration.h"
-#include "queue.h"
-#include "server-queue.h"
-#include "rights.h"
-#include "trackdb.h"
-#include "play.h"
-#include "plugin.h"
-#include "wstat.h"
-#include "eventlog.h"
-#include "logfd.h"
-#include "syscalls.h"
-#include "speaker-protocol.h"
-#include "disorder.h"
-#include "signame.h"
-#include "hash.h"
 
 #define SPEAKER "disorder-speaker"
 
 
 #define SPEAKER "disorder-speaker"
 
diff --git a/server/play.h b/server/play.h
deleted file mode 100644 (file)
index aff474c..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004-2008 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef PLAY_H
-#define PLAY_H
-
-extern struct queue_entry *playing;    /* playing track or 0 */
-extern int paused;                     /* non-0 if paused */
-
-void play(ev_source *ev);
-/* try to play something, if playing is enabled and nothing is playing
- * already */
-
-int playing_is_enabled(void);
-/* return true iff playing is enabled */
-
-void enable_playing(const char *who, ev_source *ev);
-/* enable playing */
-
-void disable_playing(const char *who);
-/* disable playing. */
-
-int random_is_enabled(void);
-/* return true iff random play is enabled */
-
-void enable_random(const char *who, ev_source *ev);
-/* enable random play */
-
-void disable_random(const char *who);
-/* disable random play */
-
-void scratch(const char *who, const char *id);
-/* scratch the playing track.  @who@ identifies the scratcher. @id@ is
- * the ID or a null pointer. */
-
-void quitting(ev_source *ev);
-/* called to terminate current track and shut down speaker process
- * when quitting */
-
-void speaker_setup(ev_source *ev);
-/* set up the speaker subprocess */
-
-void speaker_reload(void);
-/* Tell the speaker process to reload its configuration. */
-
-int pause_playing(const char *who);
-/* Pause the current track.  Return 0 on success, -1 on error.  WHO
- * can be 0. */
-
-void resume_playing(const char *who);
-/* Resume after a pause.  WHO can be 0. */
-
-int prepare(ev_source *ev,
-           struct queue_entry *q);
-/* Prepare to play Q */
-
-void abandon(ev_source *ev,
-            struct queue_entry *q);
-/* Abandon a possibly-prepared track. */
-
-void add_random_track(ev_source *ev);
-/* If random play is enabled then try to add a track to the queue. */
-
-#endif /* PLAY_H */
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-fill-column:79
-End:
-*/
similarity index 96%
rename from lib/plugin.c
rename to server/plugin.c
index c23865d9f9f3cac377df19e0c0980421d8af7415..a0c7d356268fe40b2a59d83fd5396fdbe54149d3 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "disorder-server.h"
 
 #include <dlfcn.h>
 
 #include <dlfcn.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "plugin.h"
-#include "configuration.h"
-#include "log.h"
-#include "mem.h"
-#include "defs.h"
-#include "disorder.h"
-#include "printf.h"
 
 /* generic plugin support *****************************************************/
 
 
 /* generic plugin support *****************************************************/
 
diff --git a/server/queue-ops.c b/server/queue-ops.c
new file mode 100644 (file)
index 0000000..952cb71
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * This file is part of DisOrder.
+ * Copyright (C) 2004-2008 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+#include "disorder-server.h"
+
+static int find_in_list(struct queue_entry *needle,
+                       int nqs, struct queue_entry **qs) {
+  int n;
+
+  for(n = 0; n < nqs; ++n)
+    if(qs[n] == needle)
+      return 1;
+  return 0;
+}
+
+static int id_in_use(const char *id) {
+  struct queue_entry *q;
+
+  for(q = qhead.next; q != &qhead; q = q->next)
+    if(!strcmp(id, q->id))
+      return 1;
+  return 0;
+}
+
+static void queue_id(struct queue_entry *q) {
+  const char *id;
+
+  id = random_id();
+  while(id_in_use(id))
+    id = random_id();
+  q->id = id;
+}
+
+struct queue_entry *queue_add(const char *track, const char *submitter,
+                             int where) {
+  struct queue_entry *q, *beforeme;
+
+  q = xmalloc(sizeof *q);
+  q->track = xstrdup(track);
+  q->submitter = submitter ? xstrdup(submitter) : 0;
+  q->state = playing_unplayed;
+  queue_id(q);
+  time(&q->when);
+  switch(where) {
+  case WHERE_START:
+    queue_insert_entry(&qhead, q);
+    break;
+  case WHERE_END:
+    queue_insert_entry(qhead.prev, q);
+    break;
+  case WHERE_BEFORE_RANDOM:
+    /* We want to find the point in the queue before the block of random tracks
+     * at the end. */
+    beforeme = &qhead;
+    while(beforeme->prev != &qhead
+         && beforeme->prev->state == playing_random)
+      beforeme = beforeme->prev;
+    queue_insert_entry(beforeme->prev, q);
+    break;
+  }
+  /* submitter will be a null pointer for a scratch */
+  if(submitter)
+    notify_queue(track, submitter);
+  eventlog_raw("queue", queue_marshall(q), (const char *)0);
+  return q;
+}
+
+int queue_move(struct queue_entry *q, int delta, const char *who) {
+  int moved = 0;
+  char buffer[20];
+
+  /* not the most efficient approach but hopefuly relatively comprehensible:
+   * the idea is that for each step we determine which nodes are affected, and
+   * fill in all the links starting at the 'prev' end and moving towards the
+   * 'next' end. */
+  
+  while(delta > 0 && q->prev != &qhead) {
+    struct queue_entry *n, *p, *pp;
+
+    n = q->next;
+    p = q->prev;
+    pp = p->prev;
+    pp->next = q;
+    q->prev = pp;
+    q->next = p;
+    p->prev = q;
+    p->next = n;
+    n->prev = p;
+    --delta;
+    ++moved;
+  }
+
+  while(delta < 0 && q->next != &qhead) {
+    struct queue_entry *n, *p, *nn;
+
+    p = q->prev;
+    n = q->next;
+    nn = n->next;
+    p->next = n;
+    n->prev = p;
+    n->next = q;
+    q->prev = n;
+    q->next = nn;
+    nn->prev = q;
+    ++delta;
+    --moved;
+  }
+
+  if(moved) {
+    info("user %s moved %s", who, q->id);
+    notify_queue_move(q->track, who);
+    sprintf(buffer, "%d", moved);
+    eventlog("moved", who, (char *)0);
+  }
+  
+  return delta;
+}
+
+void queue_moveafter(struct queue_entry *target,
+                    int nqs, struct queue_entry **qs,
+                    const char *who) {
+  struct queue_entry *q;
+  int n;
+
+  /* Normalize */
+  if(!target)
+    target = &qhead;
+  else
+    while(find_in_list(target, nqs, qs))
+      target = target->prev;
+  /* Do the move */
+  for(n = 0; n < nqs; ++n) {
+    q = qs[n];
+    queue_delete_entry(q);
+    queue_insert_entry(target, q);
+    target = q;
+    /* Log the individual tracks */
+    info("user %s moved %s", who, q->id);
+    notify_queue_move(q->track, who);
+  }
+  /* Report that the queue changed to the event log */
+  eventlog("moved", who, (char *)0);
+}
+
+void queue_remove(struct queue_entry *which, const char *who) {
+  if(who) {
+    info("user %s removed %s", who, which->id);
+    notify_queue_move(which->track, who);
+  }
+  eventlog("removed", which->id, who, (const char *)0);
+  queue_delete_entry(which);
+}
+
+void queue_played(struct queue_entry *q) {
+  while(pcount && pcount >= config->history) {
+    eventlog("recent_removed", phead.next->id, (char *)0);
+    queue_delete_entry(phead.next);
+    pcount--;
+  }
+  if(config->history) {
+    eventlog_raw("recent_added", queue_marshall(q), (char *)0);
+    queue_insert_entry(phead.prev, q);
+    ++pcount;
+  }
+}
+
+/*
+Local Variables:
+c-basic-offset:2
+comment-column:40
+fill-column:79
+indent-tabs-mode:nil
+End:
+*/
index 2d390f815e00468e3f0049783aebf95853a00b6c..04ffba460febe43ec5e8e5d747e5ba3134474fd1 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <db.h>
-#include <locale.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <pcre.h>
-#include <fnmatch.h>
-#include <sys/wait.h>
-#include <string.h>
-#include <syslog.h>
-#include <time.h>
-
-#include "configuration.h"
-#include "syscalls.h"
-#include "log.h"
-#include "defs.h"
-#include "mem.h"
-#include "plugin.h"
-#include "inputline.h"
-#include "charset.h"
-#include "wstat.h"
-#include "kvp.h"
-#include "printf.h"
-#include "rights.h"
-#include "trackdb.h"
-#include "trackdb-int.h"
-#include "trackname.h"
-#include "unicode.h"
-#include "version.h"
+#include "disorder-server.h"
 
 static DB_TXN *global_tid;
 
 
 static DB_TXN *global_tid;
 
index 4f0b34e7de8a18e271b3e2e7fd64d47f77e4ff2f..6092fb5b227e9dc95b896ae268befc1ea989e387 100644 (file)
  *
  * TODO: add disorder-dump support
  */
  *
  * TODO: add disorder-dump support
  */
-
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
-#include <db.h>
-#include <time.h>
-#include <stddef.h>
-
-#include "trackdb.h"
-#include "trackdb-int.h"
-#include "schedule.h"
-#include "table.h"
-#include "kvp.h"
-#include "log.h"
-#include "queue.h"
-#include "server-queue.h"
-#include "state.h"
-#include "play.h"
-#include "mem.h"
-#include "random.h"
-#include "vector.h"
+#include "disorder-server.h"
 
 static int schedule_trigger(ev_source *ev,
                            const struct timeval *now,
 
 static int schedule_trigger(ev_source *ev,
                            const struct timeval *now,
diff --git a/server/schedule.h b/server/schedule.h
deleted file mode 100644 (file)
index 0c7efa1..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of DisOrder
- * Copyright (C) 2008 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef SCHEDULE_H
-#define SCHEDULE_H
-
-void schedule_init(ev_source *ev);
-const char *schedule_add(ev_source *ev,
-                        struct kvp *actiondata);
-int schedule_del(const char *id);
-struct kvp *schedule_get(const char *id);
-char **schedule_list(int *neventsp);
-
-#endif /* SCHEDULE_H */
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-fill-column:79
-indent-tabs-mode:nil
-End:
-*/
index b71d67773571298491b30f1c40a2210d02d6eaa4..a83ee56e9d08092fbbef3608d9677a2714a5e138 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
-
-#include <config.h>
-#include "types.h"
-
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
-
-#include "mem.h"
-#include "log.h"
-#include "split.h"
-#include "printf.h"
-#include "queue.h"
-#include "server-queue.h"
-#include "eventlog.h"
-#include "plugin.h"
-#include "random.h"
-#include "configuration.h"
-#include "inputline.h"
-#include "disorder.h"
+#include "disorder-server.h"
 
 /* the head of the queue is played next, so normally we add to the tail */
 struct queue_entry qhead = { &qhead, &qhead, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 
 /* the head of the queue is played next, so normally we add to the tail */
 struct queue_entry qhead = { &qhead, &qhead, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -47,21 +26,7 @@ struct queue_entry qhead = { &qhead, &qhead, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  * played */
 struct queue_entry phead = { &phead, &phead, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 
  * played */
 struct queue_entry phead = { &phead, &phead, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 
-static long pcount;
-
-/* add new entry @n@ to a doubly linked list just after @b@ */
-static void l_add(struct queue_entry *b, struct queue_entry *n) {
-  n->prev = b;
-  n->next = b->next;
-  n->next->prev = n;
-  n->prev->next = n;
-}
-
-/* remove an entry from a doubly-linked list */
-static void l_remove(struct queue_entry *node) {
-  node->next->prev = node->prev;
-  node->prev->next = node->next;
-}
+long pcount;
 
 void queue_fix_sofar(struct queue_entry *q) {
   long sofar;
 
 void queue_fix_sofar(struct queue_entry *q) {
   long sofar;
@@ -110,7 +75,7 @@ static void queue_do_read(struct queue_entry *head, const char *path) {
        && (!q->track
           || !q->when))
       fatal(0, "incomplete queue entry in %s", path);
        && (!q->track
           || !q->when))
       fatal(0, "incomplete queue entry in %s", path);
-    l_add(head->prev, q);
+    queue_insert_entry(head->prev, q);
   }
   if(ferror(fp)) fatal(errno, "error reading %s", path);
   fclose(fp);
   }
   if(ferror(fp)) fatal(errno, "error reading %s", path);
   fclose(fp);
@@ -155,154 +120,6 @@ void recent_write(void) {
   queue_do_write(&phead, config_get_file("recent"));
 }
 
   queue_do_write(&phead, config_get_file("recent"));
 }
 
-static int id_in_use(const char *id) {
-  struct queue_entry *q;
-
-  for(q = qhead.next; q != &qhead; q = q->next)
-    if(!strcmp(id, q->id))
-      return 1;
-  return 0;
-}
-
-static void queue_id(struct queue_entry *q) {
-  const char *id;
-
-  id = random_id();
-  while(id_in_use(id))
-    id = random_id();
-  q->id = id;
-}
-
-struct queue_entry *queue_add(const char *track, const char *submitter,
-                             int where) {
-  struct queue_entry *q, *beforeme;
-
-  q = xmalloc(sizeof *q);
-  q->track = xstrdup(track);
-  q->submitter = submitter ? xstrdup(submitter) : 0;
-  q->state = playing_unplayed;
-  queue_id(q);
-  time(&q->when);
-  switch(where) {
-  case WHERE_START:
-    l_add(&qhead, q);
-    break;
-  case WHERE_END:
-    l_add(qhead.prev, q);
-    break;
-  case WHERE_BEFORE_RANDOM:
-    /* We want to find the point in the queue before the block of random tracks
-     * at the end. */
-    beforeme = &qhead;
-    while(beforeme->prev != &qhead
-         && beforeme->prev->state == playing_random)
-      beforeme = beforeme->prev;
-    l_add(beforeme->prev, q);
-    break;
-  }
-  /* submitter will be a null pointer for a scratch */
-  if(submitter)
-    notify_queue(track, submitter);
-  eventlog_raw("queue", queue_marshall(q), (const char *)0);
-  return q;
-}
-
-int queue_move(struct queue_entry *q, int delta, const char *who) {
-  int moved = 0;
-  char buffer[20];
-
-  /* not the most efficient approach but hopefuly relatively comprehensible:
-   * the idea is that for each step we determine which nodes are affected, and
-   * fill in all the links starting at the 'prev' end and moving towards the
-   * 'next' end. */
-  
-  while(delta > 0 && q->prev != &qhead) {
-    struct queue_entry *n, *p, *pp;
-
-    n = q->next;
-    p = q->prev;
-    pp = p->prev;
-    pp->next = q;
-    q->prev = pp;
-    q->next = p;
-    p->prev = q;
-    p->next = n;
-    n->prev = p;
-    --delta;
-    ++moved;
-  }
-
-  while(delta < 0 && q->next != &qhead) {
-    struct queue_entry *n, *p, *nn;
-
-    p = q->prev;
-    n = q->next;
-    nn = n->next;
-    p->next = n;
-    n->prev = p;
-    n->next = q;
-    q->prev = n;
-    q->next = nn;
-    nn->prev = q;
-    ++delta;
-    --moved;
-  }
-
-  if(moved) {
-    info("user %s moved %s", who, q->id);
-    notify_queue_move(q->track, who);
-    sprintf(buffer, "%d", moved);
-    eventlog("moved", who, (char *)0);
-  }
-  
-  return delta;
-}
-
-static int find_in_list(struct queue_entry *needle,
-                       int nqs, struct queue_entry **qs) {
-  int n;
-
-  for(n = 0; n < nqs; ++n)
-    if(qs[n] == needle)
-      return 1;
-  return 0;
-}
-
-void queue_moveafter(struct queue_entry *target,
-                    int nqs, struct queue_entry **qs,
-                    const char *who) {
-  struct queue_entry *q;
-  int n;
-
-  /* Normalize */
-  if(!target)
-    target = &qhead;
-  else
-    while(find_in_list(target, nqs, qs))
-      target = target->prev;
-  /* Do the move */
-  for(n = 0; n < nqs; ++n) {
-    q = qs[n];
-    l_remove(q);
-    l_add(target, q);
-    target = q;
-    /* Log the individual tracks */
-    info("user %s moved %s", who, q->id);
-    notify_queue_move(q->track, who);
-  }
-  /* Report that the queue changed to the event log */
-  eventlog("moved", who, (char *)0);
-}
-
-void queue_remove(struct queue_entry *which, const char *who) {
-  if(who) {
-    info("user %s removed %s", who, which->id);
-    notify_queue_move(which->track, who);
-  }
-  eventlog("removed", which->id, who, (const char *)0);
-  l_remove(which);
-}
-
 struct queue_entry *queue_find(const char *key) {
   struct queue_entry *q;
 
 struct queue_entry *queue_find(const char *key) {
   struct queue_entry *q;
 
@@ -313,19 +130,6 @@ struct queue_entry *queue_find(const char *key) {
   return q != &qhead ? q : 0;
 }
 
   return q != &qhead ? q : 0;
 }
 
-void queue_played(struct queue_entry *q) {
-  while(pcount && pcount >= config->history) {
-    eventlog("recent_removed", phead.next->id, (char *)0);
-    l_remove(phead.next);
-    pcount--;
-  }
-  if(config->history) {
-    eventlog_raw("recent_added", queue_marshall(q), (char *)0);
-    l_add(phead.prev, q);
-    ++pcount;
-  }
-}
-
 /*
 Local Variables:
 c-basic-offset:2
 /*
 Local Variables:
 c-basic-offset:2
diff --git a/server/server-queue.h b/server/server-queue.h
deleted file mode 100644 (file)
index 624f203..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004, 2005, 2006, 2007 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef SERVER_QUEUE_H
-#define SERVER_QUEUE_H
-
-extern struct queue_entry qhead;
-/* queue of things yet to be played.  the head will be played
- * soonest. */
-
-extern struct queue_entry phead;
-/* things that have been played in the past.  the head is the oldest. */
-
-void queue_read(void);
-/* read the queue in.  Calls @fatal@ on error. */
-
-void queue_write(void);
-/* write the queue out.  Calls @fatal@ on error. */
-
-void recent_read(void);
-/* read the recently played list in.  Calls @fatal@ on error. */
-
-void recent_write(void);
-/* write the recently played list out.  Calls @fatal@ on error. */
-
-struct queue_entry *queue_add(const char *track, const char *submitter,
-                             int where);
-#define WHERE_START 0                  /* Add to head of queue */
-#define WHERE_END 1                    /* Add to end of queue */
-#define WHERE_BEFORE_RANDOM 2          /* End, or before random track */
-/* add an entry to the queue.  Return a pointer to the new entry. */
-
-void queue_remove(struct queue_entry *q, const char *who);
-/* remove an from the queue */
-
-struct queue_entry *queue_find(const char *key);
-/* find a track in the queue by name or ID */
-
-void queue_played(struct queue_entry *q);
-/* add @q@ to the played list */
-
-int queue_move(struct queue_entry *q, int delta, const char *who);
-/* move element @q@ in the queue towards the front (@delta@ > 0) or towards the
- * back (@delta@ < 0).  The return value is the leftover delta once we've hit
- * the end in whichever direction we were going. */
-
-void queue_moveafter(struct queue_entry *target,
-                    int nqs, struct queue_entry **qs, const char *who);
-/* Move all the elements QS to just after TARGET, or to the head if
- * TARGET=0. */
-
-void queue_fix_sofar(struct queue_entry *q);
-/* Fix up the sofar field for standalone players */
-
-#endif /* SERVER_QUEUE_H */
-
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-fill-column:79
-indent-tabs-mode:nil
-End:
-*/
index 527255e571de8a85fc5b72c8479a45cfabf63295..0ddfd5327c3b081447db93d7f2e0efa719fbb446 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <pwd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <gcrypt.h>
-#include <stddef.h>
-#include <time.h>
-#include <limits.h>
-#include <pcre.h>
-#include <netdb.h>
-#include <netinet/in.h>
-
-#include "event.h"
-#include "server.h"
-#include "syscalls.h"
-#include "queue.h"
-#include "server-queue.h"
-#include "play.h"
-#include "log.h"
-#include "mem.h"
-#include "state.h"
-#include "charset.h"
-#include "split.h"
-#include "configuration.h"
-#include "hex.h"
-#include "rights.h"
-#include "trackdb.h"
-#include "table.h"
-#include "kvp.h"
-#include "mixer.h"
-#include "sink.h"
-#include "authhash.h"
-#include "plugin.h"
-#include "printf.h"
-#include "trackname.h"
-#include "eventlog.h"
-#include "defs.h"
-#include "cache.h"
-#include "unicode.h"
-#include "cookies.h"
-#include "base64.h"
-#include "hash.h"
-#include "mime.h"
-#include "sendmail.h"
-#include "wstat.h"
-#include "schedule.h"
+#include "disorder-server.h"
 
 #ifndef NONCE_SIZE
 # define NONCE_SIZE 16
 
 #ifndef NONCE_SIZE
 # define NONCE_SIZE 16
diff --git a/server/server.h b/server/server.h
deleted file mode 100644 (file)
index 0d34d1e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004, 2006-2008 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef SERVER_H
-#define SERVER_H
-
-/* The command-response server.
- *
- * See disorder_protocol(5) for sometimes up-to-date protocol documentation.
- */
-
-int server_start(ev_source *ev, int pf,
-                size_t socklen, const struct sockaddr *sa,
-                const char *name);
-/* start listening.  Return the fd. */
-
-int server_stop(ev_source *ev, int fd);
-/* Stop listening on @fd@ */
-
-extern int volume_left, volume_right;  /* last known volume */
-
-extern int wideopen;                   /* blindly accept all logins */
-
-#endif /* SERVER_H */
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-fill-column:79
-End:
-*/
index 8ed01a849cab810aa2a83dcb9a876944f8408f90..41e53b24b971eaa211ff8753399a1d2610becc77 100644 (file)
 /** @file server/speaker-alsa.c
  * @brief Support for @ref BACKEND_ALSA */
 
 /** @file server/speaker-alsa.c
  * @brief Support for @ref BACKEND_ALSA */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_ALSA_ASOUNDLIB_H
 
 
 #if HAVE_ALSA_ASOUNDLIB_H
 
-#include "types.h"
-
 #include <unistd.h>
 #include <poll.h>
 #include <alsa/asoundlib.h>
 #include <unistd.h>
 #include <poll.h>
 #include <alsa/asoundlib.h>
index 27b26647a0e9c61aa4f92db7328c80d06be52ef9..7e19e2b58a961332a61aed5a298c8cd3a359d9d7 100644 (file)
@@ -21,8 +21,7 @@
 /** @file server/speaker-command.c
  * @brief Support for @ref BACKEND_COMMAND */
 
 /** @file server/speaker-command.c
  * @brief Support for @ref BACKEND_COMMAND */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <unistd.h>
 #include <poll.h>
 
 #include <unistd.h>
 #include <poll.h>
index 4f46891b94f9c5f4ec7664bc4d62da6261335309..df2759b09f2f149a84f17a7db12acf0394c32ef0 100644 (file)
  * @todo support @ref config::device
  */
 
  * @todo support @ref config::device
  */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_COREAUDIO_AUDIOHARDWARE_H
 
 
 #if HAVE_COREAUDIO_AUDIOHARDWARE_H
 
-#include "types.h"
-
 #include <poll.h>
 #include <sys/socket.h>
 #include <unistd.h>
 #include <poll.h>
 #include <sys/socket.h>
 #include <unistd.h>
index b77334ce163c78edfc8fd61c7ebdaa35b61362a7..2d8d2cba95cf2278f3838529c966ef7af7d1e6a4 100644 (file)
@@ -20,8 +20,7 @@
 /** @file server/speaker-network.c
  * @brief Support for @ref BACKEND_NETWORK */
 
 /** @file server/speaker-network.c
  * @brief Support for @ref BACKEND_NETWORK */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <unistd.h>
 #include <poll.h>
 
 #include <unistd.h>
 #include <poll.h>
@@ -29,7 +28,6 @@
 #include <gcrypt.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
 #include <gcrypt.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
-#include <assert.h>
 #include <net/if.h>
 #include <ifaddrs.h>
 #include <errno.h>
 #include <net/if.h>
 #include <ifaddrs.h>
 #include <errno.h>
index 36ef4a85c250b9b91b5acdc41cd663575004b15d..95dcfe397cad023129ad9721ba48fd7807d0c582 100644 (file)
 /** @file server/speaker-oss.c
  * @brief Support for @ref BACKEND_OSS */
 
 /** @file server/speaker-oss.c
  * @brief Support for @ref BACKEND_OSS */
 
-#include <config.h>
+#include "common.h"
 
 #if HAVE_SYS_SOUNDCARD_H
 
 
 #if HAVE_SYS_SOUNDCARD_H
 
-#include "types.h"
-
 #include <unistd.h>
 #include <poll.h>
 #include <unistd.h>
 #include <poll.h>
-#include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
index bcc44ccbf69a7fcf2d67339c19ac41661db4867d..3021652ec17cf1d9473dd0239f5d7956da3ea48c 100644 (file)
  * 2-byte samples.
  */
 
  * 2-byte samples.
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <getopt.h>
 
 #include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <locale.h>
 #include <syslog.h>
 #include <unistd.h>
 #include <errno.h>
 #include <ao/ao.h>
 #include <locale.h>
 #include <syslog.h>
 #include <unistd.h>
 #include <errno.h>
 #include <ao/ao.h>
-#include <string.h>
-#include <assert.h>
 #include <sys/select.h>
 #include <sys/wait.h>
 #include <time.h>
 #include <sys/select.h>
 #include <sys/wait.h>
 #include <time.h>
index ad90425ff18f72ed776356c0fc1f5c600cb6f019..2be2edd53e8a12401163f10a48f128d27a075587 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <locale.h>
-#include <stdio.h>
-#include <pcre.h>
-#include <netdb.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-
-#include "event.h"
-#include "play.h"
-#include "rights.h"
-#include "trackdb.h"
-#include "state.h"
-#include "configuration.h"
-#include "log.h"
-#include "queue.h"
-#include "server-queue.h"
-#include "server.h"
-#include "printf.h"
-#include "addr.h"
-#include "schedule.h"
+#include "disorder-server.h"
 
 static const char *current_unix;
 static int current_unix_fd;
 
 static const char *current_unix;
 static int current_unix_fd;
diff --git a/server/state.h b/server/state.h
deleted file mode 100644 (file)
index 21f6a1a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004, 2007, 2008 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef STATE_H
-#define STATE_H
-
-void quit(ev_source *ev) attribute((noreturn));
-/* terminate the daemon */
-
-int reconfigure(ev_source *ev, int reload);
-/* reconfigure.  If @reload@ is nonzero, update the configuration. */
-
-#endif /* QUIT_H */
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-End:
-*/
index 5648ca057a106fae3e0cee75a5190d2a39ca2787..2725fd5c7afd887e6d5103a7d1c8a395d622d5c8 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <locale.h>
-#include <stdio.h>
-#include <errno.h>
-#include <pcre.h>
-#include <getopt.h>
-#include <syslog.h>
-#include <unistd.h>
-
-#include "defs.h"
-#include "mem.h"
-#include "log.h"
-#include "syscalls.h"
-#include "configuration.h"
-#include "rights.h"
-#include "trackdb.h"
-#include "version.h"
+#include "disorder-server.h"
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
index 3d7de6db23081658467f4d0e5e8d158f77502919..3639c52bd43c3f9c347cc7f6f59a144caba9ffb6 100644 (file)
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
-
-#include <getopt.h>
-#include <locale.h>
-#include <errno.h>
-#include <string.h>
-
-#include "configuration.h"
-#include "syscalls.h"
-#include "log.h"
-#include "trackname.h"
-#include "mem.h"
-#include "charset.h"
-#include "defs.h"
-#include "version.h"
+#include "disorder-server.h"
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
 
 static const struct option options[] = {
   { "help", no_argument, 0, 'h' },
index 7e580f2522ecf616f70de4e5ac661f9885c9c97e..f8839c85e1f031eb5700c66764865644596b81f2 100644 (file)
@@ -18,8 +18,7 @@
  * USA
  */
 
  * USA
  */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
 #include <getopt.h>
 #include <sys/types.h>
 
 #include <getopt.h>
 #include <sys/types.h>