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 >
Text File  |  1995-03-23  |  4KB  |  117 lines

  1. This is an os/2 port of Tcl 7.3 using icc 2.0.  It is missing one
  2. significant feature:
  3.  
  4.   1) no "exec"
  5.  
  6. Otherwise it is complete and mostly faithful to the unix version of
  7. Tcl.  To fix "exec", I need to figure out how to replace the fork()
  8. and exec() in tclUnixUtil.c with a _spawn().  If someone knows how to
  9. do this, please let me know.  
  10.  
  11. [UPDATE:  Some people have sent hints attached to this file...]
  12.  
  13. If you happen to add these features on your own, please send me the
  14. patch files so I can include them. I may get around to it myself, but
  15. it might be a while.  I also would like to add a "load" command so
  16. that extensions may be loaded from DLLs.  Finally, a .inf version of
  17. the documentation would be useful.
  18.  
  19. I am somewhat embarrassed to release this in this state but it might
  20. be a while before I can do anymore work on this so here it is.
  21.  
  22. INSTALLATION
  23.  
  24. I recommend that you create a \tcl directory and place tclsh.exe,
  25. libtcl.lib, tcl.h and the contents of .\library in it.  Alternatively,
  26. place them in appropriate bin, lib and include directories.  
  27.  
  28. If you don't put the contents of .\library in \tcl or you wish to run
  29. Tcl from a drive other than the one it is located on, you must set the
  30. TCL_LIBRARY environment variable to the *directory* that contains
  31. init.tcl.
  32.  
  33. Please let me know of any problems.
  34.  
  35. Bud Bach
  36. Teledata Solutions, Inc.
  37. wwb@wwa.com
  38.  
  39.  
  40. ---- begin attachment ----
  41. From: williams@herky.cs.uiowa.edu (Kent Williams)
  42. Newsgroups: comp.os.os2.programmer.porting
  43. Subject: Re: Emulating fork()
  44. Date: 13 May 1994 14:26:55 GMT
  45. Organization: University of Iowa, Iowa City, IA, USA
  46.  
  47. >From article <2qv09q$pc1@uusynap.synapse.org>, by evanc@spatial.synapse.org (Evan Champion):
  48.  
  49. > I'm porting a UNIX application that forks itself and was wondering
  50. > if someone could post source to a fork() for OS/2?  I know emx
  51. > contains a fork(), but I am using IBM's C Set++.
  52.  
  53. fork is used in two contexts, both of which are easy to simulate.
  54.  
  55. 1. Run another program.  This code looks like
  56.  
  57. int pid;
  58. switch(pid = fork())
  59. case 0: /* child */
  60.     /* mysterious setup code */
  61.     execv(new program args);
  62.     printf("Exec failed! Youch!\n");
  63.     exit(-1);
  64. case -1:
  65.     printf("Fork failed! Youch!\n");
  66.     break;
  67. default:
  68.     if(synchronous) /* wait around for program to be done */
  69.         waitpid(pid,&stat,options);
  70. }
  71.  
  72. If 'synchronous' is true, you can just call system to run the program,
  73. or you can do the spawn mumbo-jumbo.
  74.  
  75. If 'synchronous' is false, you use spawn with the NO_WAIT option.        
  76.  
  77. 2. Starting a pipeline.  In this case, there is a bunch of mumbo-jumbo
  78. involved in setting up a pipe.  In OS/2, you have to set up the pipes with
  79. a completely different set of mumbo jumbo.
  80.  
  81. Look at the OS/2 ports for things like gnu-awk and gnu-diff.  They bypass
  82. emx's fork because it is resource intensive.
  83. --
  84. Kent Williams -- williams@cs.uiowa.edu  | "The downfall of Mankind will not be
  85. "A man who has nothing in particular to |  war, plague, or famine.  It will be
  86. recommend him discusses all sorts of    |  paper jams." -- Me
  87. subjects at random as though he knew    +-------------------------------------
  88. everything."  - One of Sei Shonagon's Hateful Things
  89.  
  90.  
  91. Date: Mon, 28 Nov 94 10:18:51 UTC
  92. From: mwillm@VNET.IBM.COM
  93. To:   wwb@wwa.com
  94. Subject: OS2 fork() wait() getpid()
  95.  
  96. :But what do you do if the code you are porting does a fork(), dup()
  97. :and then exec()?  -- Bud
  98.  
  99. Depends on what you want to do...
  100. for instance :
  101. int fd1=1, outfd , fdsave=-1;
  102. DosDupHandle(1, &fdsave); /* saves stdout */
  103. DosDupHandle(outfd, &fd1); /* duplicates outfd as stdout */
  104. DosExecPgm(Buf,256, EXEC_ASYNC, 0, 0, &rc, "child.exe"); /* execs child.exe */
  105.                                   /* its stdout will be redirected in outfd */
  106. DosDupHandle(fdsave, &fd1); /* brings back stdout */
  107.  
  108. If you have some code, I'll try to find an OS/2 equivalent...
  109.  
  110. Hope this helps
  111. Matthieu WILLM
  112. <mwillm@vnet.ibm.com>
  113.  
  114. ---- end attachment ----
  115.  
  116.  
  117.