Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
tmpnam.c File Reference
#include <stdio.h>

Go to the source code of this file.


#define L_tmpnam   100
#define P_tmpdir   "/usr/tmp"


int getpid (void)
char * tmpnam (char *s)


static char tmpnam_buffer [L_tmpnam]
static int tmpnam_counter

Define Documentation

#define L_tmpnam   100

Definition at line 18 of file tmpnam.c.

#define P_tmpdir   "/usr/tmp"

Definition at line 21 of file tmpnam.c.

Function Documentation

int getpid ( void  )

Here is the caller graph for this function:

char* tmpnam ( char *  s)

Definition at line 30 of file tmpnam.c.

  int pid = getpid ();

  if (s == NULL)
    s = tmpnam_buffer;

  /*  Generate the filename and make sure that there isn't one called
      it already.  */

  while (1)
      FILE *f;
      sprintf (s, "%s/%s%x.%x", P_tmpdir, "t", pid, tmpnam_counter);
      f = fopen (s, "r");
      if (f == NULL)
      fclose (f);

  return s;

Here is the call graph for this function:

Variable Documentation

char tmpnam_buffer[L_tmpnam] [static]

Definition at line 24 of file tmpnam.c.

int tmpnam_counter [static]

Definition at line 25 of file tmpnam.c.