source: trunk/src/binutils/libiberty/pex-os2.c@ 880

Last change on this file since 880 was 626, checked in by bird, 22 years ago

#597: OS/2 EMX config/hacks.

  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1/* Utilities to execute a program in a subprocess (possibly linked by pipes
2 with other subprocesses), and wait for it. OS/2 specialization.
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
4 Free Software Foundation, Inc.
5
6This file is part of the libiberty library.
7Libiberty is free software; you can redistribute it and/or
8modify it under the terms of the GNU Library General Public
9License as published by the Free Software Foundation; either
10version 2 of the License, or (at your option) any later version.
11
12Libiberty is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15Library General Public License for more details.
16
17You should have received a copy of the GNU Library General Public
18License along with libiberty; see the file COPYING.LIB. If not,
19write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22#include "pex-common.h"
23
24#ifdef HAVE_UNISTD_H
25#include <unistd.h>
26#endif
27#ifdef HAVE_STDLIB_H
28#include <stdlib.h>
29#endif
30#ifdef HAVE_SYS_WAIT_H
31#include <sys/wait.h>
32#endif
33#include <process.h>
34
35int
36pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
37 const char *program;
38 char * const *argv;
39 const char *this_pname;
40 const char *temp_base;
41 char **errmsg_fmt, **errmsg_arg;
42 int flags;
43{
44 int pid;
45
46 if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
47 abort ();
48 pid = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv);
49 if (pid == -1)
50 {
51 *errmsg_fmt = install_error_msg;
52 *errmsg_arg = program;
53 return -1;
54 }
55 return pid;
56}
57
58int
59pwait (pid, status, flags)
60 int pid;
61 int *status;
62 int flags;
63{
64 /* ??? Here's an opportunity to canonicalize the values in STATUS.
65 Needed? */
66 int pid = wait (status);
67 return pid;
68}
69
Note: See TracBrowser for help on using the repository browser.