From maintainers-request at octave dot org Thu Sep 22 21:06:17 2005 Subject: Re: popen2 example gives no output From: Bill Denney To: "John W. Eaton" cc: octave maintainers mailing list , Brian Blais Date: Thu, 22 Sep 2005 22:02:37 -0400 (EDT) On Thu, 22 Sep 2005, John W. Eaton wrote: > The simple solution to associating the list of names and error codes > would be to have just the EXXX values that are defined by POSIX > (http://www.opengroup.org/onlinepubs/009695399/basedefs/errno.h.html) > but it seems that it would be better to have whatever symbolic names > are available on a given system. To implement this, we would need to > do some grepping through errno.h (and any files it includes). That > seems ugly, and duplicates what Perl (at least) already does. So it > seems to me that it would be cleaner to use Perl to generate the list > for Octave, when Octave is built. That would introduce a build > dependency on Perl. Is that a problem? Perhaps we could fall back on > the list of names from POSIX if Perl is not available? Otherwise, we > would have to duplicate a lot of fairly tricky code, and that seems > even less desirable to me. > > Can some Perl guru on the list tell me how to use the Errno module in > Perl to generate a list of all the symbolic error codes, as strings? I think that this is what you're asking for: === Begin Script #!/usr/bin/perl foreach my $key (keys(%!)) { print "$key\n"; } === End Script I don't know all the C that you're wanting to put in there, but if it's just what you wrote below, this script will do it (just for the static errno_name_value_struct errno_codes part): === Begin Script #!/usr/bin/perl foreach my $key (keys(%!)) { print " { \"$key\", $key },\n"; } === End Script Also, I thought that Perl was already a build dependency for the lsode_options (and *_options) code, so adding this shouldn't really be an issue. Bill -- "Clothes make the man. Naked people have little or no influence on society." -- Mark Twain