home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
tcl2-73c.zip
/
tcl7.3
/
README.OS2
< prev
next >
Wrap
Text File
|
1995-03-23
|
4KB
|
117 lines
This is an os/2 port of Tcl 7.3 using icc 2.0. It is missing one
significant feature:
1) no "exec"
Otherwise it is complete and mostly faithful to the unix version of
Tcl. To fix "exec", I need to figure out how to replace the fork()
and exec() in tclUnixUtil.c with a _spawn(). If someone knows how to
do this, please let me know.
[UPDATE: Some people have sent hints attached to this file...]
If you happen to add these features on your own, please send me the
patch files so I can include them. I may get around to it myself, but
it might be a while. I also would like to add a "load" command so
that extensions may be loaded from DLLs. Finally, a .inf version of
the documentation would be useful.
I am somewhat embarrassed to release this in this state but it might
be a while before I can do anymore work on this so here it is.
INSTALLATION
I recommend that you create a \tcl directory and place tclsh.exe,
libtcl.lib, tcl.h and the contents of .\library in it. Alternatively,
place them in appropriate bin, lib and include directories.
If you don't put the contents of .\library in \tcl or you wish to run
Tcl from a drive other than the one it is located on, you must set the
TCL_LIBRARY environment variable to the *directory* that contains
init.tcl.
Please let me know of any problems.
Bud Bach
Teledata Solutions, Inc.
wwb@wwa.com
---- begin attachment ----
From: williams@herky.cs.uiowa.edu (Kent Williams)
Newsgroups: comp.os.os2.programmer.porting
Subject: Re: Emulating fork()
Date: 13 May 1994 14:26:55 GMT
Organization: University of Iowa, Iowa City, IA, USA
>From article <2qv09q$pc1@uusynap.synapse.org>, by evanc@spatial.synapse.org (Evan Champion):
> I'm porting a UNIX application that forks itself and was wondering
> if someone could post source to a fork() for OS/2? I know emx
> contains a fork(), but I am using IBM's C Set++.
fork is used in two contexts, both of which are easy to simulate.
1. Run another program. This code looks like
int pid;
switch(pid = fork())
case 0: /* child */
/* mysterious setup code */
execv(new program args);
printf("Exec failed! Youch!\n");
exit(-1);
case -1:
printf("Fork failed! Youch!\n");
break;
default:
if(synchronous) /* wait around for program to be done */
waitpid(pid,&stat,options);
}
If 'synchronous' is true, you can just call system to run the program,
or you can do the spawn mumbo-jumbo.
If 'synchronous' is false, you use spawn with the NO_WAIT option.
2. Starting a pipeline. In this case, there is a bunch of mumbo-jumbo
involved in setting up a pipe. In OS/2, you have to set up the pipes with
a completely different set of mumbo jumbo.
Look at the OS/2 ports for things like gnu-awk and gnu-diff. They bypass
emx's fork because it is resource intensive.
--
Kent Williams -- williams@cs.uiowa.edu | "The downfall of Mankind will not be
"A man who has nothing in particular to | war, plague, or famine. It will be
recommend him discusses all sorts of | paper jams." -- Me
subjects at random as though he knew +-------------------------------------
everything." - One of Sei Shonagon's Hateful Things
Date: Mon, 28 Nov 94 10:18:51 UTC
From: mwillm@VNET.IBM.COM
To: wwb@wwa.com
Subject: OS2 fork() wait() getpid()
:But what do you do if the code you are porting does a fork(), dup()
:and then exec()? -- Bud
Depends on what you want to do...
for instance :
int fd1=1, outfd , fdsave=-1;
DosDupHandle(1, &fdsave); /* saves stdout */
DosDupHandle(outfd, &fd1); /* duplicates outfd as stdout */
DosExecPgm(Buf,256, EXEC_ASYNC, 0, 0, &rc, "child.exe"); /* execs child.exe */
/* its stdout will be redirected in outfd */
DosDupHandle(fdsave, &fd1); /* brings back stdout */
If you have some code, I'll try to find an OS/2 equivalent...
Hope this helps
Matthieu WILLM
<mwillm@vnet.ibm.com>
---- end attachment ----