rmtodd@uokmax.UUCP (Richard Michael Todd) (06/05/87)
1. The malloc.c file for the library has functions for malloc, realloc, and free. Strangely enough, calloc is missing. Here's a version of calloc to add to the end of the malloc.c file. ------------------------- cut here ------------------------- /* original lib. didn't include calloc--here it is */ char * calloc(m,size) unsigned m,size; { char *cp; register int i; register char *temp; i = m*size; if ((cp=malloc(i))==(char *)0) return (char *)0; /* malloc succeeded--clear allocated memory */ for (temp = cp ; i-- ; ) *temp++ = '\0'; return cp; } ------------------------- cut here ------------------------- 2. Here's a version of the printenv program to print out all the environment variables currently existing. It isn't anything terribly difficult in terms of programming, but you may find it useful. ------------------------- printenv.c cut here ------------------------- /* ** printenv -- program to print out all environment variables ** Written 5-18-87 by Richard Todd */ main () { extern char **environ; char **sptr; for (sptr = environ ; *sptr ; ++sptr) { printf("%s\n",*sptr); } } ------------------------- printenv.c cut here ------------------------- Richard Todd USSnail:820 Annie Court,Norman OK 73069 UUCP: {allegra!cbosgd|ihnp4}!okstate!uokmax!rmtodd