* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Hugh Smith at The University of Guelph.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)misc.c 5.4 (Berkeley) %G%";
extern char *archive
; /* archive name */
char *tname
= "temporary file"; /* temporary file "name" */
char *envtmp
, path
[MAXPATHLEN
];
if ((envtmp
= getenv("TMPDIR")) != NULL
)
(void)sprintf(path
, "%s%s", envtmp
, strrchr(_PATH_RANTMP
, '/'));
bcopy(_PATH_RANTMP
, path
, sizeof(_PATH_RANTMP
));
(void)sigprocmask(SIG_BLOCK
, &set
, &oset
);
if ((fd
= mkstemp(path
)) == -1)
(void)sigprocmask(SIG_SETMASK
, &oset
, NULL
);
if ((p
= malloc((u_int
)len
)) == NULL
)
return((ind
= rindex(path
, '/')) ? ind
+ 1 : path
);
(void)fprintf(stderr
, "ranlib: %s: %s\n", name
, strerror(errno
));