groff 1.23.0 added .MR to its -man macro package. The NEWS file states
that the inclusion of the macro "was prompted by its introduction to
Plan 9 from User Space's troff in August 2020." From d32deab it seems
that the name for Plan 9 from User Space's implementation was suggested
by groff maintainer G. Brandon Robinson.
Not sure if the intention was to make these definitions compatible, but
it would be nice if they were.
Currently, Plan 9 from User Space's .MR expects its second argument to
be parenthesized. groff's .MR does not. This results in extra
parentheses appearing in manual references when viewing Plan 9 from User
Space's manual pages on a system using groff.
53 lines
932 B
Groff
53 lines
932 B
Groff
.TH OPENTEMP 3
|
|
.SH NAME
|
|
opentemp \- create and open a uniquely-named file
|
|
.SH SYNOPSIS
|
|
.B #include <u.h>
|
|
.br
|
|
.B #include <libc.h>
|
|
.PP
|
|
.B
|
|
int opentemp(char *template, int mode)
|
|
.SH DESCRIPTION
|
|
.I Opentemp
|
|
replaces
|
|
.I template
|
|
by a unique file name, and returns the
|
|
address of the template.
|
|
The template should look like a file name with eleven trailing
|
|
.LR X s.
|
|
The
|
|
.LR X s
|
|
are replaced by a letter followed by the current process id.
|
|
Letters from
|
|
.L a
|
|
to
|
|
.L z
|
|
are tried until the name of a file that does not yet exist
|
|
(see
|
|
.MR access 2 )
|
|
is generated.
|
|
.I Opentemp
|
|
then opens the file for the given
|
|
.I mode
|
|
and returns the file descriptor.
|
|
Most calls should use a mode
|
|
of
|
|
.BR ORDWR|ORCLOSE .
|
|
.PP
|
|
If no such name can be generated,
|
|
.I opentemp
|
|
returns \-1.
|
|
.PP
|
|
.I Opentemp
|
|
avoids races.
|
|
Two simultaneous calls to
|
|
.I opentemp
|
|
will never return the same name.
|
|
.SH SOURCE
|
|
.B \*9/src/lib9/opentemp.c
|
|
.SH "SEE ALSO
|
|
.I create
|
|
in
|
|
.MR open 3
|