delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/02/17/15:17:25

Delivered-To: listarch-cygwin AT sourceware DOT cygnus DOT com
Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Sender: Aldo DOT Mazzilli AT inrialpes DOT fr
Message-ID: <36CADD7F.23EF@inria.fr>
Date: Wed, 17 Feb 1999 16:17:20 +0100
From: Aldo Mazzilli <aldo DOT mazzilli AT inria DOT fr>
Organization: INRIA
X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.5 sun4u)
MIME-Version: 1.0
To: gnu-win32 AT cygnus DOT com
CC: aldo DOT mazzilli AT inrialpes DOT fr
Subject: bash bug : here is the TCL script

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019