+2008-11-12 Steven Schubiger <stsc@members.fsf.org>
+
+ * main.c (print_version): Hand the relevant
+ xstrdup/xfree calls back to format_and_print_line().
+
2008-11-11 Steven Schubiger <stsc@members.fsf.org>
* main.c (format_and_print_line): Move both the memory
and an appropriate number of spaces are added on subsequent
lines.*/
static void
-format_and_print_line (const char *prefix, char *line,
+format_and_print_line (const char *prefix, const char *line,
int line_length)
{
int leading_spaces;
int remaining_chars;
- char *token;
+ char *line_dup, *token;
assert (prefix != NULL);
assert (line != NULL);
+ line_dup = xstrdup (line);
+
if (line_length <= 0)
line_length = max_chars_per_line;
printf ("%s", prefix);
remaining_chars = line_length - leading_spaces;
/* We break on spaces. */
- token = strtok (line, " ");
+ token = strtok (line_dup, " ");
while (token != NULL)
{
/* If however a token is much larger than the maximum
}
printf ("\n");
+
+ xfree (line_dup);
}
static void
putchar ('\n');
#endif
- line = xstrdup (LOCALEDIR);
format_and_print_line (locale_title,
- line,
+ LOCALEDIR,
max_chars_per_line);
- xfree (line);
- line = xstrdup (compilation_string);
format_and_print_line (compile_title,
- line,
+ compilation_string,
max_chars_per_line);
- xfree (line);
- line = xstrdup (link_string);
format_and_print_line (link_title,
- line,
+ link_string,
max_chars_per_line);
- xfree (line);
printf ("\n");
/* TRANSLATORS: When available, an actual copyright character