~ubuntu-branches/debian/stretch/alpine/stretch

« back to all changes in this revision

Viewing changes to pith/osdep/tempfile.c

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2007-02-17 13:17:42 UTC
  • Revision ID: james.westby@ubuntu.com-20070217131742-99x5c6cpg1pbkdhw
Tags: upstream-0.82+dfsg
ImportĀ upstreamĀ versionĀ 0.82+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if !defined(lint) && !defined(DOS)
 
2
static char rcsid[] = "$Id: tempfile.c 229 2006-11-13 23:14:48Z hubert@u.washington.edu $";
 
3
#endif
 
4
 
 
5
/*
 
6
 * ========================================================================
 
7
 * Copyright 2006 University of Washington
 
8
 *
 
9
 * Licensed under the Apache License, Version 2.0 (the "License");
 
10
 * you may not use this file except in compliance with the License.
 
11
 * You may obtain a copy of the License at
 
12
 *
 
13
 *     http://www.apache.org/licenses/LICENSE-2.0
 
14
 *
 
15
 * ========================================================================
 
16
 */
 
17
 
 
18
#include <system.h>
 
19
 
 
20
#if     HAVE_TMPFILE
 
21
#else
 
22
#include "temp_nam.h"
 
23
#endif
 
24
 
 
25
#include "../charconv/filesys.h"
 
26
 
 
27
#include "tempfile.h"
 
28
 
 
29
 
 
30
/*----------------------------------------------------------------------
 
31
   Create a temporary file, the name of which we don't care about 
 
32
and that goes away when it is closed.  Just like ANSI C tmpfile.
 
33
  ----*/
 
34
FILE  *
 
35
create_tmpfile(void)
 
36
{
 
37
#if     HAVE_TMPFILE
 
38
    return(tmpfile());
 
39
#else
 
40
    char *file_name;
 
41
    FILE *stream;
 
42
 
 
43
    file_name = temp_nam(NULL, "pine-tmp", 0);
 
44
    stream = our_fopen(file_name, "w+b");
 
45
    our_unlink(file_name);
 
46
    return(stream);
 
47
#endif
 
48
}
 
49
 
 
50