2000-04-27 22:03:57 +02:00
|
|
|
/**********
|
|
|
|
|
Copyright 1990 Regents of the University of California. All rights reserved.
|
|
|
|
|
**********/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* A more portable version of the standard "mktemp( )" function
|
|
|
|
|
*
|
|
|
|
|
* FIXME: remove smktemp() and adjust all callers to use tmpfile(3).
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ngspice.h"
|
|
|
|
|
#include "mktemp.h"
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-02-11 01:47:21 +01:00
|
|
|
|
2000-04-27 22:03:57 +02:00
|
|
|
#ifndef TEMPFORMAT
|
|
|
|
|
#define TEMPFORMAT "temp%s%d"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
char *
|
|
|
|
|
smktemp(char *id)
|
|
|
|
|
{
|
|
|
|
|
char rbuf[513];
|
|
|
|
|
char *nbuf;
|
|
|
|
|
int num;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
num = getpid( );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!id)
|
|
|
|
|
id = "sp";
|
|
|
|
|
|
|
|
|
|
sprintf(rbuf, TEMPFORMAT, id, num);
|
* src/main.c, src/multidec.c, src/proc2mod.c,
src/frontend/display.c, src/frontend/outitf.c,
src/frontend/help/readhelp.c, src/frontend/help/x11disp.c,
src/frontend/parser/complete.c, src/frontend/parser/glob.c,
src/frontend/plotting/graf.c,
src/frontend/plotting/graphdb.c,
src/frontend/plotting/x11.c, src/include/graph.h,
src/include/iferrmsg.h, src/include/ifsim.h,
src/include/macros.h, src/maths/poly/polyfit.c,
src/maths/sparse/spalloc.c, src/maths/sparse/spconfig.h,
src/misc/alloc.c, src/misc/mktemp.c,
src/spicelib/analysis/cktpzstr.c,
src/spicelib/devices/bsim2/b2temp.c,
src/spicelib/devices/bsim3/b3temp.c,
src/spicelib/devices/bsim3v1/b3v1temp.c,
src/spicelib/devices/bsim3v2/b3v2temp.c,
src/spicelib/devices/bsim4/b4temp.c: replaced malloc
realloc and free calls to use tmalloc trealloc and txfree.
* tests/diffpair.out, tests/fourbitadder.out,
tests/resistance/res_partition.out: Updated.
2000-10-14 15:16:53 +02:00
|
|
|
nbuf = (char *) tmalloc(strlen(rbuf) + 1);
|
2000-04-27 22:03:57 +02:00
|
|
|
strcpy(nbuf, rbuf);
|
|
|
|
|
|
|
|
|
|
return nbuf;
|
|
|
|
|
}
|