[Top][All Lists]

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

Re: gnokii 0.6.30

From: Daniele Forsi
Subject: Re: gnokii 0.6.30
Date: Sun, 30 Jan 2011 12:16:36 +0100

2011/1/30 Pawel Kot:

> On Sat, Jan 29, 2011 at 03:30, Noel Butler <address@hidden> wrote:
>> On Fri, 2011-01-28 at 10:52 +0100, Pawel Kot wrote:
>> > reports. Is this redirection to stderr anyhow harmful?
>> If people use scripts that expect a certain return it might.
> Honestly, if the script relies on stderr output, I'd call it broken...

me too

>> If it is not easy to give it a config option, perhaps make the warnings
>> silent unless in debug mode? and whilst we are on that, maybe the same for

they aren't warnings, they are informational messages at that point,
however we can apply a patch like this to print the messages only when
they are errors (ie when none of the files could be opened), ie first
for-lop tries to open the files and exits early if one could be
opened, second for-loop prints the messages only if the first loop
exited with error and inconditionally frees all strings (I wonder if
gnokii_strfreev() could be used after modifying get_locations):

diff --git a/common/cfgreader.c b/common/cfgreader.c
index ebeb212..946645b 100644
--- a/common/cfgreader.c
+++ b/common/cfgreader.c
@@ -1126,13 +1126,15 @@ GNOKII_API gn_error gn_cfg_read_default()

        config_file_locations = get_locations(&num);

+       for (i = 0; i < num && error != GN_ERR_NONE; i++) {
+               error = gn_cfg_file_read(config_file_locations[i]);
+       }
        for (i = 0; i < num; i++) {
-               if (error != GN_ERR_NONE)
-                       error = gn_cfg_file_read(config_file_locations[i]);
+               /* If couldn't read any config show all filenames tried */
                if (error != GN_ERR_NONE)
                        fprintf(stderr, _("Couldn't read %s config
file.\n"), config_file_locations[i]);
-       }
+       }
        return error;

Daniele Forsi

reply via email to

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