Cover V01, I01
Article
Listing 1
Listing 10
Listing 11
Listing 12
Listing 13
Listing 14
Listing 15
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6
Listing 7
Listing 8
Listing 9

may92.tar


Listing 10

/*
*  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       */
}