gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23209 - in doodle: . src/doodle


From: gnunet
Subject: [GNUnet-SVN] r23209 - in doodle: . src/doodle
Date: Mon, 13 Aug 2012 11:07:20 +0200

Author: grothoff
Date: 2012-08-13 11:07:20 +0200 (Mon, 13 Aug 2012)
New Revision: 23209

Modified:
   doodle/ChangeLog
   doodle/src/doodle/doodle.c
Log:
patch from #2510

Modified: doodle/ChangeLog
===================================================================
--- doodle/ChangeLog    2012-08-13 08:35:11 UTC (rev 23208)
+++ doodle/ChangeLog    2012-08-13 09:07:20 UTC (rev 23209)
@@ -1,3 +1,6 @@
+Mon Aug 13 11:06:25 CEST 2012
+       Reducing default verbosity, sending errors to stderr (#2510). -mw
+
 Sun Jul 29 22:44:06 CEST 2012
        Added Esperanto translation.
 

Modified: doodle/src/doodle/doodle.c
===================================================================
--- doodle/src/doodle/doodle.c  2012-08-13 08:35:11 UTC (rev 23208)
+++ doodle/src/doodle/doodle.c  2012-08-13 09:07:20 UTC (rev 23209)
@@ -184,10 +184,10 @@
     return 0; /* already processed */
   if (0 != stat(filename,
                &sbuf)) {
-    printf(_("Call to '%s' for file '%s' failed: %s\n"),
-          "stat",
-          filename,
-          strerror(errno));
+    fprintf(stderr, _("Call to '%s' for file '%s' failed: %s\n"),
+           "stat",
+           filename,
+           strerror(errno));
     return 0;
   }
   if (S_ISREG(sbuf.st_mode)) {
@@ -215,14 +215,15 @@
   char * ename;
 
   if (dbName == NULL) {
-    printf(_("No database specified.  Aborting.\n"));
+    fprintf(stderr, _("No database specified.  Aborting.\n"));
     return -1;
   }
   for (i=strlen(dbName);i>=0;i--) {
     if (dbName[i] == ':') {
-      printf(_("'%s' is an invalid database filename (has a colon) for 
building database (option '%s').\n"),
-            dbName,
-            "-b");
+      fprintf(stderr,
+             _("'%s' is an invalid database filename (has a colon) for 
building database (option '%s').\n"),
+             dbName,
+             "-b");
       return -1;
     }
   }
@@ -252,9 +253,9 @@
   if (log != NULL) {
     cls.logFile = fopen(log, "w+");
     if (cls.logFile == NULL)
-      printf(_("Could not open '%s' for logging: %s.\n"),
-            log,
-            strerror(errno));
+      fprintf(stderr, _("Could not open '%s' for logging: %s.\n"),
+             log,
+             strerror(errno));
   }
 
   ret = 0;
@@ -340,15 +341,15 @@
   int ret;
 
  if (dbName == NULL) {
-    printf(_("No database specified. Aborting.\n"));
+    fprintf(stderr, _("No database specified. Aborting.\n"));
     return -1;
   }
   ename = expandFileName(dbName);
   if (0 != stat(ename, &buf)) {
-    printf(_("Call to '%s' for file '%s' failed: %s.\n"),
-          "stat",
-          dbName,
-          strerror(errno));
+    fprintf(stderr, _("Call to '%s' for file '%s' failed: %s.\n"),
+           "stat",
+           dbName,
+           strerror(errno));
     free(ename);
     return -1;
   }
@@ -379,15 +380,15 @@
   char * utf;
 
   if (dbName == NULL) {
-    printf(_("No database specified. Aborting.\n"));
+    fprintf(stderr, _("No database specified. Aborting.\n"));
     return -1;
   }
   ename = expandFileName(dbName);
   if (0 != stat(ename, &buf)) {
-    printf(_("Call to '%s' for file '%s' failed: %s.\n"),
-          "stat",
-          dbName,
-          strerror(errno));
+    fprintf(stderr, _("Call to '%s' for file '%s' failed: %s.\n"),
+           "stat",
+           dbName,
+           strerror(errno));
     free(ename);
     return -1;
   }
@@ -420,16 +421,20 @@
   args.seen_count = 0;
 
   for (i=0;i<argc;i++) {
-    printf(_("Searching for '%s':\n"),
-          argv[i]);
+    if(verbose) {
+      printf(_("Searching for '%s':\n"),
+            argv[i]);
+    }
     if (strlen(argv[i]) > MAX_LENGTH) {
-      printf(_("Warning: search string is longer than %d characters, search 
will not work.\n"),
-            MAX_LENGTH);
+      fprintf(stderr,
+             _("Warning: search string is longer than %d characters, search 
will not work.\n"),
+             MAX_LENGTH);
       continue; /* no need to even try... */
     }
     if (strlen(argv[i]) > MAX_LENGTH/2) {
-      printf(_("Warning: search string is longer than %d characters, search 
may not work properly.\n"),
-            MAX_LENGTH/2);
+      fprintf(stderr,
+             _("Warning: search string is longer than %d characters, search 
may not work properly.\n"),
+             MAX_LENGTH/2);
     }
     utf = convertToUtf8(argv[i],
                        strlen(argv[i]),
@@ -440,7 +445,9 @@
                                  utf,
                                  (DOODLE_ResultCallback) &printIt,
                                  &args)) {
-       printf(_("\tNot found!\n"));
+       if(verbose) {
+         printf(_("\tNot found!\n"));
+       }
        ret++;
       }
     } else {
@@ -450,7 +457,9 @@
                                         utf,
                                         (DOODLE_ResultCallback) &printIt,
                                         &args)) {
-       printf(_("\tNot found!\n"));
+       if (verbose) {
+         printf(_("\tNot found!\n"));
+       }
        ret++;
       }
     }
@@ -520,31 +529,36 @@
     switch (c) {
     case 'a':
       if (1 != sscanf(optarg, "%ud", &do_approx)) {
-       printf(_("You must pass a number to the '%s' option.\n"),
-              "-a");
+       fprintf(stderr,
+               _("You must pass a number to the '%s' option.\n"),
+               "-a");
        return -1;
       }
       if (do_build == 1) {
-       printf(_("The options '%s' and '%s' cannot be used together!\n"),
-              "-a", "-b");
+       fprintf(stderr,
+               _("The options '%s' and '%s' cannot be used together!\n"),
+               "-a", "-b");
        return -1;
-      }        
+      }
       break;
     case 'b':
       do_build = 1;
       if (do_approx != 0) {
-       printf(_("The options '%s' and '%s' cannot be used together!\n"),
-              "-a", "-b");
+       fprintf(stderr,
+               _("The options '%s' and '%s' cannot be used together!\n"),
+               "-a", "-b");
        return -1;
-      }        
+      }
       if (do_print == 1) {
-       printf(_("The options '%s' and '%s' cannot be used together!\n"),
-              "-b", "-p");
+       fprintf(stderr,
+               _("The options '%s' and '%s' cannot be used together!\n"),
+               "-b", "-p");
        return -1;
-      }        
+      }
       if (ignore_case == 1) {
-       printf(_("The options '%s' and '%s' cannot be used together!\n"),
-              "-b", "-i");
+       fprintf(stderr,
+               _("The options '%s' and '%s' cannot be used together!\n"),
+               "-b", "-i");
        return -1;
       }
       break;
@@ -563,8 +577,9 @@
     case 'i':
       ignore_case = 1;
       if (do_build == 1) {
-       printf(_("The options '%s' and '%s' cannot be used together!\n"),
-              "-b", "-i");
+       fprintf(stderr,
+               _("The options '%s' and '%s' cannot be used together!\n"),
+               "-b", "-i");
        return -1;
       }
       break;
@@ -576,12 +591,13 @@
       break;
     case 'm':
       if (1 != sscanf(optarg, "%u", &mem_limit)) {
-       printf(_("You must pass a number to the '%s' option.\n"),
-              "-m");
+       fprintf(stderr,
+               _("You must pass a number to the '%s' option.\n"),
+               "-m");
        return -1;
       }
       if (mem_limit > 0xFFFFFFFF / 1024 / 1024) {
-       printf(_("Specified memory limit is too high.\n"));
+       fprintf(stderr, _("Specified memory limit is too high.\n"));
        return -1;
       }
       mem_limit *= 1024 * 1024;
@@ -592,10 +608,11 @@
     case 'p':
       do_print = 1;
       if (do_build == 1) {
-       printf(_("The options '%s' and '%s' cannot be used together!\n"),
-              "-b", "-p");
+       fprintf(stderr,
+               _("The options '%s' and '%s' cannot be used together!\n"),
+               "-b", "-p");
        return -1;
-      }        
+      }
       break;
     case 'P':
       prunepaths = optarg;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]