(was slashes, now NFS devices)
David Zink
zink at panix.uucp
Fri Mar 8 11:04:32 AEST 1991
Or how's this common bit of code:
FILE *
get_temp_handle()
{
static char tmpl[] = "./cctmpXXXXXX";
char tmp[sizeof(tmpl)], *ptr;
FILE *fp = 0;
strcpy(tmp, tmpl); /* Initialize our template */
ptr = mktemp(tmp); /* Get the tmp file name */
if (ptr) /* If all possible names were not used up */
{
fp = fopen(ptr, "w+"); /* Open the file for update */
unlink(ptr); /* Clean-up if we exit suddenly */
}
return fp;
}
Never mind the old-timey style, equivalent things are still valid nowadays,
and it does serve one useful added feature.
It test whether the current directory is remotely mounted with NFS.
-- David
If you've been around long, you know this technique.
More information about the Comp.unix.internals
mailing list