diff options
Diffstat (limited to 'pc')
-rw-r--r-- | pc/Makefile.pc | 282 | ||||
-rw-r--r-- | pc/config.h | 287 | ||||
-rw-r--r-- | pc/make.bat | 55 | ||||
-rw-r--r-- | pc/names.lnk | 17 | ||||
-rw-r--r-- | pc/popen.c | 90 | ||||
-rw-r--r-- | pc/popen.h | 8 |
6 files changed, 739 insertions, 0 deletions
diff --git a/pc/Makefile.pc b/pc/Makefile.pc new file mode 100644 index 00000000..11aaa026 --- /dev/null +++ b/pc/Makefile.pc @@ -0,0 +1,282 @@ +# Makefile for GNU Awk. +# +# Copyright (C) 1986, 1988, 1989 the Free Software Foundation, Inc. +# +# This file is part of GAWK, the GNU implementation of the +# AWK Progamming Language. +# +# GAWK is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 1, or (at your option) +# any later version. +# +# GAWK is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GAWK; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + +# User tunable macros + +# CFLAGS: options to the C compiler +# +# -O optimize +# -g include dbx/sdb info +# -gg include gdb debugging info; only for GCC (deprecated) +# -pg include new (gmon) profiling info +# -p include old style profiling info (System V) +# +# To port GAWK, examine and adjust the following flags carefully. +# In addition, you will have to look at alloca below. +# The intent (eventual) is to not penalize the most-standard-conforming +# systems with a lot of #define's. +# +# -DBCOPY_MISSING - bcopy() et al. are missing; will replace +# with a #define'd memcpy() et al. -- use at +# your own risk (should really use a memmove()) +# -DSPRINTF_INT - sprintf() returns int (most USG systems) +# -DBLKSIZE_MISSING - st_blksize missing from stat() structure +# (most USG systems) +# -DBSDSTDIO - has a BSD internally-compatible stdio +# -DDOPRNT_MISSING - lacks doprnt() routine +# -DDUP2_MISSING - lacks dup2() system call (S5Rn, n < 4) +# -DGCVT_MISSING - lacks gcvt() routine +# -DGETOPT_MISSING - lacks getopt() routine +# -DMEMCMP_MISSING - lacks memcmp() routine +# -DMEMCPY_MISSING - lacks memcpy() routine +# -DMEMSET_MISSING - lacks memset() routine +# -DRANDOM_MISSING - lacks random() routine +# -DSTRCASE_MISSING - lacks strcasecmp() routine +# -DSTRCHR_MISSING - lacks strchr() and strrchr() routines +# -DSTRERROR_MISSING - lacks (ANSI C) strerror() routine +# -DSTRTOD_MISSING - lacks strtod() routine +# -DTMPNAM_MISSING - lacks or deficient tmpnam() routine +# -DVPRINTF_MISSING - lacks vprintf and associated routines +# -DSIGTYPE=int - signal routines return int (default void) + +# Sun running SunOS 4.x +# MISSING = -DSTRERROR_MISSING -DSTRCASE_MISSING + +# SGI Personal Iris (Sys V derived) +# MISSING = -DSPRINTF_INT -DBLKSIZE_MISSING -DSTRERROR_MISSING -DRANDOM_MISSING + +# VAX running Ultrix 3.x +# MISSING = -DSTRERROR_MISSING + +# A generic 4.2 BSD machine +# (eliminate GETOPT_MISSING for 4.3 release) +# (eliminate STRCASE_MISSING and TMPNAM_MISSING for Tahoe release) +# MISSING = -DBSDSTDIO -DMEMCMP_MISSING -DMEMCPY_MISSING -DMEMSET_MISSING \ +# -DSTRERROR_MISSING -DSTRTOD_MISSING -DVPRINTF_MISSING \ +# -DSTRCASE_MISSING -DTMPNAM_MISSING \ +# -DGETOPT_MISSING -DSTRCHR_MISSING -DSIGTYPE=int + +# On Amdahl UTS, a SysVr2-derived system +# MISSING = -DBCOPY_MISSING -DSPRINTF_INT -DRANDOM_MISSING -DSTRERROR_MISSING \ +# -DSTRCASE_MISSING -DDUP2_MISSING # -DBLKSIZE_MISSING ?????? + +# Comment out the next line if you don't have gcc. +# Also choose just one of -g and -O. +# CC= gcc +# for DOS +CC= cl +POPEN = popen.o + +# for DOS, most of the missing symbols are defined in MISSING.C in order to +# get around the command line length limitations +MISSING = -DSPRINTF_INT -DBLKSIZE_MISSING -DBCOPY_MISSING +LINKFLAGS= /MAP /CO /FAR /PACKC /NOE /NOIG /st:0x1800 + +# also give suffixes and explicit rule for DOS +.SUFFIXES : .o .c +.c.o: + $(CC) -c $(CFLAGS) -Ipc.d -W2 -AL -Fo$*.o $< + +OPTIMIZE= -Od -Zi +PROFILE= #-pg +DEBUG= #-DDEBUG #-DMEMDEBUG #-DFUNC_TRACE #-DMPROF +DEBUGGER= #-g -Bstatic +WARN= #-W -Wunused -Wimplicit -Wreturn-type -Wcomment # for gcc only + +# Parser to use on grammar -- if you don't have bison use the first one +#PARSER = yacc +PARSER = bison + +# ALLOCA +# Set equal to alloca.o if your system is S5 and you don't have +# alloca. Uncomment one of the rules below to make alloca.o from +# either alloca.s or alloca.c. +ALLOCA= #alloca.o + +# +# With the exception of the alloca rule referred to above, you shouldn't +# need to customize this file below this point. +# + +FLAGS= $(MISSING) $(DEBUG) +CFLAGS= $(FLAGS) $(DEBUGGER) $(PROFILE) $(OPTIMIZE) $(WARN) + +# object files +O1 = main.o eval.o builtin.o msg.o debug.o io.o field.o array.o node.o +O2 = version.o missing.o $(POPEN) + +AWKOBJS = $(O1) $(O2) + + +# for unix +# AWKTAB = awk.tab.o +# for dos +AWKTAB = awk_tab.o + + + +ALLOBJS = $(AWKOBJS) $(AWKTAB) + +# GNUOBJS +# GNU stuff that gawk uses as library routines. +GNUOBJS= regex.o $(ALLOCA) + +# source and documentation files +SRC = main.c eval.c builtin.c msg.c \ + debug.c io.c field.c array.c node.c missing.c + +ALLSRC= $(SRC) awk.tab.c + +AWKSRC= awk.h awk.y $(ALLSRC) version.sh patchlevel.h + +GNUSRC = alloca.c alloca.s regex.c regex.h + +COPIES = missing.d/dup2.c missing.d/gcvt.c missing.d/getopt.c \ + missing.d/memcmp.c missing.d/memcpy.c missing.d/memset.c \ + missing.d/random.c missing.d/strcase.c missing.d/strchr.c \ + missing.d/strerror.c missing.d/strtod.c missing.d/tmpnam.c \ + missing.d/vprintf.c + +SUPPORT = support/texindex.c support/texinfo.tex + +DOCS= gawk.1 gawk.texinfo + +INFOFILES= gawk-info gawk-info-1 gawk-info-2 gawk-info-3 gawk-info-4 \ + gawk-info-5 gawk-info-6 gawk.aux gawk.cp gawk.cps gawk.fn \ + gawk.fns gawk.ky gawk.kys gawk.pg gawk.pgs gawk.toc \ + gawk.tp gawk.tps gawk.vr gawk.vrs + +MISC = CHANGES COPYING FUTURES Makefile PROBLEMS README + +PCSTUFF= pc.d/Makefile.pc pc.d/popen.c pc.d/popen.h + +ALLDOC= gawk.dvi $(INFOFILES) + +ALLFILES= $(AWKSRC) $(GNUSRC) $(COPIES) $(MISC) $(DOCS) $(ALLDOC) $(PCSTUFF) $(SUPPORT) + +# Release of gawk. There can be no leading or trailing white space here! +REL=2.11 +# for unix +# GAWK = gawk +# for DOS +GAWK = gawk.exe +$(GAWK) : $(ALLOBJS) $(GNUOBJS) names.lnk + link @names.lnk + +#GNULIB = ..\lib\lgnu.lib +GNULIB = +names.lnk : makefile + echo $(O1) + > $@ + echo $(O2) + >> $@ + echo $(AWKTAB) + >> $@ + echo $(GNUOBJS) >> $@ + echo $(GAWK) >> $@ + echo gawk.map >> $@ + echo $(GNULIB) $(LINKFLAGS) >> $@ + +popen.o : pc.d\popen.c + $(CC) -c $(CFLAGS) -Ipc.d -W2 -AL -Fo$*.o pc.d\popen.c + +# rules to build gawk +#$(GAWK) : $(ALLOBJS) $(GNUOBJS) +# $(CC) -o gawk $(CFLAGS) $(ALLOBJS) $(GNUOBJS) -lm + +$(AWKOBJS): awk.h + +main.o: patchlevel.h + +#awk.tab.o: awk.h awk.tab.c +# +#awk.tab.c: awk.y +# $(PARSER) -v awk.y +# -mv -f y.tab.c awk.tab.c + +# for dos +awk_tab.o : awk.y awk.h + bison -y awk.y + $(CC) -c $(CFLAGS) -Ipc.d -W2 -AL -Fo$@ y_tab.c + @-rm y_tab.c + +version.c: version.sh + sh version.sh $(REL) > version.c + +# Alloca: uncomment this if your system (notably System V boxen) +# does not have alloca in /lib/libc.a +# +#alloca.o: alloca.s +# /lib/cpp < alloca.s | sed '/^#/d' > t.s +# as t.s -o alloca.o +# rm t.s + +# If your machine is not supported by the assembly version of alloca.s, +# use the C version instead. This uses the default rules to make alloca.o. +# +#alloca.o: alloca.c + +# auxiliary rules for release maintenance +lint: $(ALLSRC) + lint -hcbax $(FLAGS) $(ALLSRC) + +xref: + cxref -c $(FLAGS) $(ALLSRC) | grep -v ' /' >xref + +clean: + rm -f gawk *.o core awk.output awk.tab.c gmon.out make.out version.c + +clobber: clean + rm -f $(ALLDOC) gawk.log + +gawk.dvi: gawk.texinfo + tex gawk.texinfo ; texindex gawk.?? + tex gawk.texinfo ; texindex gawk.?? + tex gawk.texinfo + +$(INFOFILES): gawk.texinfo + makeinfo gawk.texinfo + +srcrelease: $(AWKSRC) $(GNUSRC) $(DOCS) $(MISC) $(COPIES) $(PCSTUFF) $(SUPPORT) + -mkdir gawk-$(REL) + cp -p $(AWKSRC) $(GNUSRC) $(DOCS) $(MISC) gawk-$(REL) + -mkdir gawk-$(REL)/missing.d + cp -p $(COPIES) gawk-$(REL)/missing.d + -mkdir gawk-$(REL)/pc.d + cp -p $(PCSTUFF) gawk-$(REL)/pc.d + -mkdir gawk-$(REL)/support + cp -p $(SUPPORT) gawk-$(REL)/support + tar -cf - gawk-$(REL) | compress > gawk-$(REL).tar.Z + +docrelease: $(ALLDOC) + -mkdir gawk-$(REL)-doc + cp -p $(INFOFILES) gawk.dvi gawk-$(REL)-doc + nroff -man gawk.1 > gawk-$(REL)-doc/gawk.1.pr + tar -cf - gawk-$(REL)-doc | compress > gawk-doc-$(REL).tar.Z + +psrelease: docrelease + -mkdir gawk-postscript + dvi2ps gawk.dvi > gawk-postscript/gawk.postscript + psroff -t -man gawk.1 > gawk-postscript/gawk.1.ps + tar -cf - gawk-postscript | compress > gawk.postscript.tar.Z + +release: srcrelease docrelease psrelease + rm -fr gawk-postscript gawk-$(REL) gawk-$(REL)-doc + +diff: + for i in RCS/*; do rcsdiff -c -b $$i > `basename $$i ,v`.diff; done diff --git a/pc/config.h b/pc/config.h new file mode 100644 index 00000000..4718a9cf --- /dev/null +++ b/pc/config.h @@ -0,0 +1,287 @@ +/* + * config.h -- configuration definitions for gawk. + * + * MS-DOS systems using MSC 5.1 + */ + +/* + * Copyright (C) 1991, the Free Software Foundation, Inc. + * + * This file is part of GAWK, the GNU implementation of the + * AWK Progamming Language. + * + * GAWK is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * GAWK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GAWK; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * This file isolates configuration dependencies for gnu awk. + * You should know something about your system, perhaps by having + * a manual handy, when you edit this file. You should copy config.h-dist + * to config.h, and edit config.h. Do not modify config.h-dist, so that + * it will be easy to apply any patches that may be distributed. + * + * The general idea is that systems conforming to the various standards + * should need to do the least amount of changing. Definining the various + * items in ths file usually means that your system is missing that + * particular feature. + * + * The order of preference in standard conformance is ANSI C, POSIX, + * and the SVID. + * + * If you have no clue as to what's going on with your system, try + * compiling gawk without editing this file and see what shows up + * missing in the link stage. From there, you can probably figure out + * which defines to turn on. + */ + +/**************************/ +/* Miscellanious features */ +/**************************/ + +/* + * BLKSIZE_MISSING + * + * Check your /usr/include/sys/stat.h file. If the stat structure + * does not have a member named st_blksize, define this. (This will + * most likely be the case on most System V systems prior to V.4.) + */ +#define BLKSIZE_MISSING 1 + +/* + * SIGTYPE + * + * The return type of the routines passed to the signal function. + * Modern systems use `void', older systems use `int'. + * If left undefined, it will default to void. + */ +/* #define SIGTYPE int */ + +/* + * SIZE_T_MISSING + * + * If your system has no typedef for size_t, define this to get a default + */ +#define SIZE_T_MISSING 1 + +/* + * CHAR_UNSIGNED + * + * If your machine uses unsigned characters (IBM RT and RS/6000 and others) + * then define this for use in regex.c + */ +/* #define CHAR_UNSIGNED 1 */ + +/* + * HAVE_UNDERSCORE_SETJMP + * + * Check in your /usr/include/setjmp.h file. If there are routines + * there named _setjmp and _longjmp, then you should define this. + * Typically only systems derived from Berkeley Unix have this. + */ +/* #define HAVE_UNDERSCORE_SETJMP 1 */ + +/***********************************************/ +/* Missing library subroutines or system calls */ +/***********************************************/ + +/* + * GETOPT_MISSING + * + * Define this if your library does not have the getopt(3) library + * routine for parsing command line arguments. + */ +#define GETOPT_MISSING 1 + +/* + * MEMCMP_MISSING + * MEMCPY_MISSING + * MEMSET_MISSING + * + * These three routines are for manipulating blocks of memory. Most + * likely they will either all three be present or all three be missing, + * so they're grouped together. + */ +/* #define MEMCMP_MISSING 1 */ +/* #define MEMCPY_MISSING 1 */ +/* #define MEMSET_MISSING 1 */ + +/* + * RANDOM_MISSING + * + * Your system does not have the random(3) suite of random number + * generating routines. These are different than the old rand(3) + * routines! + */ +#define RANDOM_MISSING 1 + +/* + * STRCASE_MISSING + * + * Your system does not have the strcasemp() and strncasecmp() + * routines that originated in Berkeley Unix. + */ +#define STRCASE_MISSING 1 + +/* + * STRCHR_MISSING + * + * Your system does not have the strchr() and strrchr() functions. + */ +/* #define STRCHR_MISSING 1 */ + +/* + * STRERROR_MISSING + * + * Your system lacks the ANSI C strerror() routine for returning the + * strings associated with errno values. + */ +/* #define STRERROR_MISSING 1 */ + +/* + * STRTOD_MISSING + * + * Your system does not have the strtod() routine for converting + * strings to double precision floating point values. + */ +/* #define STRTOD_MISSING 1 */ + +/* + * STRTOL_MISSING + * + * Your system does not have the strtol() routine for converting + * strings to long integers. + */ +#define STRTOL_MISSING 1 + +/* + * STRFTIME_MISSING + * + * Your system lacks the ANSI C strftime() routine for formatting + * broken down time values. + */ +#define STRFTIME_MISSING 1 + +/* + * TZSET_MISSING + * + * If you have a 4.2 BSD vintage system, then the strftime() routine + * supplied in the missing directory won't be enough, because it relies on the + * tzset() routine from System V / Posix. Fortunately, there is an + * emulation for tzset() too that should do the trick. If you don't + * have tzset(), define this. + */ +/* #define TZSET_MISSING 1 */ + +/* + * TZNAME_MISSING + * + * Some systems do not support the external variables tzname and daylight. + * If this is the case *and* strftime() is missing, define this. + */ +/* #define TZNAME_MISSING 1 */ + +/* + * STDC_HEADERS + * + * If your system does have ANSI compliant header files that + * provide prototypes for library routines, then define this. + */ +/* #define STDC_HEADERS 1 */ + +/* + * NO_TOKEN_PASTING + * + * If your compiler define's __STDC__ but does not support token + * pasting (tok##tok), then define this. + */ +/* #define NO_TOKEN_PASTING 1 */ + +/*****************************************************************/ +/* Stuff related to the Standard I/O Library. */ +/*****************************************************************/ +/* Much of this is (still, unfortunately) black magic in nature. */ +/* You may have to use some or all of these together to get gawk */ +/* to work correctly. */ +/*****************************************************************/ + +/* + * NON_STD_SPRINTF + * + * Look in your /usr/include/stdio.h file. If the return type of the + * sprintf() function is NOT `int', define this. + */ +/* #define NON_STD_SPRINTF 1 */ + +/* + * VPRINTF_MISSING + * + * Define this if your system lacks vprintf() and the other routines + * that go with it. + */ +/* #define VPRINTF_MISSING 1 */ + +/* + * BSDSTDIO + * + * Define this if your standard i/o library is internally compatible + * with the one shipped with Berkeley Unix systems (4.n, n <= 3-reno). + * If you've defined VPRINTF_MISSING, you probably will need this too. + */ +/* #define BSDSTDIO 1 */ + +/* + * DOPRNT_MISSING + * + * Define this if your standard i/o library does not have the _doprnt() + * routine. This is used in an attempt to simulate the vfprintf() + * routine. + */ +/* #define DOPRNT_MISSING 1 */ + +/* + * Casts from size_t to int and back. These will become unnecessary + * at some point in the future, but for now are required where the + * two types are a different representation. + */ +/* #define SZTC */ +/* #define INTC */ + +/* + * SYSTEM_MISSING + * + * Define this if your library does not provide a system function + * or you are not entirely happy with it and would rather use + * a provided replacement (atari only). + */ +/* #define SYSTEM_MISSING 1 */ + + +/*******************************/ +/* Gawk configuration options. */ +/*******************************/ + +/* + * DEFPATH + * + * The default search path for the -f option of gawk. It is used + * if the AWKPATH environment variable is undefined. The default + * definition is provided here. Most likely you should not change + * this. + */ + +/* #define DEFPATH ".:/usr/lib/awk:/usr/local/lib/awk" */ +/* #define ENVSEP ':' */ + +/* anything that follows is for system-specific short-term kludges */ diff --git a/pc/make.bat b/pc/make.bat new file mode 100644 index 00000000..301fdb1e --- /dev/null +++ b/pc/make.bat @@ -0,0 +1,55 @@ +REM Simple brute force command file for building gawk under msdos +REM +REM *** This has only been using MSC 5.1 *** +REM +REM Written by Arnold Robbins, May 1991 +REM Based on earlier makefile for dos +REM +REM Copyright (C) 1986, 1988, 1989, 1991 the Free Software Foundation, Inc. +REM +REM This file is part of GAWK, the GNU implementation of the +REM AWK Progamming Language. +REM +REM GAWK is free software; you can redistribute it and/or modify +REM it under the terms of the GNU General Public License as published by +REM the Free Software Foundation; either version 1, or (at your option) +REM any later version. +REM +REM GAWK is distributed in the hope that it will be useful, +REM but WITHOUT ANY WARRANTY; without even the implied warranty of +REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +REM GNU General Public License for more details. +REM +REM You should have received a copy of the GNU General Public License +REM along with GAWK; see the file COPYING. If not, write to +REM the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +REM +REM debug flags: DEBUG=#-DDEBUG #-DFUNC_TRACE -DMEMDEBUG +REM DEBUGGER= #-Zi +REM +cl -c -AL -Oalt array.c +cl -c -AL -Oalt awktab.c +cl -c -AL -Oalt builtin.c +cl -c -AL -Oalt dfa.c +cl -c -AL -Oalt eval.c +cl -c -AL -Oalt field.c +cl -c -AL -Oalt io.c +cl -c -AL -Oalt iop.c +cl -c -AL -Oalt main.c +cl -c -AL -Oalt missing.c +cl -c -AL -Oalt msg.c +cl -c -AL -Oalt node.c +cl -c -AL -Oalt popen.c +cl -c -AL -Oalt re.c +cl -c -AL -Oalt version.c +REM +REM this kludge necessary because MSC 5.1 compiler bombs with -Oail (where +REM -Ox == "-Oailt -Gs") +REM +REM You can ignore the warnings you will get +cl -c -AL -Ot regex.c +REM +REM I'm not sure what this is for. It was commented out +REM LINKFLAGS= /CO /NOE /NOI /st:0x1800 +REM +link @names.lnk,gawk.exe /E /FAR /PAC /NOE /NOI /st:0x1800; diff --git a/pc/names.lnk b/pc/names.lnk new file mode 100644 index 00000000..5a42d0ef --- /dev/null +++ b/pc/names.lnk @@ -0,0 +1,17 @@ +array.obj+ +awktab.obj+ +builtin.obj+ +dfa.obj+ +eval.obj+ +field.obj+ +io.obj+ +iop.obj+ +main.obj+ +missing.obj+ +msg.obj+ +node.obj+ +popen.obj+ +re.obj+ +version.obj+ +regex.obj+ +setargv.obj diff --git a/pc/popen.c b/pc/popen.c new file mode 100644 index 00000000..48952c22 --- /dev/null +++ b/pc/popen.c @@ -0,0 +1,90 @@ +#include <stdio.h> +#include "popen.h" +#include <io.h> +#include <string.h> +#include <process.h> + +static char template[] = "piXXXXXX"; +typedef enum { unopened = 0, reading, writing } pipemode; +static +struct { + char *command; + char *name; + pipemode pmode; +} pipes[_NFILE]; + +FILE * +popen( char *command, char *mode ) { + FILE *current; + char *name; + int cur; + pipemode curmode; + /* + ** decide on mode. + */ + if(strcmp(mode,"r") == 0) + curmode = reading; + else if(strcmp(mode,"w") == 0) + curmode = writing; + else + return NULL; + /* + ** get a name to use. + */ + if((name = tempnam(".","pip"))==NULL) + return NULL; + /* + ** If we're reading, just call system to get a file filled with + ** output. + */ + if(curmode == reading) { + char cmd[256]; + sprintf(cmd,"%s > %s",command,name); + system(cmd); + if((current = fopen(name,"r")) == NULL) + return NULL; + } else { + if((current = fopen(name,"w")) == NULL) + return NULL; + } + cur = fileno(current); + pipes[cur].name = name; + pipes[cur].pmode = curmode; + pipes[cur].command = strdup(command); + return current; +} + +int +pclose( FILE * current) { + int cur = fileno(current),rval; + /* + ** check for an open file. + */ + if(pipes[cur].pmode == unopened) + return -1; + if(pipes[cur].pmode == reading) { + /* + ** input pipes are just files we're done with. + */ + rval = fclose(current); + unlink(pipes[cur].name); + } else { + /* + ** output pipes are temporary files we have + ** to cram down the throats of programs. + */ + char command[256]; + fclose(current); + sprintf(command,"%s < %s",pipes[cur].command,pipes[cur].name); + rval = system(command); + unlink(pipes[cur].name); + } + /* + ** clean up current pipe. + */ + pipes[cur].pmode = unopened; + free(pipes[cur].name); + free(pipes[cur].command); + return rval; +} + diff --git a/pc/popen.h b/pc/popen.h new file mode 100644 index 00000000..55501324 --- /dev/null +++ b/pc/popen.h @@ -0,0 +1,8 @@ +/* +** popen.h -- prototypes for pipe functions +*/ +#if !defined(FILE) +#include <stdio.h> +#endif +extern FILE *popen( char *, char * ); + |