view lib/lib.h @ 16:dd10785b6532

Add xabspath(), is_file_type(), which_in_path(), and find_in_path().
author Rob Landley <rob@landley.net>
date Thu, 02 Nov 2006 02:57:27 -0500
parents 04f66da2bdbf
children 3981c96f9285
line wrap: on
line source

/* vi: set ts=4 :*/
/* lib.h - header file for lib directory
 *
 * Copyright 2006 Rob Landley <rob@landley.net>
 */

// functions.c
void verror_msg(char *msg, int err, va_list va);
void error_msg(char *msg, ...);
void perror_msg(char *msg, ...);
void error_exit(char *msg, ...);
void perror_exit(char *msg, ...);
void strlcpy(char *dest, char *src, size_t size);
void *xmalloc(size_t size);
void *xzalloc(size_t size);
void xrealloc(void **ptr, size_t size);
void *xstrndup(char *s, size_t n);
void *xstrdup(char *s);
char *xmsprintf(char *format, ...);
void xexec(char **argv);
int xopen(char *path, int flags, int mode);
FILE *xfopen(char *path, char *mode);
ssize_t reread(int fd, void *buf, size_t count);
ssize_t readall(int fd, void *buf, size_t count);
void xread(int fd, char *buf, size_t count);
char *xgetcwd(void);
char *xabspath(char *path);
int is_file_type(char *path, int type);
char *which_in_path(char *filename);
char *find_in_path(char *path, char *filename, int type);
void utoa_to_buf(unsigned n, char *buf, unsigned buflen);
void itoa_to_buf(int n, char *buf, unsigned buflen);
char *utoa(unsigned n);
char *itoa(int n);

// llist.c
void llist_free(void *list, void (*freeit)(void *data));

struct string_list {
	struct string_list *next;
	char *str;
};

// getmountlist.c
struct mtab_list {
	struct mtab_list *next;
	struct stat stat;
	struct statvfs statvfs;
	char *dir;
	char *device;
	char type[0];
};

struct mtab_list *getmountlist(int die);