Cover V02, I02
Article
Listing 1
Listing 2
Table 1

mar93.tar


Table 1: C Utility Function Summary

ListPtr make_filelist(const char *dirname); Constructs a linked list containing names of the entries in the specified directory. Returns a pointer to the first element of the list. Returns NULL if dirname couldn't be opened as a directory.
void free_filelist(ListPtr p); Frees a linked list constructed by make_filelist.
void *emalloc(size_t nbytes); Allocates the specified amount of memory, prints error message and exits program if allocation fails.
char *savestr(char *s); Saves a copy of string pointed to by s, returns pointer to the saved copy.
void die(int syserr, const char *fmt, ...); Exits program with a specified error message; parameters following syserr are the same as printf. If syserr is non-zero, prints a system error message as well.
void warn(int syserr, const char *fmt, ...); Prints the specified error message; parameters following syserr are the same as printf. If syserr is non-zero, prints a system error message as well.
void errmesg(int syserr, const char *fmt,, va_list ap); Prints error message to stderr; called by both die() and warn().