[Forensics-changes] [yara] 264/415: Allow to disable warnings from command line in yarac

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:43:13 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch debian
in repository yara.

commit 6c432879aa6e9590c4dc80856c03b6e8083059dc
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Thu Nov 28 19:52:30 2013 +0100

    Allow to disable warnings from command line in yarac
---
 yarac.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/yarac.c b/yarac.c
index 0fbbfb3..d52a582 100644
--- a/yarac.c
+++ b/yarac.c
@@ -41,11 +41,15 @@ limitations under the License.
 #endif
 
 
+int show_warnings = TRUE;
+
+
 void show_help()
 {
   printf("usage:  yarac [OPTION]... [RULE_FILE]... OUTPUT_FILE\n");
   printf("options:\n");
   printf("  -d <identifier>=<value>   define external variable.\n");
+  printf("  -w                        disable warnings.\n");
   printf("  -v                        show version information.\n");
   printf("\nReport bugs to: <%s>\n", PACKAGE_BUGREPORT);
 }
@@ -74,7 +78,7 @@ int process_cmd_line(
   char c;
   opterr = 0;
 
-  while ((c = getopt (argc, (char**) argv, "vd:")) != -1)
+  while ((c = getopt (argc, (char**) argv, "wvd:")) != -1)
   {
     switch (c)
     {
@@ -82,6 +86,10 @@ int process_cmd_line(
         printf("%s\n", PACKAGE_STRING);
         return 0;
 
+      case 'w':
+        show_warnings = FALSE;
+        break;
+
       case 'd':
         equal_sign = strchr(optarg, '=');
 
@@ -142,9 +150,14 @@ void report_error(
     const char* message)
 {
   if (error_level == YARA_ERROR_LEVEL_ERROR)
+  {
     fprintf(stderr, "%s(%d): error: %s\n", file_name, line_number, message);
+  }
   else
-    fprintf(stderr, "%s(%d): warning: %s\n", file_name, line_number, message);
+  {
+    if (show_warnings)
+      fprintf(stderr, "%s(%d): warning: %s\n", file_name, line_number, message);
+  }
 }
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list