Files
jehanne/sys/src/lib/stdio/tmpnam.c
Giacomo Tesio f52a185030 decouple Jehanne from 9P2000 (as much as needed)
Jehanne is going to use a new file protocol, but Plan 9 is really
coupled with 9P2000.

Renamed fcall.h as 9P2000.h and introduced specific constants such
as NP_OREAD, NP_OWRITE and so on, so that we can use different values
in the kernel and new protocol.

Renamed devmnt to devninep, since it's actually a device serving 9P2000
file systems.

Also, fixed 9P2000 support in Jehanne, that was broken with the introduction
of OSTAT.
2016-12-06 23:01:45 +01:00

30 lines
711 B
C

/*
* This file is part of the UCB release of Plan 9. It is subject to the license
* terms in the LICENSE file found in the top-level directory of this
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
* part of the UCB release of Plan 9, including this file, may be copied,
* modified, propagated, or distributed except according to the terms contained
* in the LICENSE file.
*/
/*
* pANS stdio -- tmpnam
*/
#include "iolib.h"
char *tmpnam(char *s){
static char name[]="/tmp/tn000000000000";
char *p;
do{
p=name+7;
while(*p=='9') *p++='0';
if(*p=='\0') return NULL;
++*p;
}while(access(name, AEXIST)==0);
if(s){
strcpy(s, name);
return s;
}
return name;
}