Cover V01, I04
Article
Listing 1
Listing 2

nov92.tar


Listing 2: tmpname.c

/*
*  tmpname.c - Generate a temporary filename (in the TMP directory).
*  usage:
*      tmpname [<<prefix>>]
*  where <<prefix>> specifies the first few chars of the new name.
*  Sends the output to stdout.
*
* Compile
*     cc tmpname.c -o tmpname
*/

#include <<stdio.h>>
#define TMP "/tmp"

main(argc, argv)
int argc;
char **argv;
{
int i, j;
char prefix[20];

prefix[0] = '\0';
if (argc == 2)                  /* user user-supplied prefix,  */
strcpy(prefix,argv[1]);     /* if any */

puts(tempnam(TMP, prefix));     /* write output to stdout       */
}

/* End of File */