/*
* get the attributes of the file associated with
* the name; do not follow any symbolic links
*/
if (lstat(file, &buf) < 0)
goto error;
if ((buf.st_mode&S_IFLNK) == S_IFLNK){
fprintf(stderr, "%s is a symbolic link\n", file);
goto error;
}
/*
* open the file, write to it, and close it
*/
if ((fp = fopen(file, "a")) == NULL)
goto error;
while(fgets(buf, BUFSIZ, stdin) != NULL)
fputs(buf, fp);
(void) fclose(fp);
Send email to
cs153@csif.cs.ucdavis.edu.
Department of Computer Science
University of California at Davis
Davis, CA 95616-8562