Convert to ANSI C
This commit is contained in:
@@ -17,8 +17,8 @@
|
|||||||
#ifndef _SUDO_ALLOC_H
|
#ifndef _SUDO_ALLOC_H
|
||||||
#define _SUDO_ALLOC_H
|
#define _SUDO_ALLOC_H
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
int easprintf(char **, const char *, ...) __printflike(2, 3);
|
int easprintf(char **, const char *, ...) __printflike(2, 3);
|
||||||
int evasprintf(char **, const char *, va_list) __printflike(2, 0);
|
int evasprintf(char **, const char *, va_list) __printflike(2, 0);
|
||||||
void efree(void *);
|
void efree(void *);
|
||||||
@@ -27,16 +27,5 @@ void *emalloc2(size_t, size_t);
|
|||||||
void *erealloc(void *, size_t);
|
void *erealloc(void *, size_t);
|
||||||
void *erealloc3(void *, size_t, size_t);
|
void *erealloc3(void *, size_t, size_t);
|
||||||
char *estrdup(const char *);
|
char *estrdup(const char *);
|
||||||
#else
|
|
||||||
# include <varargs.h>
|
|
||||||
int easprintf();
|
|
||||||
int evasprintf();
|
|
||||||
void efree();
|
|
||||||
void *emalloc();
|
|
||||||
void *emalloc2();
|
|
||||||
void *erealloc();
|
|
||||||
void *erealloc3();
|
|
||||||
char *estrdup();
|
|
||||||
#endif /* __STDC__ */
|
|
||||||
|
|
||||||
#endif /* _SUDO_ALLOC_H */
|
#endif /* _SUDO_ALLOC_H */
|
||||||
|
@@ -26,15 +26,6 @@
|
|||||||
* Macros that may be missing on some Operating Systems
|
* Macros that may be missing on some Operating Systems
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Deal with ANSI stuff reasonably. */
|
|
||||||
#ifndef __P
|
|
||||||
# if defined (__cplusplus) || defined (__STDC__)
|
|
||||||
# define __P(args) args
|
|
||||||
# else
|
|
||||||
# define __P(args) ()
|
|
||||||
# endif
|
|
||||||
#endif /* __P */
|
|
||||||
|
|
||||||
/* Define away __attribute__ for non-gcc or old gcc */
|
/* Define away __attribute__ for non-gcc or old gcc */
|
||||||
#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
|
#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
|
||||||
# define __attribute__(x)
|
# define __attribute__(x)
|
||||||
@@ -154,7 +145,7 @@
|
|||||||
* Simple isblank() macro and function for systems without it.
|
* Simple isblank() macro and function for systems without it.
|
||||||
*/
|
*/
|
||||||
#ifndef HAVE_ISBLANK
|
#ifndef HAVE_ISBLANK
|
||||||
int isblank __P((int));
|
int isblank(int);
|
||||||
# define isblank(_x) ((_x) == ' ' || (_x) == '\t')
|
# define isblank(_x) ((_x) == ' ' || (_x) == '\t')
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -202,13 +193,13 @@ int isblank __P((int));
|
|||||||
# define sa_flags sv_flags
|
# define sa_flags sv_flags
|
||||||
typedef struct sigvec sigaction_t;
|
typedef struct sigvec sigaction_t;
|
||||||
typedef int sigset_t;
|
typedef int sigset_t;
|
||||||
int sigaction __P((int sig, const sigaction_t *act, sigaction_t *oact));
|
int sigaction(int sig, const sigaction_t *act, sigaction_t *oact);
|
||||||
int sigemptyset __P((sigset_t *));
|
int sigemptyset(sigset_t *);
|
||||||
int sigfillset __P((sigset_t *));
|
int sigfillset(sigset_t *);
|
||||||
int sigaddset __P((sigset_t *, int));
|
int sigaddset(sigset_t *, int);
|
||||||
int sigdelset __P((sigset_t *, int));
|
int sigdelset(sigset_t *, int);
|
||||||
int sigismember __P((sigset_t *, int));
|
int sigismember(sigset_t *, int);
|
||||||
int sigprocmask __P((int, const sigset_t *, sigset_t *));
|
int sigprocmask(int, const sigset_t *, sigset_t *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -256,7 +247,7 @@ typedef struct sigaction sigaction_t;
|
|||||||
extern const char *__progname;
|
extern const char *__progname;
|
||||||
# define getprogname() (__progname)
|
# define getprogname() (__progname)
|
||||||
# else
|
# else
|
||||||
const char *getprogname __P((void));
|
const char *getprogname(void);
|
||||||
#endif /* HAVE___PROGNAME */
|
#endif /* HAVE___PROGNAME */
|
||||||
#endif /* !HAVE_GETPROGNAME */
|
#endif /* !HAVE_GETPROGNAME */
|
||||||
|
|
||||||
|
@@ -17,18 +17,11 @@
|
|||||||
#ifndef _SUDO_ERROR_H_
|
#ifndef _SUDO_ERROR_H_
|
||||||
#define _SUDO_ERROR_H_
|
#define _SUDO_ERROR_H_
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
void error(int, const char *, ...) __attribute__((__noreturn__));
|
void error(int, const char *, ...) __attribute__((__noreturn__));
|
||||||
void errorx(int, const char *, ...) __attribute__((__noreturn__));
|
void errorx(int, const char *, ...) __attribute__((__noreturn__));
|
||||||
void warning(const char *, ...);
|
void warning(const char *, ...);
|
||||||
void warningx(const char *, ...);
|
void warningx(const char *, ...);
|
||||||
#else
|
|
||||||
# include <varargs.h>
|
|
||||||
void error() __attribute__((__noreturn__));
|
|
||||||
void errorx() __attribute__((__noreturn__));
|
|
||||||
void warning();
|
|
||||||
void warningx();
|
|
||||||
#endif /* __STDC__ */
|
|
||||||
|
|
||||||
#endif /* _SUDO_ERROR_H_ */
|
#endif /* _SUDO_ERROR_H_ */
|
||||||
|
@@ -30,10 +30,10 @@ struct lbuf {
|
|||||||
int size;
|
int size;
|
||||||
};
|
};
|
||||||
|
|
||||||
void lbuf_init __P((struct lbuf *, char *, int, int));
|
void lbuf_init (struct lbuf *, char *, int, int);
|
||||||
void lbuf_destroy __P((struct lbuf *));
|
void lbuf_destroy (struct lbuf *);
|
||||||
void lbuf_append __P((struct lbuf *, ...));
|
void lbuf_append (struct lbuf *, ...);
|
||||||
void lbuf_append_quoted __P((struct lbuf *, const char *, ...));
|
void lbuf_append_quoted (struct lbuf *, const char *, ...);
|
||||||
void lbuf_print __P((struct lbuf *));
|
void lbuf_print (struct lbuf *);
|
||||||
|
|
||||||
#endif /* _SUDO_LBUF_H */
|
#endif /* _SUDO_LBUF_H */
|
||||||
|
@@ -20,19 +20,11 @@
|
|||||||
/*
|
/*
|
||||||
* Convenience macro for declaring a list head.
|
* Convenience macro for declaring a list head.
|
||||||
*/
|
*/
|
||||||
#ifdef __STDC__
|
|
||||||
#define TQ_DECLARE(n) \
|
#define TQ_DECLARE(n) \
|
||||||
struct n##_list { \
|
struct n##_list { \
|
||||||
struct n *first; \
|
struct n *first; \
|
||||||
struct n *last; \
|
struct n *last; \
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
#define TQ_DECLARE(n) \
|
|
||||||
struct n/**/_list { \
|
|
||||||
struct n *first; \
|
|
||||||
struct n *last; \
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Foreach loops: forward and reverse
|
* Foreach loops: forward and reverse
|
||||||
@@ -75,9 +67,9 @@ struct n/**/_list { \
|
|||||||
/*
|
/*
|
||||||
* Prototypes for list.c
|
* Prototypes for list.c
|
||||||
*/
|
*/
|
||||||
void *tq_pop __P((void *));
|
void *tq_pop (void *);
|
||||||
void tq_append __P((void *, void *));
|
void tq_append (void *, void *);
|
||||||
void list_append __P((void *, void *));
|
void list_append (void *, void *);
|
||||||
void list2tq __P((void *, void *));
|
void list2tq (void *, void *);
|
||||||
|
|
||||||
#endif /* _SUDO_LIST_H */
|
#endif /* _SUDO_LIST_H */
|
||||||
|
@@ -23,62 +23,58 @@ struct timeval;
|
|||||||
struct timespec;
|
struct timespec;
|
||||||
|
|
||||||
#ifndef HAVE_CLOSEFROM
|
#ifndef HAVE_CLOSEFROM
|
||||||
void closefrom __P((int));
|
void closefrom(int);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_GETCWD
|
#ifndef HAVE_GETCWD
|
||||||
char *getcwd __P((char *, size_t size));
|
char *getcwd(char *, size_t size);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_GETLINE
|
#ifndef HAVE_GETLINE
|
||||||
ssize_t getline __P((char **, size_t *, FILE *));
|
ssize_t getline(char **, size_t *, FILE *);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_UTIMES
|
#ifndef HAVE_UTIMES
|
||||||
int utimes __P((const char *, const struct timeval *));
|
int utimes(const char *, const struct timeval *);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_FUTIME
|
#ifdef HAVE_FUTIME
|
||||||
int futimes __P((int, const struct timeval *));
|
int futimes(int, const struct timeval *);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_SNPRINTF
|
#ifndef HAVE_SNPRINTF
|
||||||
int snprintf __P((char *, size_t, const char *, ...))
|
int snprintf(char *, size_t, const char *, ...) __printflike(3, 4);
|
||||||
__printflike(3, 4);
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_VSNPRINTF
|
#ifndef HAVE_VSNPRINTF
|
||||||
int vsnprintf __P((char *, size_t, const char *, va_list))
|
int vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0);
|
||||||
__printflike(3, 0);
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_ASPRINTF
|
#ifndef HAVE_ASPRINTF
|
||||||
int asprintf __P((char **, const char *, ...))
|
int asprintf(char **, const char *, ...) __printflike(2, 3);
|
||||||
__printflike(2, 3);
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_VASPRINTF
|
#ifndef HAVE_VASPRINTF
|
||||||
int vasprintf __P((char **, const char *, va_list))
|
int vasprintf(char **, const char *, va_list) __printflike(2, 0);
|
||||||
__printflike(2, 0);
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_STRCASECMP
|
#ifndef HAVE_STRCASECMP
|
||||||
int strcasecmp __P((const char *, const char *));
|
int strcasecmp(const char *, const char *);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_STRLCAT
|
#ifndef HAVE_STRLCAT
|
||||||
size_t strlcat __P((char *, const char *, size_t));
|
size_t strlcat(char *, const char *, size_t);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_STRLCPY
|
#ifndef HAVE_STRLCPY
|
||||||
size_t strlcpy __P((char *, const char *, size_t));
|
size_t strlcpy(char *, const char *, size_t);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_MEMRCHR
|
#ifndef HAVE_MEMRCHR
|
||||||
void *memrchr __P((const void *, int, size_t));
|
void *memrchr(const void *, int, size_t);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_MKSTEMP
|
#ifndef HAVE_MKSTEMP
|
||||||
int mkstemp __P((char *));
|
int mkstemp(char *);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_NANOSLEEP
|
#ifndef HAVE_NANOSLEEP
|
||||||
int nanosleep __P((const struct timespec *, struct timespec *));
|
int nanosleep(const struct timespec *, struct timespec *);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_SETENV
|
#ifndef HAVE_SETENV
|
||||||
int setenv __P((const char *, const char *, int));
|
int setenv(const char *, const char *, int);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_UNSETENV
|
#ifndef HAVE_UNSETENV
|
||||||
int unsetenv __P((const char *));
|
int unsetenv(const char *);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_SIGLIST
|
#ifdef HAVE_SYS_SIGLIST
|
||||||
char *strsignal __P((int));
|
char *strsignal(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _SUDO_MISSING_H */
|
#endif /* _SUDO_MISSING_H */
|
||||||
|
Reference in New Issue
Block a user