Subject: CYGWIN b20: Pipe problems (bug?)
From: [email-masked]

3 Dec 1998 19:44:04 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
To: <[email-masked]>

This message has been checked for virusses.
No known virusses have been detected.
*******************************************

Hi,

I've searched the archives, but couldnt find any match to the problem
i am experiencing, but please excuse me if this subject is well known.
I'm only a beginning user of the cygwin compiler and must say i'm very
impressed with it, I do however have a problem with compiling one of
my projects.

I have one project which generates some database files by reading in a
lot of source files through a pipe. The code works quite nicely on
Linux and HPUX but doesnt seem to work with cygnus.. Below is a small
example program which i think has the same problem. The only
differences are that this example just gets stuck (after 55 pipes)
while my code returns an "no more files" after a about 27 pipes and
that this program just uses cat while my app pipes the files through
cpp.

Now this may ofcourse be a simple error made by me, if so I would like
to know how i am supposed to do it. But it seems like pipe forgets to
close one end of the pipe, causing the fd table to overflow.. or
something like that anyways.

Platform. Win95,  333Mhz PII with 64 MB RAM and 2 GB HD

I would appreciate any hints or tips you can give me!

Grtz
Peter Eussen

/* pipe test */

#include <stdio.h>
#include <errno.h>

int main(void)
{   FILE *piped_file;
    char pipestr[512];
    int  i = 0;

    while (i < 512)
    {
       sprintf(pipestr,"cat test.c");

       printf("\rtry %d",i);
       piped_file = popen(pipestr,"r");

       if (piped_file == NULL)
       {   perror("Pipe open");
           printf("Error after testopen nr %d.\n",i);
           return errno;
       }

       fgets(pipestr,511,piped_file);

       while (!feof(piped_file))
       {
           fgets(pipestr,511,piped_file);
       }

       pclose(piped_file);
       i++;
    }
    return 0;

}

*_*_*_*_*_*

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".