--- doodle-0.7.0.orig/src/doodle/doodle.c 2010-01-14 11:52:35.000000000 +0100 +++ doodle-0.7.0/src/doodle/doodle.c 2012-08-12 19:29:29.000000000 +0200 @@ -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 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;