/** \file aac_afh.c para_server's aac audio format handler */
+#include <regex.h>
#include <osl.h>
#include "para.h"
/** \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"
/** \file acl.c Access control lists for paraslash senders. */
+#include <regex.h>
+
#include "para.h"
#include "error.h"
#include "string.h"
/** \file afh.c Paraslash's standalone audio format handler tool. */
+#include <regex.h>
#include <dirent.h>
#include <sys/time.h>
#include <sys/time.h> /* gettimeofday */
#include <sys/types.h>
#include <dirent.h>
+#include <regex.h>
#include "para.h"
#include "error.h"
/** \file afs.c Paraslash's audio file selector. */
+#include <regex.h>
#include <signal.h>
#include <fnmatch.h>
#include <openssl/rc4.h>
/** \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"
* based on the vplay program by Michael Beck.
*/
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
#include <alsa/asoundlib.h>
/** \file amp_filter.c Paraslash's amplify filter. */
+#include <regex.h>
+
#include "para.h"
#include "amp_filter.cmdline.h"
#include "list.h"
/** \file attribute.c Attribute handling functions. */
+#include <regex.h>
#include <openssl/rc4.h>
#include <osl.h>
/** \file audioc.c the client program used to connect to para_audiod */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
*/
/** \file audiod.c the paraslash's audio daemon */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
#include <signal.h>
/** \file audiod_command.c commands for para_audiod */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
#include "ggo.h"
#include "filter.h"
#include "grab_client.h"
-
#include "error.h"
#include "audiod.h"
#include "net.h"
/** \file blob.c Macros and functions for blob handling. */
+#include <regex.h>
#include <fnmatch.h>
#include <openssl/rc4.h>
#include <osl.h>
/** \file chunk_queue.c Queuing functions for paraslash senders. */
+#include <regex.h>
+
#include "para.h"
#include "list.h"
#include "afh.h"
/** \file client.c the client program used to connect to para_server */
+#include <regex.h>
#include <openssl/rc4.h>
#include "para.h"
/** \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>
*/
/** \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"
/** \file command.c Client authentication and server commands. */
+#include <regex.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/types.h>
* 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"
/** \file crypt.c openssl-based RSA encryption/decryption routines */
+#include <regex.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/socket.h>
*/
/** \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"
* (C) 2005 Ian McDonald <imcdnzl@gmail.com>
*/
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
* (C) 2005 Ian McDonald <imcdnzl@gmail.com>
*/
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
#include <osl.h>
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 \
*/
/** \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.
/** \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;
/** \file fd.c Helper functions for file descriptor handling. */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/mman.h>
#include "para.h"
#include "error.h"
#include "string.h"
+
/**
* Write a buffer to a file descriptor, re-write on short writes.
*
* OF SUCH DAMAGE.
*/
+#include <regex.h>
#include "para.h"
#include "error.h"
/** \file fecdec_filter.c A filter fec-decodes an audio stream. */
+#include <regex.h>
+
#include <dirent.h>
#include "para.h"
#include "error.h"
/** \file file_write.c simple output plugin for testing purposes */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/time.h>
/** \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"
/** \file filter_common.c Common helper functions for filter input/output. */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
* \sa filter_chain filter_chain_info filter.
*/
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
/** \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"
/** \file http_recv.c paraslash's http receiver */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
/** \file http_send.c paraslash's http sender */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
#include <osl.h>
/** \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"
* Some mood parsers pre-process the data given in the mood line to compute a
* structure which depends of the particular mood_method and which is used
* later in the mood_score_function of the mood_method. The mood_parser may
- * store a pointer to its structure via the second argument.
+ * store a pointer to its structure via the void** pointer.
*
* \sa mood_open(), mood_cleanup_function, mood_score_function.
*/
-typedef int mood_parser(const char *, void **);
+typedef int mood_parser(int, char **, void **);
/**
* Deallocate resources which were allocated by the mood_parser.
return res;
}
-static int mm_no_attributes_set_parser(const char *arg, __a_unused void **ignored)
+static int mm_no_attributes_set_parser(int argc, __a_unused char **argv,
+ __a_unused void **ignored)
{
- if (arg && *arg)
- PARA_WARNING_LOG("ignored junk at eol: %s\n", arg);
- return 1;
+ return argc? -E_MOOD_SYNTAX : 1;
}
static int mm_no_attributes_set_score_function(__a_unused const char *path,
return -100;
}
-static int mm_played_rarely_parser(const char *arg, __a_unused void **ignored)
+static int mm_played_rarely_parser(int argc, __a_unused char **argv,
+ __a_unused void **ignored)
{
- if (arg && *arg)
- PARA_WARNING_LOG("ignored junk at eol: %s\n", arg);
- return 1;
+ return argc? -E_MOOD_SYNTAX : 1;
}
static int mm_path_matches_score_function(const char *path,
return 100;
}
-static int mm_path_matches_parser(const char *arg, void **data)
+static int mm_path_matches_parser(int argc, char **argv, void **data)
{
- *data = para_strdup(arg);
+ if (argc != 1)
+ return -E_MOOD_SYNTAX;
+ *data = para_strdup(argv[1]);
return 1;
}
free(data);
}
-static int mm_is_set_parser(const char *arg, void **bitnum)
+static int mm_is_set_parser(int argc, char **argv, void **bitnum)
{
- unsigned char *c = para_malloc(1);
- int ret = get_attribute_bitnum_by_name(arg, c);
+ int ret;
+ unsigned char c, *res;
- if (ret >= 0)
- *bitnum = c;
- else
- free(c);
- return ret;
+ if (argc != 1)
+ return -E_MOOD_SYNTAX;
+ ret = get_attribute_bitnum_by_name(argv[1], &c);
+ if (ret < 0)
+ return ret;
+ res = para_malloc(1);
+ *res = c;
+ *bitnum = res;
+ return 1;
}
static int mm_is_set_score_function(__a_unused const char *path,
ret = -E_MOOD_SYNTAX;
if (!mood_methods[i].parser)
goto out;
- w++;
- ret = mood_methods[i].parser(*w, &mi->parser_data);
+ ret = mood_methods[i].parser(num_words - 1 - (w - argv), w,
+ &mi->parser_data);
if (ret < 0)
goto out;
mi->method = &mood_methods[i];
* Johannes Overmann <overmann@iname.com>
*/
+#include <regex.h>
#include <osl.h>
+
#include "para.h"
#include "error.h"
#include "afh.h"
/** \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"
#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. */
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;
*/
/** \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>
/** \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"
#include "error.h"
#include "string.h"
-#include <vorbis/vorbisfile.h>
-
/** Determine byte sex. */
#ifdef WORDS_BIGENDIAN
#define ENDIAN 1
/** \file oss_write.c Paraslash's oss output plugin. */
+#include <regex.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <dirent.h>
* 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"
/** \file prebuffer_filter.c Paraslash's prebuffering filter. */
+#include <regex.h>
+
#include "para.h"
#include "prebuffer_filter.cmdline.h"
#include "list.h"
/** \file recv.c the stand-alone audio stream receiver */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
/** \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"
/** \file ringbuffer.c Simple ringbuffer implementation */
+#include <regex.h>
+
#include "para.h"
#include "ringbuffer.h"
#include "string.h"
/** \file sched.c Paraslash's scheduling functions. */
+#include <regex.h>
#include <dirent.h> /* readdir() */
#include <assert.h>
#include <sys/time.h>
*/
/** \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"
/** \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"
#include <dirent.h>
#include <sys/time.h>
#include <openssl/rc4.h>
+#include <regex.h>
#include <osl.h>
#include "para.h"
* and para_audiod.
*/
-
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
#include <dirent.h> /* readdir() */
#include <assert.h>
-
#include "para.h"
-#include "string.h"
#include "list.h"
#include "sched.h"
#include "fd.h"
#include <assert.h>
#include "para.h"
-#include "string.h"
#include "list.h"
#include "sched.h"
#include "fd.h"
/** \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"
/**
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;
+}
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);
*/
/** \file udp_recv.c Paraslash's udp receiver */
+#include <regex.h>
#include <dirent.h>
#include <sys/socket.h>
#include <net/if.h>
/** \file udp_send.c Para_server's udp sender. */
+#include <regex.h>
#include <sys/time.h>
#include <dirent.h>
#include <sys/socket.h>
/** \file user_list.c User handling for para_server. */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
#include <openssl/rc4.h>
* senders.
*/
+#include <regex.h>
#include <dirent.h>
#include <osl.h>
/** \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"
/** \file write.c Paraslash's standalone wav/raw player. */
+#include <regex.h>
#include <sys/types.h>
#include <dirent.h>
/** \file write_common.c common functions of para_audiod and para_write */
+#include <regex.h>
+
#include "para.h"
#include "string.h"
#include "list.h"