autoopts_back

mktemp - Make a Temporary File or Directory

Main
AutoGen
Pages

Home
Announce
FAQ
docs
XML Defs
testimonials
downloads

Automated
Options

AutoOpts
Comparison
Man example
Redistribute
Licensing
local use
using getopt

GCC's
Fixincludes

fixincludes

Automated
FSM

description
example
usagefsm

Addons
addon

Project GNU
Home Page

Automated
XDR

xdr project

i

``mktemp'' is a minor variation on the verson from OpenBSD. It is being released because I rely on the suffix behavior and I would like to encourage the BSD version to pick up that attribute. You can find mktemp here.


mktemp Make a Temporary File or Directory

Here is the AutoGen-erated usage text:

mktemp - Make a temporary file name - Ver. 2.0
USAGE:  mktemp [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ <file-pat> ]
  Flg Arg Option-Name    Description
   -p Str prefix         temp directory for the file
   -b Str base           base of file name
   -s Str suffix         file name suffix
   -c no  create         create file (default)
                                - may not be preset
   -u no  unlink         unlink file
                                - an alternate for create
   -d no  temp-dir       temporary directory
                                - an alternate for create

The following options are commonly used and are provided and supported
by AutoOpts:

  Flg Arg Option-Name    Description
   -V no  verbose        run program with progress info
   -q no  quiet          run without unnecessary output

version and help options:

  Flg Arg Option-Name    Description
   -v opt version        Output version information and exit
   -? no  help           Display usage information and exit
   -! no  more-help      Extended usage information passed thru pager

Options are specified by doubled hyphens and their name
or by a single hyphen and the flag character.

Makes a name suitable for use as the path name for a temporary file.
If successful, this program will create the output file (or directory).

The following option preset mechanisms are supported:
 - examining environment variables named MKTEMP_*

This program will create a new empty file according to a default or provided
file name pattern.  Parts of the name may be specified in ``<file-pat>'',
or with command line options.  These differ as follows:
@enumerate


The ``base'' option cannot specify the six substitution X-es.


The ``file-pat'' argument specifies the suffix by embedding six X-es
in the name.


You may not have both a ``base'' option and a ``file-pat'' argument.


If the ``file-pat'' specifies either a directory or a suffix, then
you must not provide the corresponding option.
@end enumerate

If successful, the program will exit with a zero status code and
print the name of the created file to stdout (unless ``--quiet'' has
been specified).

please send bug reports to:  autogen-user@lists.sf.net

Man Page for mktemp

Here is its own generated man page:

NAME

       mktemp - Make a temporary file name

SYNOPSIS

       mktemp [-flag [value]]... [--opt-name [[=| ]value]]...
               [ <file-pat> ]

       Makes a name suitable for use as the path name for a temporary file.  If
       successful, this program will create the output file (or directory).

DESCRIPTION

       This manual page documents, briefly, the mktemp command.   This  program
       will  create  a  new  empty file according to a default or provided file
       name pattern.  Parts of the name may be specified in <file-pat>, or with
       command line options.  These differ as follows:

       The base option cannot specify the six substitution X-es.

       The  file-pat argument specifies the suffix by embedding six X-es in the
       name.

       You may not have both a base option and a file-pat argument.

       If the file-pat specifies either a directory or a suffix, then you  must
       not provide the corresponding option.

       If  successful,  the program will exit with a zero status code and print
       the name of the created file to stdout (unless --quiet has  been  speci-
       fied).

OPTIONS

       -p temp-dir, --prefix=temp-dir
              temp directory for the file.

              If  this  option is not provided, mktemp will use the environment
              variables MKTEMP_PREFIX, TMPDIR, TMP, or TEMPDIR to find a  suit-
              able directory.  If these are not available, it will fall back to
              ~/tmp or /tmp.  A <file-pat> command line argument  containing  a
              directory component will conflict with this option.

       -b base-name, --base=base-name
              base of file name.

              By  default,  the file will be named, ".tmp-XXXXXX".  This option
              will replace the ".tmp-" part and prohibit the <file-pat> command
              line argument.

       -s sfx, --suffix=sfx
              file name suffix.

              By  default,  there  is no suffix for the file.  This option will
              cause the resulting file to be renamed (if  possible)  with  this
              suffix.   If  the  file  cannot be renamed (because, for example,
              there is already a file by that name), then the name printed will
              not  have  this  suffix.  (The ``mktemp(3C)'' function upon which
              this utility relies requires that the final 6 or  mor  characters
              be 'X'.)

              If  the suffix begins with the characters ''.'', ''-'' or will be
              the  complete  suffix.   Otherwise,  a  period  (''.'')  will  be
              inserted between the generated name and this suffix.

       -c, --create
              create  file (default).  This option may not be preset with envi-
              ronment variables or in initialization (rc) files.   This  option
              is a member of the create class of options.

              mkstemp(3)  will  create  the file with the name it comes up with
              anyway, so this is the default action.

       -u, --unlink
              unlink file.  This option may  not  be  preset  with  environment
              variables or in initialization (rc) files.  This option is a mem-
              ber of the create class of options.

              If you do not wish to have the file created, specify this  option
              and it will be removed.  This is also considered "unsafe" mode.

       -d, --temp-dir
              temporary directory.  This option may not be preset with environ-
              ment variables or in initialization (rc) files.  This option is a
              member of the create class of options.

              Alternatively,  you  can  have  a  directory created instead of a
              file.  In that event, specify this option.

   The following options are commonly used and are provided and supported
       by AutoOpts:"

       -V, --verbose
              run program with progress info.

              Specifying this option will cause the program to display lots  of
              progress  information.   You will be able to see that the program
              is working and it may help you debug your use of the tool.

       -q, --quiet
              run without unnecessary output.

              Specifying this option will cause the program to disable progress
              information.

       -?, --help
              Display usage information and exit.

       -!, --more-help
              Extended usage information passed thru pager.

       -v [{v|c|n}], --version[={v|c|n}]
              Output  version  of program and exit.  The default mode is `v', a
              simple version.  The `c' mode will  print  copyright  information
              and `n' will print the full copyright notice.

OPTION PRESETS

       Any  option that is not marked as not presettable may be preset by load-
       ing values from environment variables named:
         MKTEMP_<option-name> or MKTEMP

AUTHOR

       Bruce Korb
       Please send bug reports to:  autogen-user@lists.sf.net

       Released under the Free BSD License.

       This manual page was AutoGen-erated from the mktemp option  definitions.

( 2.0) 2006-10-29 MKTEMP(1)

This man page was converted to HTML by man2html

top  Viewable With Any Browser  Valid XHTML 1.0!


AutoGen, AutoOpts, columns, getdefs, AutoFSM, AutoXDR and these web pages copyright (c) 1999-2002 Bruce Korb, all rights reserved.

Return to GNU's home page.

Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.

Please send comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.

This article, Copyright © 2000-2002 by Bruce Korb

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. Last modified: Sun Feb 18 12:18:46 PST 2007