blob: 013e4919a8a00ed530ac41f554b5fb5dbda0b81f [file] [log] [blame]
landley4f344e32006-10-05 16:18:03 -04001/* vi: set ts=4 :*/
landley09ea7ac2006-10-30 01:38:00 -05002/* lib.h - header file for lib directory
3 *
4 * Copyright 2006 Rob Landley <rob@landley.net>
5 */
landley4f344e32006-10-05 16:18:03 -04006
Rob Landley0a04b3e2006-11-03 00:05:52 -05007// llist.c
8void llist_free(void *list, void (*freeit)(void *data));
9void *llist_pop(void *list); // actually void **list, but the compiler's dumb
10
11struct string_list {
12 struct string_list *next;
13 char str[0];
14};
15
Rob Landley8324b892006-11-19 02:49:22 -050016struct arg_list {
17 struct arg_list *next;
18 char *arg;
19};
20
21// args.c
22void get_optflags(void);
23
landleycd9dfc32006-10-18 18:38:16 -040024// functions.c
landley09ea7ac2006-10-30 01:38:00 -050025void verror_msg(char *msg, int err, va_list va);
26void error_msg(char *msg, ...);
27void perror_msg(char *msg, ...);
landley4f344e32006-10-05 16:18:03 -040028void error_exit(char *msg, ...);
landley09ea7ac2006-10-30 01:38:00 -050029void perror_exit(char *msg, ...);
landley4f344e32006-10-05 16:18:03 -040030void strlcpy(char *dest, char *src, size_t size);
31void *xmalloc(size_t size);
landleycd9dfc32006-10-18 18:38:16 -040032void *xzalloc(size_t size);
33void xrealloc(void **ptr, size_t size);
landley4f344e32006-10-05 16:18:03 -040034void *xstrndup(char *s, size_t n);
Rob Landleyfa98d012006-11-02 02:57:27 -050035void *xstrdup(char *s);
landley00f87f12006-10-25 18:38:37 -040036char *xmsprintf(char *format, ...);
landley09ea7ac2006-10-30 01:38:00 -050037void xexec(char **argv);
landley4f344e32006-10-05 16:18:03 -040038int xopen(char *path, int flags, int mode);
39FILE *xfopen(char *path, char *mode);
landley64b2e232006-10-30 10:01:19 -050040ssize_t reread(int fd, void *buf, size_t count);
41ssize_t readall(int fd, void *buf, size_t count);
42void xread(int fd, char *buf, size_t count);
landley00f87f12006-10-25 18:38:37 -040043char *xgetcwd(void);
Rob Landleyfa98d012006-11-02 02:57:27 -050044char *xabspath(char *path);
Rob Landley0a04b3e2006-11-03 00:05:52 -050045struct string_list *find_in_path(char *path, char *filename);
landley09ea7ac2006-10-30 01:38:00 -050046void utoa_to_buf(unsigned n, char *buf, unsigned buflen);
47void itoa_to_buf(int n, char *buf, unsigned buflen);
48char *utoa(unsigned n);
49char *itoa(int n);
landley4f344e32006-10-05 16:18:03 -040050
landleycd9dfc32006-10-18 18:38:16 -040051// getmountlist.c
landley4f344e32006-10-05 16:18:03 -040052struct mtab_list {
53 struct mtab_list *next;
landley09ea7ac2006-10-30 01:38:00 -050054 struct stat stat;
55 struct statvfs statvfs;
landley4f344e32006-10-05 16:18:03 -040056 char *dir;
57 char *device;
58 char type[0];
59};
60
61struct mtab_list *getmountlist(int die);
62