summaryrefslogtreecommitdiff
path: root/libshouldbeinlibc
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-02-20 00:05:09 +0000
committerMiles Bader <miles@gnu.org>1997-02-20 00:05:09 +0000
commit9550f5cff5c6fb961d5d0662f07ae61b7c1fee99 (patch)
treeecb4e82d814a3266e682e6f4a16648879310f37a /libshouldbeinlibc
parent4837142699b837558b134ff0623036983baec857 (diff)
Merge changes from libc 1997-02-17.
Diffstat (limited to 'libshouldbeinlibc')
-rw-r--r--libshouldbeinlibc/argp-help.c20
-rw-r--r--libshouldbeinlibc/argp-parse.c1
-rw-r--r--libshouldbeinlibc/argp-test.c4
-rw-r--r--libshouldbeinlibc/argp.h36
4 files changed, 36 insertions, 25 deletions
diff --git a/libshouldbeinlibc/argp-help.c b/libshouldbeinlibc/argp-help.c
index af18d24d..6ae13135 100644
--- a/libshouldbeinlibc/argp-help.c
+++ b/libshouldbeinlibc/argp-help.c
@@ -744,7 +744,7 @@ struct pentry_state
};
/* If a user doc filter should be applied to DOC, do so. */
-static char *
+static const char *
filter_doc (const char *doc, int key, const struct argp *argp,
struct pentry_state *pest)
{
@@ -769,7 +769,7 @@ print_header (const char *str, const struct argp *argp,
struct pentry_state *pest)
{
const char *tstr = gettext (str);
- char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest);
+ const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest);
if (fstr)
{
@@ -791,7 +791,7 @@ print_header (const char *str, const struct argp *argp,
}
if (fstr != tstr)
- free (fstr);
+ free ((char *) fstr);
}
/* Inserts a comma if this isn't the first item on the line, and then makes
@@ -908,7 +908,7 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
else
{
const char *tstr = real->doc ? gettext (real->doc) : 0;
- char *fstr = filter_doc (tstr, real->key, entry->argp, &pest);
+ const char *fstr = filter_doc (tstr, real->key, entry->argp, &pest);
if (fstr && *fstr)
{
unsigned col = __argp_fmtstream_point (stream);
@@ -926,7 +926,7 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
__argp_fmtstream_puts (stream, fstr);
}
if (fstr && fstr != tstr)
- free (fstr);
+ free ((char *) fstr);
/* Reset the left margin. */
__argp_fmtstream_set_lmargin (stream, 0);
@@ -1173,7 +1173,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
int post, int pre_blank, int first_only,
argp_fmtstream_t stream)
{
- char *text;
+ const char *text;
const char *inp_text;
void *input = 0;
int anything = 0;
@@ -1204,7 +1204,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
inp_text, input);
}
else
- text = (char *)inp_text;
+ text = (const char *) inp_text;
if (text)
{
@@ -1223,9 +1223,9 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
}
if (text && text != inp_text)
- free (text); /* Free TEXT returned from the help filter. */
+ free ((char *) text); /* Free TEXT returned from the help filter. */
if (inp_text && inp_text_limit && argp->help_filter)
- free ((char *)inp_text); /* We copied INP_TEXT, so free it now. */
+ free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */
if (post && argp->help_filter)
/* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */
@@ -1236,7 +1236,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
if (anything || pre_blank)
__argp_fmtstream_putc (stream, '\n');
__argp_fmtstream_puts (stream, text);
- free (text);
+ free ((char *) text);
if (__argp_fmtstream_point (stream)
> __argp_fmtstream_lmargin (stream))
__argp_fmtstream_putc (stream, '\n');
diff --git a/libshouldbeinlibc/argp-parse.c b/libshouldbeinlibc/argp-parse.c
index 721ed327..407ba19c 100644
--- a/libshouldbeinlibc/argp-parse.c
+++ b/libshouldbeinlibc/argp-parse.c
@@ -36,6 +36,7 @@
# define _(msgid) gettext (msgid)
#else
# define _(msgid) (msgid)
+# define gettext(msgid) (msgid)
#endif
#endif
diff --git a/libshouldbeinlibc/argp-test.c b/libshouldbeinlibc/argp-test.c
index a3a40c3f..702ae9aa 100644
--- a/libshouldbeinlibc/argp-test.c
+++ b/libshouldbeinlibc/argp-test.c
@@ -27,7 +27,7 @@
#include <string.h>
#include <argp.h>
-char *argp_program_version = "argp-test 1.0";
+const char *argp_program_version = "argp-test 1.0";
struct argp_option sub_options[] =
{
@@ -71,7 +71,7 @@ static char *
sub_help_filter (int key, const char *text, void *input)
{
if (key == ARGP_KEY_HELP_EXTRA)
- return strdup ("This is some extra text from the sub parser (note that it
+ return strdup ("This is some extra text from the sub parser (note that it \
is preceded by a blank line).");
else
return (char *)text;
diff --git a/libshouldbeinlibc/argp.h b/libshouldbeinlibc/argp.h
index e2eabb8b..f0bd4d1e 100644
--- a/libshouldbeinlibc/argp.h
+++ b/libshouldbeinlibc/argp.h
@@ -22,14 +22,20 @@
#define __ARGP_H__
#include <stdio.h>
-#include <errno.h>
#include <ctype.h>
#include <getopt.h>
+#define __need_error_t
+#include <errno.h>
+
#ifndef __const
#define __const const
#endif
+#ifndef __error_t_defined
+typedef int error_t;
+#endif
+
#ifndef __P
# if (defined (__STDC__) && __STDC__) || defined (__cplusplus)
# define __P(args) args
@@ -348,10 +354,10 @@ struct argp_state
routine returned a non-zero value, it is returned; otherwise 0 is
returned. This function may also call exit unless the ARGP_NO_HELP flag
is set. INPUT is a pointer to a value to be passed in to the parser. */
-error_t argp_parse __P ((__const struct argp *__argp,
+extern error_t argp_parse __P ((__const struct argp *__argp,
int __argc, char **__argv, unsigned __flags,
int *__arg_index, void *__input));
-error_t __argp_parse __P ((__const struct argp *__argp,
+extern error_t __argp_parse __P ((__const struct argp *__argp,
int __argc, char **__argv, unsigned __flags,
int *__arg_index, void *__input));
@@ -359,9 +365,9 @@ error_t __argp_parse __P ((__const struct argp *__argp,
/* If defined or set by the user program to a non-zero value, then a default
option --version is added (unless the ARGP_NO_HELP flag is used), which
- will print this this string followed by a newline and exit (unless the
+ will print this string followed by a newline and exit (unless the
ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
-extern char *argp_program_version;
+extern const char *argp_program_version;
/* If defined or set by the user program to a non-zero value, then a default
option --version is added (unless the ARGP_NO_HELP flag is used), which
@@ -436,9 +442,11 @@ extern void __argp_usage __P ((struct argp_state *__state));
/* If appropriate, print the printf string FMT and following args, preceded
by the program name and `:', to stderr, and followed by a `Try ... --help'
message, then exit (1). */
-void argp_error __P ((struct argp_state *__state, __const char *__fmt, ...))
+extern void argp_error __P ((struct argp_state *__state, __const char *__fmt,
+ ...))
__attribute__ ((__format__ (__printf__, 2, 3)));
-void __argp_error __P ((struct argp_state *__state, __const char *__fmt, ...))
+extern void __argp_error __P ((struct argp_state *__state,
+ __const char *__fmt, ...))
__attribute__ ((__format__ (__printf__, 2, 3)));
/* Similar to the standard gnu error-reporting function error(), but will
@@ -449,11 +457,11 @@ void __argp_error __P ((struct argp_state *__state, __const char *__fmt, ...))
difference between this function and argp_error is that the latter is for
*parsing errors*, and the former is for other problems that occur during
parsing but don't reflect a (syntactic) problem with the input. */
-void argp_failure __P ((struct argp_state *__state,
- int __status, int __errnum, __const char *__fmt, ...))
+extern void argp_failure __P ((struct argp_state *__state, int __status,
+ int __errnum, __const char *__fmt, ...))
__attribute__ ((__format__ (__printf__, 4, 5)));
-void __argp_failure __P ((struct argp_state *__state,
- int __status, int __errnum, __const char *__fmt, ...))
+extern void __argp_failure __P ((struct argp_state *__state, int __status,
+ int __errnum, __const char *__fmt, ...))
__attribute__ ((__format__ (__printf__, 4, 5)));
/* Returns true if the option OPT is a valid short option. */
@@ -467,8 +475,10 @@ extern int __option_is_end __P ((__const struct argp_option *__opt));
/* Return the input field for ARGP in the parser corresponding to STATE; used
by the help routines. */
-void *_argp_input (__const struct argp *argp, __const struct argp_state *state);
-void *__argp_input (__const struct argp *argp, __const struct argp_state *state);
+extern void *_argp_input __P ((__const struct argp *argp,
+ __const struct argp_state *state));
+extern void *__argp_input __P ((__const struct argp *argp,
+ __const struct argp_state *state));
#ifdef __OPTIMIZE__