Check-in [5a37bbd45d]

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added link to ref.impl.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:5a37bbd45d679ad38041da678b89dd6ec99e1c814fde8f61cdce7633a91640b4
User & Date: dkf 2008-11-18 14:21:25
Context
2008-11-18
16:22
corrected the targetted version of Tcl; no new features for 8.5 are admitted check-in: be2bce2306 user: dkf tags: trunk
14:21
Added link to ref.impl. check-in: 5a37bbd45d user: dkf tags: trunk
2008-11-16
22:58
Revision through web from Alexandre Ferrieux <alexandre.ferrieux@gmail.com> Added implementation of the type dependent part. check-in: fc09503cdc user: tclhttpd tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tip/210.tip.

     1      1   TIP:            210
     2      2   Title:          Add 'tempname' Subcommand to 'file'
     3         -Version:        $Revision: 1.5 $
            3  +Version:        $Revision: 1.6 $
     4      4   Author:         Bob Techentin <techentin.robert@mayo.edu>
     5      5   State:          Draft
     6      6   Type:           Project
     7      7   Vote:           Pending
     8      8   Created:        19-Jul-2004
     9      9   Post-History:   
    10     10   Keywords:       Tcl,filename
    11     11   Tcl-Version:    8.6
    12     12   
    13     13   ~ Abstract
    14     14   
    15         -Programmers often need to create temporary files.  This TIP proposes
    16         -adding the new subcommand '''tempname''' to the '''file''' command,
    17         -simplifying programmer effort in creating a unique temporary file
    18         -name.
           15  +Programmers often need to create temporary files. This TIP proposes adding the
           16  +new subcommand '''tempname''' to the '''file''' command, simplifying
           17  +programmer effort in creating a unique temporary file name.
    19     18   
    20     19   ~ Rationale
    21     20   
    22         -Creating temporary files is a primitive and common enough operation
    23         -that the ANSI C standard defines several subroutines to assist
    24         -programmers.  The ''tmpnam()'' function generates a string that is a
    25         -valid file name that is not the name of an existing file.  The
    26         -''tmpfile()'' function returns a valid file pointer to a temporary
    27         -file that is removed automatically when it is closed or at program
    28         -termination.  Both functions are commonly used by programmers, without
    29         -worrying about the optimal location for temporary files or schemes
           21  +Creating temporary files is a primitive and common enough operation that the
           22  +ANSI C standard defines several subroutines to assist programmers. The
           23  +''tmpnam()'' function generates a string that is a valid file name that is not
           24  +the name of an existing file. The ''tmpfile()'' function returns a valid file
           25  +pointer to a temporary file that is removed automatically when it is closed or
           26  +at program termination. Both functions are commonly used by programmers,
           27  +without worrying about the optimal location for temporary files or schemes
    30     28   required to create unique file names.
    31     29   
    32         -Tcl has not supported temporary files, so programmers have had to
    33         -write code to generate unique file names and choose locations like
    34         -''/tmp'' or ''c://temp.''  The ''fileutil'' module of tcllib provides
    35         -a relatively sophisticated implementation of ''tempfile'', but
    36         -extension writers have not been able to rely on this code.  Modules in
    37         -Iwidgets, the Tcl plugin, tcllib, and tclx all appear to have this
    38         -sort of code, and not all are correct.
           30  +Tcl has not supported temporary files, so programmers have had to write code
           31  +to generate unique file names and choose locations like ''/tmp'' or
           32  +''C:\temp''. The ''fileutil'' module of tcllib provides a relatively
           33  +sophisticated implementation of ''tempfile'', but extension writers have not
           34  +been able to rely on this code. Modules in Iwidgets, the Tcl plugin, tcllib,
           35  +and TclX all appear to have this sort of code, and not all are correct.
    39     36   
    40         -This TIP proposes to extend the '''file''' command with one subcommand
    41         -to generate temporary files and file names.  By extending the core command, application programmers and extension writers will be able to depend on this functionality for their code, without resorting to copying or depending on tcllib.
           37  +This TIP proposes to extend the '''file''' command with one subcommand to
           38  +generate temporary files and file names. By extending the core command,
           39  +application programmers and extension writers will be able to depend on this
           40  +functionality for their code, without resorting to copying or depending on
           41  +tcllib.
    42     42   
    43     43   ~ Specification
    44     44   
    45         -This TIP proposes an extension to the ''file''
    46         -command, implementing the functionality of the POSIX standard
    47         -mkstemp() function.  The new subcommand will be called ''tempfile''.  It will return an open file channel, and (optionally) the name of the temporary file.
           45  +This TIP proposes an extension to the ''file'' command, implementing the
           46  +functionality of the POSIX standard mkstemp() function. The new subcommand
           47  +will be called ''tempfile''. It will return an open file channel, and
           48  +(optionally) the name of the temporary file.
    48     49   
    49     50   ~ Synopsis
    50     51   
    51     52    > '''file tempfile''' ?''template''? ?''namevar''?
    52     53   
    53         -Opens a unique temporary file and returns an open file channel.  If the ''template'' string is specified and non-empty, then characters will be appended to create the unique filename.  If ''namevar'' is specified, then the command will set the variable to the name of the temporary file.
           54  +Opens a unique temporary file and returns an open file channel. If the
           55  +''template'' string is specified and non-empty, then characters will be
           56  +appended to create the unique filename. If ''namevar'' is specified, then the
           57  +command will set the variable to the name of the temporary file. The returned
           58  +channel will have been opened in read-write mode (but not append mode) using
           59  +the defaults for EOL translation, encoding, etc.
           60  +
           61  +~ Reference Implementation
           62  +
           63  +Available as Tcl Patch #999162 on SourceForge
           64  +[https://sourceforge.net/support/tracker.php?aid=999162].
    54     65   
    55     66   ~ Copyright
    56     67   
    57     68   This document has been placed in the public domain.