#define _POSIX_SOURCE
#endif
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include "system.h"
#include <sys/stat.h>
#if ! defined (_WIN32) || defined (__CYGWIN32__)
but it normally does declare it. This means that configure thinks we don't
need to declare it. Favor using strrchr if it is available. */
+#ifndef strrchr
#ifndef HAVE_STRRCHR
#ifdef HAVE_RINDEX
#define strrchr rindex
#endif
#endif
+#endif
/* Include getopt.h for the sake of getopt_long.
We don't need the declaration of getopt, and it could conflict
#include "getopt.h"
#undef getopt
-#ifndef HAVE_STRERROR
-extern int sys_nerr;
-extern char *sys_errlist[];
-#else
-extern char *strerror();
-#endif
-
extern char *version_string;
/* Systems which are compatible only with POSIX 1003.1-1988 (but *not*
extern char *getpwd ();
extern char *choose_temp_base PROTO ((void));
+extern char * my_strerror PROTO ((int));
extern int pexecute PROTO ((const char *, char * const *, const char *,
const char *, char **, char **, int));
typedef char * const_pointer_type;
#endif
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-
-#ifndef O_WRONLY
-#define O_WRONLY 1
-#endif
-
#if defined(POSIX)
#include <signal.h>
#define NONCONST
-/* Define a STRINGIFY macro that's right for ANSI or traditional C. */
-
-#if defined(HAVE_CPP_STRINGIFY) || (defined(__GNUC__) && defined(__STDC__))
-#define STRINGIFY(STRING) #STRING
-#else
-#define STRINGIFY(STRING) "STRING"
-#endif
-
/* Define a default place to find the SYSCALLS.X file. */
#ifndef STD_PROTO_DIR
is_id_char (ch)
char ch;
{
- return (isalnum (ch) || (ch == '_') || (ch == '$'));
+ return (ISALNUM (ch) || (ch == '_') || (ch == '$'));
}
/* Give a message indicating the proper way to invoke this program and then
}
/* Handle a special case. If we have a function definition marked as
- being in "old" style, and if it's formal names list is empty, then
+ being in "old" style, and if its formal names list is empty, then
it may actually have the string "void" in its real formals list
in the original source code. Just to make sure, we will get setup
to convert such things anyway.
temp_params[param_count++] = compiler_file_name;
for (;;)
{
- while (isspace (*params_list))
+ while (ISSPACE (*params_list))
params_list++;
if (!*params_list)
break;
param = params_list;
- while (*params_list && !isspace (*params_list))
+ while (*params_list && !ISSPACE (*params_list))
params_list++;
if (param[0] != '-')
temp_params[param_count++]
case 'c':
break; /* Don't copy these. */
case 'o':
- while (isspace (*params_list))
+ while (ISSPACE (*params_list))
params_list++;
- while (*params_list && !isspace (*params_list))
+ while (*params_list && !ISSPACE (*params_list))
params_list++;
break;
default:
Also, for each item which is only a function declaration, but which
nonetheless has its own prototype already (obviously supplied by the user)
- declare the item as it's own definition.
+ declare the item as its own definition.
Note that when/if there are multiple user-supplied prototypes already
present for multiple declarations of any given function, these multiple
forward_to_next_token_char (ptr)
const char *ptr;
{
- for (++ptr; isspace (*ptr); check_source (++ptr < clean_text_limit, 0))
+ for (++ptr; ISSPACE (*ptr); check_source (++ptr < clean_text_limit, 0))
continue;
return ptr;
}
next_end = start_formals - 1;
check_source (next_end > clean_read_ptr, 0);
- while (isspace (*next_end))
+ while (ISSPACE (*next_end))
check_source (--next_end > clean_read_ptr, 0);
check_source (*next_end == ')', next_end);
check_source (--next_end > clean_read_ptr, 0);
const char *func_name_limit;
size_t func_name_len;
- for (func_name_limit = start_formals-1; isspace (*func_name_limit); )
+ for (func_name_limit = start_formals-1; ISSPACE (*func_name_limit); )
check_source (--func_name_limit > clean_read_ptr, 0);
for (func_name_start = func_name_limit++;
while (*end_formals != ')')
{
- if (isspace (*end_formals))
- while (isspace (*end_formals))
+ if (ISSPACE (*end_formals))
+ while (ISSPACE (*end_formals))
check_source (--end_formals > clean_read_ptr, 0);
else
check_source (--end_formals > clean_read_ptr, 0);
while (*end_formals != ')')
{
- if (isspace (*end_formals))
- while (isspace (*end_formals))
+ if (ISSPACE (*end_formals))
+ while (ISSPACE (*end_formals))
check_source (--end_formals > clean_read_ptr, 0);
else
check_source (--end_formals > clean_read_ptr, 0);
by an alphabetic character, while others *cannot* validly be followed
by such characters. */
- if ((ch == '{') || isalpha (ch))
+ if ((ch == '{') || ISALPHA (ch))
break;
/* At this point, we have found a right paren, but we know that it is
We can now just scan backwards and find the left end of the existing
indentation string, and then copy it to the output buffer. */
- for (sp = ep; isspace (*sp) && *sp != '\n'; sp--)
+ for (sp = ep; ISSPACE (*sp) && *sp != '\n'; sp--)
continue;
/* Now write out the open { which began this block, and any following
header. We will put in the added declarations just prior to that. */
scan_p++;
- while (isspace (*scan_p))
+ while (ISSPACE (*scan_p))
scan_p++;
scan_p--;
{
have_newlines |= (*scan_orig == '\n');
/* Leave identical whitespace alone. */
- if (!isspace (*scan_orig))
+ if (!ISSPACE (*scan_orig))
*((NONCONST char *)scan_orig) = ' '; /* identical - so whiteout */
}
else
scan_p += 2;
while (scan_p[1] != '/' || scan_p[0] != '*')
{
- if (!isspace (*scan_p))
+ if (!ISSPACE (*scan_p))
*scan_p = ' ';
if (++scan_p >= new_clean_text_limit)
abort ();
*scan_p = ' ';
while (scan_p[1] != '\n' || scan_p[0] == '\\')
{
- if (!isspace (*scan_p))
+ if (!ISSPACE (*scan_p))
*scan_p = ' ';
if (++scan_p >= new_clean_text_limit)
abort ();
non_whitespace_since_newline = 1;
while (scan_p[1] != '\'' || scan_p[0] == '\\')
{
- if (scan_p[0] == '\\' && !isspace (scan_p[1]))
+ if (scan_p[0] == '\\' && !ISSPACE (scan_p[1]))
scan_p[1] = ' ';
- if (!isspace (*scan_p))
+ if (!ISSPACE (*scan_p))
*scan_p = ' ';
if (++scan_p >= new_clean_text_limit)
abort ();
non_whitespace_since_newline = 1;
while (scan_p[1] != '"' || scan_p[0] == '\\')
{
- if (scan_p[0] == '\\' && !isspace (scan_p[1]))
+ if (scan_p[0] == '\\' && !ISSPACE (scan_p[1]))
scan_p[1] = ' ';
- if (!isspace (*scan_p))
+ if (!ISSPACE (*scan_p))
*scan_p = ' ';
if (++scan_p >= new_clean_text_limit)
abort ();
}
- if (!isspace (*scan_p))
+ if (!ISSPACE (*scan_p))
*scan_p = ' ';
scan_p++;
break;
last_r_paren = scan_p;
- for (ahead_p = scan_p + 1; isspace (*ahead_p); )
+ for (ahead_p = scan_p + 1; ISSPACE (*ahead_p); )
check_source (++ahead_p < limit, limit);
scan_p = ahead_p - 1;
- if (isalpha (*ahead_p) || *ahead_p == '{')
+ if (ISALPHA (*ahead_p) || *ahead_p == '{')
{
const char *last_l_paren;
const int lineno = identify_lineno (ahead_p);
do
{
last_l_paren = careful_find_l_paren (last_r_paren);
- for (last_r_paren = last_l_paren-1; isspace (*last_r_paren); )
+ for (last_r_paren = last_l_paren-1; ISSPACE (*last_r_paren); )
check_source (--last_r_paren >= backup_limit, backup_limit);
}
while (*last_r_paren == ')');
{
const char *cp;
- for (cp = varargs_style_indicator; isalnum (*cp) || *cp == '_'; cp++)
+ for (cp = varargs_style_indicator; ISALNUM (*cp) || *cp == '_'; cp++)
continue;
if (*cp != 0)
varargs_style_indicator = savestring (varargs_style_indicator,