# Compiler & tools to use
CC = @CC@
-NROFF = nroff -Tascii
# Our install program supports extra flags...
INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
};
static int
-aix_getlimit(user, lim, valp)
- char *user;
- char *lim;
- rlim64_t *valp;
+aix_getlimit(char *user, char *lim, rlim64_t *valp)
{
int val;
}
void
-aix_setlimits(user)
- char *user;
+aix_setlimits(char *user)
{
struct rlimit64 rlim;
rlim64_t val;
# include <inttypes.h>
#endif
-#include "sudo.h"
+#include "compat.h"
+#include "alloc.h"
+#include "error.h"
/*
* If there is no SIZE_MAX or SIZE_T_MAX we have to assume that size_t
* malloc(3) fails.
*/
void *
-emalloc(size)
- size_t size;
+emalloc(size_t size)
{
void *ptr;
* if overflow would occur or if the system malloc(3) fails.
*/
void *
-emalloc2(nmemb, size)
- size_t nmemb;
- size_t size;
+emalloc2(size_t nmemb, size_t size)
{
void *ptr;
* if the system realloc(3) does not support this.
*/
void *
-erealloc(ptr, size)
- void *ptr;
- size_t size;
+erealloc(void *ptr, size_t size)
{
if (size == 0)
* does not support this.
*/
void *
-erealloc3(ptr, nmemb, size)
- void *ptr;
- size_t nmemb;
- size_t size;
+erealloc3(void *ptr, size_t nmemb, size_t size)
{
if (nmemb == 0 || size == 0)
* malloc(3) fails. NOTE: unlike strdup(3), estrdup(NULL) is legal.
*/
char *
-estrdup(src)
- const char *src;
+estrdup(const char *src)
{
char *dst = NULL;
size_t len;
* malloc(3) fails. NOTE: unlike strdup(3), estrdup(NULL) is legal.
*/
char *
-estrndup(src, maxlen)
- const char *src;
- size_t maxlen;
+estrndup(const char *src, size_t maxlen)
{
char *dst = NULL;
size_t len;
* returns -1 (out of memory).
*/
int
-evasprintf(ret, format, args)
- char **ret;
- const char *format;
- va_list args;
+evasprintf(char **ret, const char *format, va_list args)
{
int len;
* Wrapper for free(3) so we can depend on C89 semantics.
*/
void
-efree(ptr)
- void *ptr;
+efree(void *ptr)
{
if (ptr != NULL)
free(ptr);
# endif
#endif /* HAVE_STRING_H */
-#include "sudo.h"
+#include "compat.h"
+#include "missing.h"
int
atobool(const char *str)
{
if (strcasecmp(str, "true") == 0 || strcmp(str, "1") == 0)
- return TRUE;
+ return 1;
if (strcasecmp(str, "false") == 0 || strcmp(str, "0") == 0)
- return FALSE;
+ return 0;
return -1;
}
}
static void
-_warning(use_errno, fmt, ap)
- int use_errno;
- const char *fmt;
- va_list ap;
+_warning(int use_errno, const char *fmt, va_list ap)
{
int serrno = errno;
# include <emul/timespec.h>
#endif
-#include "sudo.h"
+#include "sudo.h" /* XXX - for SUDO_LOCK and friends */
#ifndef LINE_MAX
# define LINE_MAX 2048
* Update the access and modify times on an fd or file.
*/
int
-touch(fd, path, tsp)
- int fd;
- char *path;
- struct timespec *tsp;
+touch(int fd, char *path, struct timespec *tsp)
{
struct timeval times[2];
*/
#ifdef HAVE_LOCKF
int
-lock_file(fd, lockit)
- int fd;
- int lockit;
+lock_file(int fd, int lockit)
{
int op = 0;
}
#elif HAVE_FLOCK
int
-lock_file(fd, lockit)
- int fd;
- int lockit;
+lock_file(int fd, int lockit)
{
int op = 0;
}
#else
int
-lock_file(fd, lockit)
- int fd;
- int lockit;
+lock_file(int fd, int lockit)
{
#ifdef F_SETLK
int func;
* and trailing spaces. Returns static storage that is reused.
*/
char *
-sudo_parseln(fp)
- FILE *fp;
+sudo_parseln(FILE *fp)
{
size_t len;
char *cp = NULL;
# endif
#endif
-#include "sudo.h"
+#include "compat.h"
+#include "alloc.h"
+#include "error.h"
#include "missing.h"
#include "lbuf.h"
#endif
int
-get_ttycols()
+get_ttycols(void)
{
char *p;
int cols;
*/
void
-lbuf_init(lbuf, buf, indent, continuation)
- struct lbuf *lbuf;
- char *buf;
- int indent;
- int continuation;
+lbuf_init(struct lbuf *lbuf, char *buf, int indent, int continuation)
{
lbuf->continuation = continuation;
lbuf->indent = indent;
}
void
-lbuf_destroy(lbuf)
- struct lbuf *lbuf;
+lbuf_destroy(struct lbuf *lbuf)
{
efree(lbuf->buf);
lbuf->buf = NULL;
* The lbuf is reset on return.
*/
void
-lbuf_print(lbuf)
- struct lbuf *lbuf;
+lbuf_print(struct lbuf *lbuf)
{
char *cp;
int i, have, contlen;
# endif
#endif /* STDC_HEADERS */
-#include "sudo.h"
+#include "compat.h"
+#include "list.h"
+#ifdef DEBUG
+# include "error.h"
+#endif
struct list_proto {
struct list_proto *prev;
* Returns the popped element.
*/
void *
-tq_pop(vh)
- void *vh;
+tq_pop(void *vh)
{
struct list_head_proto *h = (struct list_head_proto *)vh;
void *last = NULL;
* with a head node.
*/
void
-list2tq(vh, vl)
- void *vh;
- void *vl;
+list2tq(void *vh, void *vl)
{
struct list_head_proto *h = (struct list_head_proto *)vh;
struct list_proto *l = (struct list_proto *)vl;
* circular properties of the prev pointer to simplify the logic.
*/
void
-list_append(vl1, vl2)
- void *vl1;
- void *vl2;
+list_append(void *vl1, void *vl2)
{
struct list_proto *l1 = (struct list_proto *)vl1;
struct list_proto *l2 = (struct list_proto *)vl2;
* e from a semi-circle queue to normal doubly-linked list.
*/
void
-tq_append(vh, vl)
- void *vh;
- void *vl;
+tq_append(void *vh, void *vl)
{
struct list_head_proto *h = (struct list_head_proto *)vh;
struct list_proto *l = (struct list_proto *)vl;
* Remove element from the tail_queue
*/
void
-tq_remove(vh, vl)
- void *vh;
- void *vl;
+tq_remove(void *vh, void *vl)
{
struct list_head_proto *h = (struct list_head_proto *)vh;
struct list_proto *l = (struct list_proto *)vl;
#elif defined(HAVE_GRANTPT)
# ifndef HAVE_POSIX_OPENPT
static int
-posix_openpt(oflag)
- int oflag;
+posix_openpt(int oflag)
{
int fd;
#include "compat.h"
int
-main (int argc, char **argv)
+main (int argc, char *argv[])
{
char *cp, *cmnd;
* Cleanup hook for error()/errorx()
*/
void
-cleanup(gotsignal)
- int gotsignal;
+cleanup(int gotsignal)
{
#if 0 /* XXX */
struct sudo_nss *nss;
* Wrapper to allow users to edit privileged files with their own uid.
*/
int
-sudo_edit(argc, argv, envp)
- int argc;
- char **argv;
- char **envp;
+sudo_edit(int argc, char **argv, char **envp)
{
ssize_t nread, nwritten;
pid_t kidpid, pid;
* the uid of the invoking user, not the runas (privileged) user.
*/
static char *
-find_editor()
+find_editor(void)
{
char *cp, *editor = NULL, **ev, *ev0[4];
int term_kill;
int
-term_restore(fd, flush)
- int fd;
- int flush;
+term_restore(int fd, int flush)
{
if (changed) {
int flags = TCSASOFT;
}
int
-term_noecho(fd)
- int fd;
+term_noecho(int fd)
{
if (!changed && tcgetattr(fd, &oterm) != 0)
return(0);
#if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H)
int
-term_raw(fd, opost, isig)
- int fd;
- int opost;
- int isig;
+term_raw(int fd, int opost, int isig)
{
struct termios term;
}
int
-term_cbreak(fd)
- int fd;
+term_cbreak(int fd)
{
if (!changed && tcgetattr(fd, &oterm) != 0)
return(0);
}
int
-term_copy(src, dst, opost)
- int src;
- int dst;
- int opost;
+term_copy(int src, int dst, int opost)
{
struct termios tt;
#else /* SGTTY */
int
-term_raw(fd, onlcr)
- int fd;
- int onlcr;
+term_raw(int fd, int onlcr)
{
if (!changed && ioctl(fd, TIOCGETP, &oterm) != 0)
return(0);
}
int
-term_cbreak(fd)
- int fd;
+term_cbreak(int fd)
{
if (!changed && ioctl(fd, TIOCGETP, &oterm) != 0)
return(0);
}
int
-term_copy(src, dst, onlcr)
- int src;
- int dst;
- int onlcr;
+term_copy(int src, int dst, int onlcr)
{
struct sgttyb b;
struct tchars tc;
* the compiler will not be able to optimize away this function.
*/
void
-zero_bytes(v, n)
- volatile void *v;
- size_t n;
+zero_bytes(volatile void *v, size_t n)
{
volatile char *p, *ep;