[RFC] Suggested ways to remove the need for xm-go32.h

Corinna Vinschen vinschen@redhat.com
Thu Sep 23 08:02:00 GMT 2004


On Sep 23 02:30, Michael Chastain wrote:
> To avoid the wrapper function, perhaps probe for the modes at
> run time:
> 
>   static const char * read_mode = NULL;
> 
>   void set_read_mode ()
>   {
>     FILE * fp = NULL;
> 
>     if (read_mode == NULL)
>       {
> 	if ((fp = fopen ("/dev/null", "rb")) != NULL)
> 	  read_mode = "rb";
> 	else if ((fp = fopen ("/dev/null", "r")) != NULL)
> 	  read_mode = "r";
> 	else
> 	  some sort of error;
>       }
> 
>     if (fp != NULL)
>       {
> 	if (fclose(fp) != 0 )
> 	  error;
>       }
>   }

First I thought that's a good idea, but then again, it requires every
system to support /dev/null.  I'm not sure you'd find a filename which
all systems can agree to.

I guess a wrapper function would be the way to go here.


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.



More information about the Gdb-patches mailing list