projects
/
bison.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: link lib/libbison.a for gnulib.
[bison.git]
/
djgpp
/
subpipe.c
diff --git
a/djgpp/subpipe.c
b/djgpp/subpipe.c
index 96117b9a4ef74a182891947c406f325aa6cbc6f1..213703d42c23e7399d3c70f93985db32b9adef50 100644
(file)
--- a/
djgpp/subpipe.c
+++ b/
djgpp/subpipe.c
@@
-1,11
+1,11
@@
/* Subprocesses with pipes.
/* Subprocesses with pipes.
- Copyright (C) 2005
, 2006
Free Software Foundation, Inc.
+ Copyright (C) 2005
-2010
Free Software Foundation, Inc.
- This program is free software
;
you can redistribute it and/or modify
+ This program is free software
:
you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
- the Free Software Foundation
; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation
, either version 3 of the License, or
+
(at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-13,8
+13,7
@@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Juan Manuel Guerrero <juan.guerrero@gmx.de>. */
/* Written by Juan Manuel Guerrero <juan.guerrero@gmx.de>. */
@@
-68,15
+67,26
@@
static char tmp_file_name[2][L_tmpnam];
void
init_subpipe(void)
{
void
init_subpipe(void)
{
+ char *tmpdir;
int fd;
int fd;
- strcpy(tmp_file_name[0], "/dev/env/TMPDIR/bnXXXXXX");
+ tmpdir = getenv("TMPDIR");
+ if (tmpdir == NULL)
+ tmpdir = getenv("TMP");
+ if (tmpdir == NULL)
+ tmpdir = getenv("TEMP");
+ if (access(tmpdir, D_OK))
+ tmpdir = ".";
+
+ strcpy(tmp_file_name[0], tmpdir);
+ strcat(tmp_file_name[0], "/bnXXXXXX");
fd = mkstemp(tmp_file_name[0]);
if (fd < 0)
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
close (fd);
fd = mkstemp(tmp_file_name[0]);
if (fd < 0)
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
close (fd);
- strcpy(tmp_file_name[1], "/dev/env/TMPDIR/bnXXXXXX");
+ strcpy(tmp_file_name[1], tmpdir);
+ strcat(tmp_file_name[1], "/bnXXXXXX");
fd = mkstemp(tmp_file_name[1]);
if (fd < 0)
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
fd = mkstemp(tmp_file_name[1]);
if (fd < 0)
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));