]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/shell/logger.c
UCW::CGI: No deescaping should be applied to multipart/www-data
[libucw.git] / ucw / shell / logger.c
index 8d67abec5c09ff15d1e5737f344e277110c9016c..7e88b4b6e9c5544119ec244de995687601a529cd 100644 (file)
@@ -1,13 +1,14 @@
 /*
  *     UCW Library Utilities -- A Simple Logger for use in shell scripts
  *
 /*
  *     UCW Library Utilities -- A Simple Logger for use in shell scripts
  *
- *     (c) 2001 Martin Mares <mj@ucw.cz>
+ *     (c) 2001--2009 Martin Mares <mj@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU Lesser General Public License.
  */
 
 #include "ucw/lib.h"
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU Lesser General Public License.
  */
 
 #include "ucw/lib.h"
+#include "ucw/log.h"
 
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -28,15 +29,22 @@ main(int argc, char **argv)
     }
   else
     log_init(argv[1]);
     }
   else
     log_init(argv[1]);
+
+  uns level = 0;
+  while (level < L_MAX && LS_LEVEL_LETTER(level) != argv[2][0])
+    level++;
+  if (level >= L_MAX)
+    die("Unknown logging level `%s'", argv[2]);
+
   if (argc > 3)
   if (argc > 3)
-    msg(argv[2][0], argv[3]);
+    msg(level, argv[3]);
   else
     while (fgets(buf, sizeof(buf), stdin))
       {
        c = strchr(buf, '\n');
        if (c)
          *c = 0;
   else
     while (fgets(buf, sizeof(buf), stdin))
       {
        c = strchr(buf, '\n');
        if (c)
          *c = 0;
-       msg(argv[2][0], buf);
+       msg(level, buf);
       }
   return 0;
 }
       }
   return 0;
 }