Mercurial > hg > toybox
comparison lib/lib.h @ 7:fc9c0503d5e2
Implement df. Add -Wall to build and fix up warnings. Add copyright notices.
Add error_msg() and itoa() to library. Remove argc from globals (since argv is
null terminated), add optflags to globals.
author | landley@driftwood |
---|---|
date | Mon, 30 Oct 2006 01:38:00 -0500 |
parents | 732b055e17f7 |
children | 04f66da2bdbf |
comparison
equal
deleted
inserted
replaced
6:7806b8026931 | 7:fc9c0503d5e2 |
---|---|
1 /* vi: set ts=4 :*/ | 1 /* vi: set ts=4 :*/ |
2 /* lib.h - header file for lib directory | |
3 * | |
4 * Copyright 2006 Rob Landley <rob@landley.net> | |
5 */ | |
2 | 6 |
3 // functions.c | 7 // functions.c |
8 void verror_msg(char *msg, int err, va_list va); | |
9 void error_msg(char *msg, ...); | |
10 void perror_msg(char *msg, ...); | |
4 void error_exit(char *msg, ...); | 11 void error_exit(char *msg, ...); |
12 void perror_exit(char *msg, ...); | |
5 void strlcpy(char *dest, char *src, size_t size); | 13 void strlcpy(char *dest, char *src, size_t size); |
6 void *xmalloc(size_t size); | 14 void *xmalloc(size_t size); |
7 void *xzalloc(size_t size); | 15 void *xzalloc(size_t size); |
8 void xrealloc(void **ptr, size_t size); | 16 void xrealloc(void **ptr, size_t size); |
9 void *xstrndup(char *s, size_t n); | 17 void *xstrndup(char *s, size_t n); |
10 char *xmsprintf(char *format, ...); | 18 char *xmsprintf(char *format, ...); |
11 void *xexec(char **argv); | 19 void xexec(char **argv); |
12 int xopen(char *path, int flags, int mode); | 20 int xopen(char *path, int flags, int mode); |
13 FILE *xfopen(char *path, char *mode); | 21 FILE *xfopen(char *path, char *mode); |
14 char *xgetcwd(void); | 22 char *xgetcwd(void); |
15 char *find_in_path(char *path, char *filename); | 23 char *find_in_path(char *path, char *filename); |
24 void utoa_to_buf(unsigned n, char *buf, unsigned buflen); | |
25 void itoa_to_buf(int n, char *buf, unsigned buflen); | |
26 char *utoa(unsigned n); | |
27 char *itoa(int n); | |
16 | 28 |
17 // llist.c | 29 // llist.c |
18 void llist_free(void *list, void (*freeit)(void *data)); | 30 void llist_free(void *list, void (*freeit)(void *data)); |
19 | 31 |
32 struct string_list { | |
33 struct string_list *next; | |
34 char *str; | |
35 }; | |
36 | |
20 // getmountlist.c | 37 // getmountlist.c |
21 struct mtab_list { | 38 struct mtab_list { |
22 struct mtab_list *next; | 39 struct mtab_list *next; |
40 struct stat stat; | |
41 struct statvfs statvfs; | |
23 char *dir; | 42 char *dir; |
24 char *device; | 43 char *device; |
25 char type[0]; | 44 char type[0]; |
26 }; | 45 }; |
27 | 46 |