Mail Archives: cygwin/1999/02/17/15:17:25
I've written a TCL script which does the following things :
1 --> gets a Shell command from stdin
2 --> open a Bash shell within a pipe
3 --> puts the command on the pipeline
4 --> gets the result
Here it is :
------------
button .exit -text "Exit" -command exit
pack .exit -fill x
text .text -width 60 -height 3
pack .text
if [catch {open "|sh 2>@ stdout" r+} input] {
} else {
fconfigure $input -buffering none
fileevent $input readable Log
}
puts $input "pwd"
proc Log {} {
global input
if {[gets $input line]<0} {
close $input
} else {
.text insert end $line\n
.text see end
}
}
----------------------------------------------------------------------
PROBLEM :
I can't get any results after the 4th step with Cygnus Solution : :-(
I get the right result with MKS KSH or UWIN KSH : :-)
Can you give me any reason, please ???
=======================================================================
My TCL script can easily be translated into the following C program :
#include <stdio.h>
FILE *recep, *df;
main()
{
char buf[BUFSIZ];
char string[256], rec[256];
printf("Enter your command :") ;
scanf("%s", &string) ;
strcat(string,"\n") ;
df = popen("sh", "wb");
fputs(string, df) ;
while (fgets(buf, BUFSIZ, df) != NULL)
(void) printf("%s", buf);
pclose(df) ;
}
This C program works fine under Cygnus, MKS and UWIN solutions.
--
=======================================================================
,',',',',',',' Aldo MAZZILLI | INRIA Rhone-Alpes |
,',',',',',',' aldo DOT mazzilli AT inrialpes DOT fr| 655, avenue de l'Europe |
,',',',',',',' Tel : 04 76 61 53 91 | 38330 Montbonnot St Martin |
,',',',',',',' Fax : 04 76 61 52 52 | FRANCE |
,',' *** Site WEB : http://www.inrialpes.fr/vasy/people/Aldo.Mazzilli |
=======================================================================
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -