first version of the universal paraslash scheduler
[paraslash.git] / filter.c
index 2e5e205eaed82d5d69e9ff81d7fa39082513a9b4..a035c6e652cdfebed3d59708d763768c5c5e3bc2 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -17,7 +17,6 @@
  */
 /** \file filter.c the stand-alone filter program */
 
-#include "gcc-compat.h"
 #include "para.h"
 
 #include "filter.cmdline.h"
@@ -35,7 +34,7 @@ static struct filter_chain_info *fci = &filter_chain_info_struct;
 
 struct gengetopt_args_info conf;
 
-__printf_2_3 void para_log(int ll, char* fmt,...)
+__printf_2_3 void para_log(int ll, const char* fmt,...)
 {
        va_list argp;
 
@@ -96,7 +95,7 @@ static void open_filters(void)
 static int parse_config(int argc, char *argv[])
 {
        static char *cf; /* config file */
-        struct stat statbuf;
+       struct stat statbuf;
        int i;
 
        if (cmdline_parser(argc, argv, &conf))
@@ -106,7 +105,7 @@ static int parse_config(int argc, char *argv[])
                cf = make_message("%s/.paraslash/filter.conf", home);
                free(home);
        }
-        if (!stat(cf, &statbuf)) {
+       if (!stat(cf, &statbuf)) {
                if (cmdline_parser_configfile(cf, &conf, 0, 0, 0))
                        return -E_FILTER_SYNTAX;
        }
@@ -114,8 +113,10 @@ static int parse_config(int argc, char *argv[])
                return 1;
        printf("available filters: ");
        for (i = 0; filters[i].name; i++)
-               printf("%s%s", i? " " : "", filters[i].name);
-       printf("\nTry para_filter -f<filtername>:-h for help on <filtername>\n");
+               printf("%s%s%s", i? " " : "", filters[i].name,
+                       filters[i].parse_config? "*": "");
+       printf("\nFilters marked with \"*\" have further command line options. Try\n"
+               "\tpara_filter -f '<filtername> -h'\nfor more information.\n");
        exit(EXIT_SUCCESS);
 }
 
@@ -142,7 +143,7 @@ int main(int argc, char *argv[])
 again:
        if (*il < INBUF_SIZE && !eof) {
                ret  = read(STDIN_FILENO, ib + *il, INBUF_SIZE - *il);
-               PARA_DEBUG_LOG("read %d/%d\n", ret, INBUF_SIZE - *il);
+               PARA_DEBUG_LOG("read %d/%zd\n", ret, INBUF_SIZE - *il);
                if (ret < 0)
                        goto out;
                if (!ret)
@@ -155,12 +156,12 @@ again:
        converted = ret;
        if (*ol) {
                ret = write(STDOUT_FILENO, ob, *ol);
-               PARA_DEBUG_LOG("wrote %d/%d\n", ret, *ol);
+               PARA_DEBUG_LOG("wrote %d/%zd\n", ret, *ol);
                if (ret <= 0)
                        goto out;
                *ol -= ret;
                if (*ol) {
-                       PARA_NOTICE_LOG("short write: %d bytes left\n", *ol);
+                       PARA_NOTICE_LOG("short write: %zd bytes left\n", *ol);
                        memmove(ob, ob + ret, *ol);
                }
        }