1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Make program_name and program_argstring const

This commit is contained in:
Tim Rühsen 2014-11-24 10:20:51 +01:00
parent 5e2ecaf277
commit 9217b864d8
4 changed files with 13 additions and 8 deletions

View File

@ -1,3 +1,7 @@
2014-11-24 Tim Ruehsen <tim.ruehsen@gmx.de>
* wget.h, test.c, main.c: Make program_name and program_argstring const
2014-11-24 Tim Ruehsen <tim.ruehsen@gmx.de> 2014-11-24 Tim Ruehsen <tim.ruehsen@gmx.de>
* warc.c: Fix C89 compile errors using ./configure --without-libuuid * warc.c: Fix C89 compile errors using ./configure --without-libuuid

View File

@ -1001,8 +1001,8 @@ There is NO WARRANTY, to the extent permitted by law.\n"), stdout) < 0)
exit (WGET_EXIT_SUCCESS); exit (WGET_EXIT_SUCCESS);
} }
char *program_name; /* Needed by lib/error.c. */ const char *program_name; /* Needed by lib/error.c. */
char *program_argstring; /* Needed by wget_warc.c. */ const char *program_argstring; /* Needed by wget_warc.c. */
int int
main (int argc, char **argv) main (int argc, char **argv)
@ -1044,7 +1044,7 @@ main (int argc, char **argv)
/* Construct the arguments string. */ /* Construct the arguments string. */
for (argstring_length = 1, i = 1; i < argc; i++) for (argstring_length = 1, i = 1; i < argc; i++)
argstring_length += strlen (argv[i]) + 2 + 1; argstring_length += strlen (argv[i]) + 2 + 1;
p = program_argstring = malloc (argstring_length * sizeof (char)); p = malloc (argstring_length * sizeof (char));
if (p == NULL) if (p == NULL)
{ {
fprintf (stderr, _("Memory allocation problem\n")); fprintf (stderr, _("Memory allocation problem\n"));
@ -1062,6 +1062,7 @@ main (int argc, char **argv)
*p++ = ' '; *p++ = ' ';
} }
*p = '\0'; *p = '\0';
program_argstring = p;
/* Load the hard-coded defaults. */ /* Load the hard-coded defaults. */
defaults (); defaults ();

View File

@ -51,7 +51,7 @@ const char *test_append_uri_pathel(void);
const char *test_are_urls_equal(void); const char *test_are_urls_equal(void);
const char *test_is_robots_txt_url(void); const char *test_is_robots_txt_url(void);
char *program_argstring = "TEST"; const char *program_argstring = "TEST";
int tests_run; int tests_run;
@ -71,10 +71,10 @@ all_tests(void)
return NULL; return NULL;
} }
char *program_name; /* Needed by lib/error.c. */ const char *program_name; /* Needed by lib/error.c. */
int int
main (int argc _GL_UNUSED, char *argv[]) main (int argc _GL_UNUSED, const char *argv[])
{ {
const char *result; const char *result;

View File

@ -313,8 +313,8 @@ typedef double SUM_SIZE_INT;
#define MAX_INT_TO_STRING_LEN(x) ((sizeof(x) * 24082 / 10000) + 2) #define MAX_INT_TO_STRING_LEN(x) ((sizeof(x) * 24082 / 10000) + 2)
extern const char *exec_name; extern const char *exec_name;
extern char *program_name; extern const char *program_name;
extern char *program_argstring; extern const char *program_argstring;
/* Document type ("dt") flags */ /* Document type ("dt") flags */
enum enum