]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Introduce para_regcomp.
authorAndre Noll <maan@systemlinux.org>
Wed, 8 Jul 2009 21:10:49 +0000 (23:10 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 8 Jul 2009 21:10:49 +0000 (23:10 +0200)
A wrapper for regcomp() that logs an error message if the regcomp() failed
and uses a return value according to the paraslash rules. Currently there is
only one user of regular expressions, is_v4_dot_quad(), which is converted
to para_regex(), but new callers will be added soon.

Unfortunately, this change made it necessary to include regex.h in all .c files
that use string.h. Clean up the order in which headers are included a bit while
we're at it.

Maybe I should rethink the rule "Only .c files shall include header files"...

65 files changed:
aac_afh.c
aacdec_filter.c
acl.c
afh.c
afh_common.c
afs.c
aft.c
alsa_write.c
amp_filter.c
attribute.c
audioc.c
audiod.c
audiod_command.c
blob.c
chunk_queue.c
client.c
client_common.c
close_on_fork.c
command.c
compress_filter.c
crypt.c
daemon.c
dccp_recv.c
dccp_send.c
error.h
exec.c
fade.c
fd.c
fec.c
fecdec_filter.c
file_write.c
filter.c
filter_common.c
grab_client.c
gui.c
http_recv.c
http_send.c
mood.c
mp3_afh.c
mp3dec_filter.c
net.c
ogg_afh.c
oggdec_filter.c
oss_write.c
playlist.c
prebuffer_filter.c
recv.c
recv_common.c
ringbuffer.c
sched.c
score.c
send_common.c
server.c
stat.c
stdin.c
stdout.c
string.c
string.h
udp_recv.c
udp_send.c
user_list.c
vss.c
wav_filter.c
write.c
write_common.c

index 04461178bb7912e3fb893cc5cf0215d39f965368..7de737068863df6d4a6233aa52628cbf53738921 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -10,6 +10,7 @@
 
 /** \file aac_afh.c para_server's aac audio format handler */
 
+#include <regex.h>
 #include <osl.h>
 
 #include "para.h"
index 1ceca1fcba2bb4648fb0f4e4c9acfa113fd464e8..59c49893f59acc58a6df8c5d8b7386b8008c3dca 100644 (file)
@@ -10,8 +10,9 @@
 
 /** \file aacdec_filter.c paraslash's aac (m4a) decoder. */
 
-#include "para.h"
+#include <regex.h>
 
+#include "para.h"
 #include "list.h"
 #include "sched.h"
 #include "ggo.h"
diff --git a/acl.c b/acl.c
index ffcd168572fee34bcface386c57d7bf5f7cbadeb..087ea0c805c102bace697596061978b64aa22f72 100644 (file)
--- a/acl.c
+++ b/acl.c
@@ -6,6 +6,8 @@
 
 /** \file acl.c Access control lists for paraslash senders. */
 
+#include <regex.h>
+
 #include "para.h"
 #include "error.h"
 #include "string.h"
diff --git a/afh.c b/afh.c
index 894cd78284d36c9de7ef1aa565894e6dd6017384..c00644939d1bdd04f5010729715af874725f4a86 100644 (file)
--- a/afh.c
+++ b/afh.c
@@ -6,6 +6,7 @@
 
 /** \file afh.c Paraslash's standalone audio format handler tool. */
 
+#include <regex.h>
 #include <dirent.h>
 #include <sys/time.h>
 
index 74701460c9163aa008c2839ef42ca580ca19db37..bb04453f599e29218abb955d18fcb74a078d1eb8 100644 (file)
@@ -10,6 +10,7 @@
 #include <sys/time.h> /* gettimeofday */
 #include <sys/types.h>
 #include <dirent.h>
+#include <regex.h>
 
 #include "para.h"
 #include "error.h"
diff --git a/afs.c b/afs.c
index b40fe8e05c943eb503b3a2344fc1287db81b3696..8e3aa9235c15dcb53f099685fc74f665ab61a3d6 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -6,6 +6,7 @@
 
 /** \file afs.c Paraslash's audio file selector. */
 
+#include <regex.h>
 #include <signal.h>
 #include <fnmatch.h>
 #include <openssl/rc4.h>
diff --git a/aft.c b/aft.c
index 6b74b0ae499b1c2fc60e0757d5876b7d90c6f693..220e019e7f0bbc0553fcb72e12193d8ca9c3f98d 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -6,18 +6,18 @@
 
 /** \file aft.c Audio file table functions. */
 
+#include <regex.h>
 #include <dirent.h> /* readdir() */
 #include <openssl/rc4.h>
-
+#include <sys/mman.h>
+#include <fnmatch.h>
+#include <sys/shm.h>
 #include <osl.h>
+
 #include "para.h"
 #include "error.h"
 #include "crypt.h"
 #include "string.h"
-#include <sys/mman.h>
-#include <fnmatch.h>
-#include <sys/shm.h>
-
 #include "afh.h"
 #include "afs.h"
 #include "net.h"
index cf0f335bebc7426c9b24aad7537601be3dbb0dd7..3c7c03b467cb9e40a13e1d348a93600c0fdd51b3 100644 (file)
@@ -12,6 +12,7 @@
  * based on the vplay program by Michael Beck.
  */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <alsa/asoundlib.h>
index a62344a1520798787f5698b89db7ec085776ef2e..63b1b9a618bcb561e9d73f2baf215dcea2e75221 100644 (file)
@@ -6,6 +6,8 @@
 
 /** \file amp_filter.c Paraslash's amplify filter. */
 
+#include <regex.h>
+
 #include "para.h"
 #include "amp_filter.cmdline.h"
 #include "list.h"
index 41a10058d9358463713006aaf6c4b9257375e587..b962661a10b28ed879dc88271afe1ce34a9980c5 100644 (file)
@@ -6,6 +6,7 @@
 
 /** \file attribute.c Attribute handling functions. */
 
+#include <regex.h>
 #include <openssl/rc4.h>
 #include <osl.h>
 
index 5c081da5d7ab94437f042e2eac80233c8bd09aa2..81e5d1c53e3d349ac6182c1bb1c03a5283e445c8 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -6,6 +6,7 @@
 
 /** \file audioc.c the client program used to connect to para_audiod */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 
index 29a8aa30abec6be72aee946b92d7767f3fc037e5..32c839411b138406ab4bb760f8b8b9b873c1305d 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -5,6 +5,7 @@
  */
 
 /** \file audiod.c the paraslash's audio daemon */
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <signal.h>
index da5a2dc5e882a4de2fe61152a6d0979f3dd04cf5..b3312940412a93511c4c730485e3db30a80bc9c9 100644 (file)
@@ -6,6 +6,7 @@
 
 /** \file audiod_command.c commands for para_audiod */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 
@@ -17,7 +18,6 @@
 #include "ggo.h"
 #include "filter.h"
 #include "grab_client.h"
-
 #include "error.h"
 #include "audiod.h"
 #include "net.h"
diff --git a/blob.c b/blob.c
index 38e5cb54df04ad3a0600ac893e108a71446eb6da..6f10f0a2a02e7bb4ccbbebe7307bad007386bccf 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -6,6 +6,7 @@
 
 /** \file blob.c Macros and functions for blob handling. */
 
+#include <regex.h>
 #include <fnmatch.h>
 #include <openssl/rc4.h>
 #include <osl.h>
index fa31718590dd73fad6f034d69ce2a8d7fc299e86..bb97c6902ae92379b04033990598c958a8dd76b4 100644 (file)
@@ -6,6 +6,8 @@
 
 /** \file chunk_queue.c Queuing functions for paraslash senders. */
 
+#include <regex.h>
+
 #include "para.h"
 #include "list.h"
 #include "afh.h"
index fef6ba4a5bc4194048a951d9ceb657d91d14e4ae..b7c1644c9fe793b0061682d7f1d451d38bfcd8da 100644 (file)
--- a/client.c
+++ b/client.c
@@ -6,6 +6,7 @@
 
 /** \file client.c the client program used to connect to para_server */
 
+#include <regex.h>
 #include <openssl/rc4.h>
 
 #include "para.h"
index dd951c15061948304343c5d26cf69d1c5f9f4fb1..eb053581b8975de8360cf72aa47d7c4bfefcb9a5 100644 (file)
@@ -6,6 +6,7 @@
 
 /** \file client_common.c Common functions of para_client and para_audiod. */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <openssl/rc4.h>
index 378799c7d5505135d59e976cd43416984c9500a6..fb1906462b30b74935a64d53370c9810046df771 100644 (file)
@@ -5,6 +5,9 @@
  */
 
 /** \file close_on_fork.c Manage a list of fds that should be closed on fork. */
+
+#include <regex.h>
+
 #include "para.h"
 #include "list.h"
 #include "string.h"
index 90c4b60846c5c6cade80316f57bef742fdc7e716..afa1e667ca3bfdfedfd17e7de6be622f210ec383 100644 (file)
--- a/command.c
+++ b/command.c
@@ -6,6 +6,7 @@
 
 /** \file command.c Client authentication and server commands. */
 
+#include <regex.h>
 #include <signal.h>
 #include <sys/time.h>
 #include <sys/types.h>
index 65bc8e51ba0f3fe11126b53e04b774e70dd9872d..2e263e87b0c6af2da12bd6226affe9f1b733e944 100644 (file)
@@ -10,6 +10,8 @@
  * Uses ideas of AudioCompress, (C) 2002-2004  M. Hari Nezumi <magenta@trikuare.cx>
  */
 
+#include <regex.h>
+
 #include "para.h"
 #include "compress_filter.cmdline.h"
 #include "list.h"
diff --git a/crypt.c b/crypt.c
index a2642929114b7c1bf790c81a0cbbacf180a2411c..352c5b8d8e97832ed3d782ce3ad1984890ad5cf7 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -6,6 +6,7 @@
 
 /** \file crypt.c openssl-based RSA encryption/decryption routines */
 
+#include <regex.h>
 #include <dirent.h>
 #include <sys/types.h>
 #include <sys/socket.h>
index cae63ea7f48488124085d79360458ee44b5620a8..7f4aa6f528ef20b49f6dcd5234798db072436b6c 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -5,12 +5,14 @@
  */
 
 /** \file daemon.c Some helpers for programs that detach from the console. */
-#include "para.h"
-#include "daemon.h"
+
+#include <regex.h>
 #include <pwd.h>
 #include <sys/types.h> /* getgrnam() */
 #include <grp.h>
 
+#include "para.h"
+#include "daemon.h"
 #include "string.h"
 #include "color.h"
 
index 93dea809d88009b717e1338c4d32cfddd06bea05..4d4ac86db31cb28f1d2d1d9f081f13dc8a139dcc 100644 (file)
@@ -11,6 +11,7 @@
  * (C) 2005 Ian McDonald <imcdnzl@gmail.com>
  */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 
index 1e62d289538ad52cb2325dfd262bb59687eeb15e..d2f81dd9168023df27a1fefdb883e3234382c1cc 100644 (file)
@@ -11,6 +11,7 @@
  * (C) 2005 Ian McDonald <imcdnzl@gmail.com>
  */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <osl.h>
diff --git a/error.h b/error.h
index f2e92c61c411eb70ca7b24a7a92ec9da40b7e8bf..1cc40e7f4e6ca6ae08da109a6c416cff75bfbd1f 100644 (file)
--- a/error.h
+++ b/error.h
@@ -274,7 +274,8 @@ extern const char **para_errlist[];
        PARA_ERROR(STRTOLL, "unknown strtoll error"), \
        PARA_ERROR(ATOI_NO_DIGITS, "no digits found in string"), \
        PARA_ERROR(ATOI_JUNK_AT_END, "further characters after number"), \
-       PARA_ERROR(SIZE_PREFIX, "bad size prefix") \
+       PARA_ERROR(SIZE_PREFIX, "bad size prefix"), \
+       PARA_ERROR(REGEX, "regular expression error") \
 
 
 #define EXEC_ERRORS \
diff --git a/exec.c b/exec.c
index 7fc4ae069e0ad70902aaa1c9ff2e9721212e7392..b603809d062ee07724f7a4f25b9629ff227f047d 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -5,12 +5,15 @@
  */
 
 /** \file exec.c Helper functions for spawning new processes. */
+
+#include <regex.h>
 #include <dirent.h>
+
 #include "para.h"
 #include "close_on_fork.h"
 #include "error.h"
-#include "string.h"
 #include "fd.h"
+#include "string.h"
 
 /**
  * Spawn a new process and redirect fd 0, 1, and 2.
diff --git a/fade.c b/fade.c
index 7f884473bcd1d0c33b4ab39d9aa5c43684fd5cf4..0304f4c6637a00fb89d9c5e43c6f04c78b616d16 100644 (file)
--- a/fade.c
+++ b/fade.c
@@ -6,13 +6,9 @@
 
 /** \file fade.c A volume fader and alarm clock for linux. */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
-
-#include "fade.cmdline.h"
-#include "para.h"
-#include "fd.h"
-
 #include <sys/ioctl.h>
 #include <ctype.h>
 #include <stdlib.h> /* EXIT_SUCCESS */
 #include <string.h>
 #include <limits.h>
 #include <sys/soundcard.h>
+
+#include "fade.cmdline.h"
+#include "para.h"
+#include "fd.h"
 #include "string.h"
 #include "error.h"
 
-
 INIT_FADE_ERRLISTS;
 struct fade_args_info conf;
 
diff --git a/fd.c b/fd.c
index 23b89b5d35a19f0641ca0e506c1be34c2e4eab49..3dc490cde1056db92e94108cb7ad3c97131d32d5 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -6,6 +6,7 @@
 
 /** \file fd.c Helper functions for file descriptor handling. */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <sys/mman.h>
@@ -15,6 +16,7 @@
 #include "para.h"
 #include "error.h"
 #include "string.h"
+
 /**
  * Write a buffer to a file descriptor, re-write on short writes.
  *
diff --git a/fec.c b/fec.c
index e4cdbaf3175b99d2bf149c72e6f2cea24aa70281..d097b77de836248d79142348f254dd4c3ef57817 100644 (file)
--- a/fec.c
+++ b/fec.c
@@ -33,6 +33,7 @@
  * OF SUCH DAMAGE.
  */
 
+#include <regex.h>
 
 #include "para.h"
 #include "error.h"
index a3cba9bbd0b3821b545a3aed6a7bb8606ec97b95..7fe8743794d38540ce132218fa8f6cc41ae1727f 100644 (file)
@@ -6,6 +6,8 @@
 
 /** \file fecdec_filter.c A filter fec-decodes an audio stream. */
 
+#include <regex.h>
+
 #include <dirent.h>
 #include "para.h"
 #include "error.h"
index 1c534ae169a8082b0e2712e01af1b5ec3bb90abd..3286ea87a089363036cabe518a98ef16151e12ca 100644 (file)
@@ -6,6 +6,7 @@
 
 /** \file file_write.c simple output plugin for testing purposes */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <sys/time.h>
index b8a7c5c19231d415f0e2488a6275f619901e2d65..4113690439184012724c33908ae535e23c29b12a 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -6,8 +6,9 @@
 
 /** \file filter.c The stand-alone filter program. */
 
-#include "para.h"
+#include <regex.h>
 
+#include "para.h"
 #include "filter.cmdline.h"
 #include "list.h"
 #include "sched.h"
index fbc5b66b857d72c730c298737fc7394d2c8c4261..cfe08dd1e7274bff947ddc50e70f3711fe60422e 100644 (file)
@@ -6,6 +6,7 @@
 
 /** \file filter_common.c Common helper functions for filter input/output. */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 
index df5b40a3143f843b17e97a69662f9345d6cc15e6..67db50570d11666b4d59041ccc354477c4b3d0fc 100644 (file)
@@ -11,6 +11,7 @@
  * \sa filter_chain filter_chain_info filter.
  */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 
diff --git a/gui.c b/gui.c
index e734b10c8e9e57438075a14a2cc1941f0c28a7b1..4866979a2e93c197bd92a6679c7ff08de2af32f3 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -6,14 +6,16 @@
 
 /** \file gui.c Curses-based interface for paraslash. */
 
+#include <regex.h>
 #include <signal.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <curses.h>
+
 #include "gui.cmdline.h"
 #include "para.h"
 #include "gui.h"
 #include "string.h"
-#include <curses.h>
 #include "ringbuffer.h"
 #include "fd.h"
 #include "error.h"
index 7f130341d16e1f0cc36cb43d691da66a92775235..f644233ba1ed1adb63fe9f21cf675ff319b5531d 100644 (file)
@@ -6,6 +6,7 @@
 
 /** \file http_recv.c paraslash's http receiver */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 
index feb1a84233ee67ff03e537c97f14cc0d9abb44e8..3959cad4f3b67326d6161a252c5b3a66a74e0394 100644 (file)
@@ -6,6 +6,7 @@
 
 /** \file http_send.c paraslash's http sender */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <osl.h>
diff --git a/mood.c b/mood.c
index a1ef816d7cb8d503fa1f69181da4011bd44460fa..f16d9c4cb30e559bf9244804c6edc4c9db4970ab 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -6,8 +6,10 @@
 
 /** \file mood.c Paraslash's mood handling functions. */
 
+#include <regex.h>
 #include <fnmatch.h>
 #include <osl.h>
+
 #include "para.h"
 #include "error.h"
 #include "string.h"
index ff133ca563441ceb6daa02979c7a223b1c74e323..5eacf63bea0d35b32966fdfcdd2577c1784f01d1 100644 (file)
--- a/mp3_afh.c
+++ b/mp3_afh.c
@@ -16,7 +16,9 @@
  *                      Johannes Overmann <overmann@iname.com>
  */
 
+#include <regex.h>
 #include <osl.h>
+
 #include "para.h"
 #include "error.h"
 #include "afh.h"
index 92da4a5cbb9514d9279b3b39daa68ce783f2d585..aceee9ae686666583f5b6a3bfbbc515cbc4c6328 100644 (file)
@@ -6,6 +6,9 @@
 
 /** \file mp3dec_filter.c Paraslash's mp3 decoder. */
 
+#include <mad.h>
+#include <regex.h>
+
 #include "para.h"
 #include "mp3dec_filter.cmdline.h"
 #include "list.h"
@@ -13,7 +16,6 @@
 #include "ggo.h"
 #include "filter.h"
 #include "error.h"
-#include <mad.h>
 #include "string.h"
 
 /** Convert a sample value from libmad to a signed short. */
diff --git a/net.c b/net.c
index b3588f6d9e3d43d62f592a982b11f0db5f1e550b..61f50dd71041a2a5e80008dbb2da110b75b70a42 100644 (file)
--- a/net.c
+++ b/net.c
@@ -88,7 +88,8 @@ static bool is_v4_dot_quad(const char *address)
        bool result;
        regex_t r;
 
-       assert(!regcomp(&r, "^([0-9]+\\.){3}[0-9]+$", REG_EXTENDED|REG_NOSUB));
+       assert(para_regcomp(&r, "^([0-9]+\\.){3}[0-9]+$",
+               REG_EXTENDED | REG_NOSUB) >= 0);
        result = regexec(&r, address, 0, NULL, 0) == 0;
        regfree(&r);
        return result;
index f0c1e43586aecebb45f3fac3732fa274eac54690..65573cfccf08c4e853231ade26509d8c3ee5c278 100644 (file)
--- a/ogg_afh.c
+++ b/ogg_afh.c
@@ -5,6 +5,7 @@
  */
 /** \file ogg_afh.c para_server's ogg vorbis audio format handler */
 
+#include <regex.h>
 #include <inttypes.h>
 #include <ogg/ogg.h>
 #include <vorbis/codec.h>
index b158a5e17444112148bd1d33d90dba87e912274e..02f04b4809e66864e78e0bde29b8cd0665c6984e 100644 (file)
@@ -6,8 +6,10 @@
 
 /** \file oggdec_filter.c Paraslash's ogg vorbis decoder. */
 
-#include "para.h"
+#include <regex.h>
+#include <vorbis/vorbisfile.h>
 
+#include "para.h"
 #include "oggdec_filter.cmdline.h"
 #include "list.h"
 #include "sched.h"
@@ -16,8 +18,6 @@
 #include "error.h"
 #include "string.h"
 
-#include <vorbis/vorbisfile.h>
-
 /** Determine byte sex. */
 #ifdef WORDS_BIGENDIAN
 #define ENDIAN 1
index 552d5b9705821df8d25720b29f8069629dcb0ade..103b14ea5fa16c68feeb10302454e41570673dc7 100644 (file)
@@ -6,6 +6,7 @@
 
 /** \file oss_write.c Paraslash's oss output plugin. */
 
+#include <regex.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <dirent.h>
index d1e16f8e131814f5c70b53239b747077f65d0c1e..852ffd7a9724471798a6f6a376a2826c0f6961f5 100644 (file)
@@ -4,7 +4,9 @@
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
+#include <regex.h>
 #include <osl.h>
+
 #include "para.h"
 #include "error.h"
 #include "string.h"
index 1ad5f44696aa1c28f26f5110f35539bbd86912d0..f23e4e578e1409fbe00891aa2521e01f119ce739 100644 (file)
@@ -6,6 +6,8 @@
 
 /** \file prebuffer_filter.c Paraslash's prebuffering filter. */
 
+#include <regex.h>
+
 #include "para.h"
 #include "prebuffer_filter.cmdline.h"
 #include "list.h"
diff --git a/recv.c b/recv.c
index 5de9c6be1779855b00a4698b6638aa4d67072305..42fd335f1466a7c01419b59872d29d5be679f907 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -6,6 +6,7 @@
 
 /** \file recv.c the stand-alone audio stream receiver */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 
index c2ca29db6e7edf1d957de7e8f5029c9651ec21b6..a5689390987ac9c9b063dad200653e990268824e 100644 (file)
@@ -6,8 +6,9 @@
 
 /** \file recv_common.c common functions of para_recv and para_audiod */
 
-#include "para.h"
+#include <regex.h>
 
+#include "para.h"
 #include "list.h"
 #include "sched.h"
 #include "ggo.h"
index b27fd8e8a25c4ccd52756f2e9c0f30e1c3b4162b..eee2ca104e9aa1531f1df4b219bd5e6efb6f6a92 100644 (file)
@@ -6,6 +6,8 @@
 
 /** \file ringbuffer.c Simple ringbuffer implementation */
 
+#include <regex.h>
+
 #include "para.h"
 #include "ringbuffer.h"
 #include "string.h"
diff --git a/sched.c b/sched.c
index 6f3f1faf8dc29ab8934cd01dd340cc96bb806089..44e66c9b62664eb3add50d9924db6b311ea7e273 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -6,6 +6,7 @@
 
 /** \file sched.c Paraslash's scheduling functions. */
 
+#include <regex.h>
 #include <dirent.h> /* readdir() */
 #include <assert.h>
 #include <sys/time.h>
diff --git a/score.c b/score.c
index 3557b042a31e5d84df636062cb54c15cd04ebe3c..bc40668f6fd59605b5d4df0de12b113d69b23075 100644 (file)
--- a/score.c
+++ b/score.c
@@ -5,7 +5,9 @@
  */
 
 /** \file score.c Scoring functions to determine the audio file streaming order. */
+#include <regex.h>
 #include <osl.h>
+
 #include "para.h"
 #include "error.h"
 #include "string.h"
index a1757a51e0779416e7cdb947fff5fe4a94436f27..388fde03bdd4399d40ef3d9ad127f81a8ea75cb3 100644 (file)
@@ -6,8 +6,10 @@
 
 /** \file send_common.c Functions used by more than one paraslash sender. */
 
+#include <regex.h>
 #include <dirent.h>
 #include <osl.h>
+
 #include "para.h"
 #include "error.h"
 #include "string.h"
index 245562631d18122084d97ca2af9f9afdec2cf59f..be97516f1e66272cf53abde69122d80906d53159 100644 (file)
--- a/server.c
+++ b/server.c
@@ -64,6 +64,7 @@
 #include <dirent.h>
 #include <sys/time.h>
 #include <openssl/rc4.h>
+#include <regex.h>
 #include <osl.h>
 
 #include "para.h"
diff --git a/stat.c b/stat.c
index 1062da360b3fe97090c67ebfd74363d5fa3035d9..03d00d771d622a8fb67ad07a99584ee150550b1f 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -9,7 +9,7 @@
  *  and para_audiod.
  */
 
-
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 
diff --git a/stdin.c b/stdin.c
index fea30dd90ca0e493bb6f4ce54f1515ea072761dc..8eb86dee69ba7322524e960bba6169916e9bef14 100644 (file)
--- a/stdin.c
+++ b/stdin.c
@@ -9,9 +9,7 @@
 #include <dirent.h> /* readdir() */
 #include <assert.h>
 
-
 #include "para.h"
-#include "string.h"
 #include "list.h"
 #include "sched.h"
 #include "fd.h"
index e178fe0e180e9e687c2f3c92c65bbfdb26d7d9bb..d64586bccd9cdd12ffe743247680d8686ee1c002 100644 (file)
--- a/stdout.c
+++ b/stdout.c
@@ -10,7 +10,6 @@
 #include <assert.h>
 
 #include "para.h"
-#include "string.h"
 #include "list.h"
 #include "sched.h"
 #include "fd.h"
index 5479e5b4fb43f6f0bac87e6cfba42ec011f30beb..bb63120184c79b44270a4ae1ba671e6dd74de5e1 100644 (file)
--- a/string.c
+++ b/string.c
@@ -6,14 +6,14 @@
 
 /** \file string.c Memory allocation and string handling functions. */
 
-#include "para.h"
-#include "string.h"
-
 #include <sys/time.h> /* gettimeofday */
 #include <pwd.h>
 #include <sys/utsname.h> /* uname() */
 #include <string.h>
+#include <regex.h>
 
+#include "para.h"
+#include "string.h"
 #include "error.h"
 
 /**
@@ -735,3 +735,19 @@ err:
        free(argv);
        return ret;
 }
+
+int para_regcomp(regex_t *preg, const char *regex, int cflags)
+{
+       char *buf;
+       size_t size;
+       int ret = regcomp(preg, regex, cflags);
+
+       if (ret == 0)
+               return 1;
+       size = regerror(ret, preg, NULL, 0);
+       buf = para_malloc(size);
+       regerror(ret, preg, buf, size);
+       PARA_ERROR_LOG("%s\n", buf);
+       free(buf);
+       return -E_REGEX;
+}
index b3b960ab20385ed6c8f63ae2a38deb2c73e49ac1..922ba696d18ed4dded4d037bdfba3a96b23aabb3 100644 (file)
--- a/string.h
+++ b/string.h
@@ -81,3 +81,4 @@ int get_loglevel_by_name(const char *txt);
 int read_size_header(const char *buf);
 int create_argv(const char *buf, const char *delim, char ***result);
 void free_argv(char **argv);
+int para_regcomp(regex_t *preg, const char *regex, int cflags);
index ad8d51fe1bb4e0092e5c99a478e6ef66c358a218..7bbd4b0c575a351055170bab1df3f186769c6783 100644 (file)
@@ -5,6 +5,7 @@
  */
 /** \file udp_recv.c Paraslash's udp receiver */
 
+#include <regex.h>
 #include <dirent.h>
 #include <sys/socket.h>
 #include <net/if.h>
index 499af66e2addfcce8991fb21f5a0e58de4de4d6f..f8cce2b943d0f204a089cc9c06a6911f879a0541 100644 (file)
@@ -7,6 +7,7 @@
 /** \file udp_send.c Para_server's udp sender. */
 
 
+#include <regex.h>
 #include <sys/time.h>
 #include <dirent.h>
 #include <sys/socket.h>
index 1d3f21cfa248a9b950ea57fd86877682ae75e152..3c0b4f856546a2173c77696f80e0c554a646985c 100644 (file)
@@ -6,6 +6,7 @@
 
 /** \file user_list.c User handling for para_server. */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <openssl/rc4.h>
diff --git a/vss.c b/vss.c
index 57e531ea3fa0143d4a98a0b15f59bafb421d9d4b..21f4cb4de07706f53591b3e7161f8c22a570ff24 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -11,6 +11,7 @@
  * senders.
  */
 
+#include <regex.h>
 #include <dirent.h>
 #include <osl.h>
 
index 1c0da1811847e958cdde408ba277edce20701c42..3c69311f570209cec4bed6abe27036d6d5754853 100644 (file)
@@ -6,9 +6,10 @@
 
 /** \file wav_filter.c A filter that inserts a wave header. */
 
+#include <regex.h>
+
 #include "para.h"
 #include "error.h"
-
 #include "list.h"
 #include "sched.h"
 #include "ggo.h"
diff --git a/write.c b/write.c
index c12736a66bfb81c9dcf85c412b1a581a2cade0ce..34cea48c6a81ab2d7d6743e28706181415362824 100644 (file)
--- a/write.c
+++ b/write.c
@@ -6,6 +6,7 @@
 
 /** \file write.c Paraslash's standalone wav/raw player. */
 
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 
index 476df8f0ec7b4f6ea7c3388795f9272d1e02fd8b..5eb6b796cbff4a8ce74fae16017e4366485ae84f 100644 (file)
@@ -6,6 +6,8 @@
 
 /** \file write_common.c common functions of para_audiod and para_write */
 
+#include <regex.h>
+
 #include "para.h"
 #include "string.h"
 #include "list.h"