-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Saint Xavier wrote:
> Hi,
> 
> * Gisle Vanem ([EMAIL PROTECTED]) wrote:
>> 'program_name' is used in lib/error.c, but it is not allocated anywhere. 
>> Should it be added to main.c and initialised to exec_name?
> 
> $cd wget-mainline
> $find . -name '*.[ch]' -exec fgrep -H -n 'program_name' '{}' \;
> ./lib/error.c:63:# define program_name program_invocation_name
>                                        ^^^^^^^^^^^^^^^^^^^^^^^
> ./lib/error.c:95:/* The calling program should define program_name and set it 
> to the
                          ^^^^^^^^^^^^^^^

Looks to me like we're expected to supply it. Line 63 is only evaluated
when we're using glibc; otherwise, we need to provide it. The differing
name is probably so we can define it unconditionally.

It appears that lib/error.c isn't even _built_ on my system, perhaps
because glibc supplies what it would fill in. This makes testing a
little dificult. Anyway, see if this fixes your trouble:

diff -r 0c2e02c4f4f3 src/ChangeLog
- --- a/src/ChangeLog     Tue Sep 09 09:29:50 2008 -0700
+++ b/src/ChangeLog     Tue Sep 09 09:40:00 2008 -0700
@@ -1,3 +1,7 @@
+2008-09-09  Micah Cowan  <[EMAIL PROTECTED]>
+
+       * main.c: Define program_name for lib/error.c.
+
 2008-09-02  Gisle Vanem  <[EMAIL PROTECTED]>

        * mswindows.h: Must ensure <stdio.h> is included before
diff -r 0c2e02c4f4f3 src/main.c
- --- a/src/main.c        Tue Sep 09 09:29:50 2008 -0700
+++ b/src/main.c        Tue Sep 09 09:40:00 2008 -0700
@@ -826,6 +826,8 @@
   exit (0);
 }

+char *program_name; /* Needed by lib/error.c. */
+
 int
 main (int argc, char **argv)
 {
@@ -833,6 +835,8 @@
   int i, ret, longindex;
   int nurl, status;
   bool append_to_log = false;
+
+  program_name = argv[0];

   i18n_initialize ();



- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer.
GNU Maintainer: wget, screen, teseq
http://micah.cowan.name/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIxqf67M8hyUobTrERAq0+AJ9KIOFDn9FiDXIIlU6M7DsupDmPYQCcDuoo
9bgAQnuKpgYMvnwc18svfYg=
=DXYi
-----END PGP SIGNATURE-----

Reply via email to