SDDSlib
|
Provides functions to generate unique temporary filenames. More...
#include "mdb.h"
#include <time.h>
#include <unistd.h>
#include <errno.h>
Go to the source code of this file.
Macros | |
#define | struct_stat64 struct stat |
#define | __getpid getpid |
#define | __lxstat64(version, path, buf) |
#define | __set_errno(Val) |
#define | ATTEMPTS_MIN (62 * 62 * 62) |
Functions | |
char * | tmpname (char *s) |
Supplies a unique temporary filename. | |
char * | mktempOAG (char *template) |
Generates a unique temporary filename based on a template. | |
Provides functions to generate unique temporary filenames.
Definition in file tmpname.c.
#define __lxstat64 | ( | version, | |
path, | |||
buf ) |
char * mktempOAG | ( | char * | template | ) |
Generates a unique temporary filename based on a template.
Replaces the last six characters ('XXXXXX') of the template with random characters from a predefined set to create a unique temporary filename. It ensures that the generated filename does not already exist by checking the filesystem.
template | A string containing the template for the temporary filename. The last six characters should be 'XXXXXX'. |
Definition at line 85 of file tmpname.c.
char * tmpname | ( | char * | s | ) |
Supplies a unique temporary filename.
Generates a unique temporary filename by appending the process ID and an incrementing counter to a base name. Ensures that the filename does not already exist.
s | Pointer to a buffer where the temporary filename will be stored. If NULL, the function allocates memory for the filename. |
Definition at line 34 of file tmpname.c.