|
From: Ethan M. <eam...@gm...> - 2017-07-27 23:08:37
|
On Thu, Jul 27, 2017 at 3:38 PM, Dave Horsfall <da...@ho...> wrote:
> On Thu, 27 Jul 2017, sfeam via gnuplot-info wrote:
>
> The issue is not the missing file per se, it's that apparently Windows
>> considers this sufficiently severe to return an error code from the "dir"
>> command. It isn't a problem on unix/linux, where "ls" will print a warning
>> message but returns success. So I imagine it would be sufficient to wrap
>> your "dir" command in a script MYDIR that always returns success even if
>> the real "dir" fails:
>>
>
> Unix (FreeBSD):
>
> aneurin% ls fred
> ls: fred: No such file or directory
> aneurin% echo $?
> 1
>
>
> Linux (Debian):
>
> dave@debbie:~$ ls fred
> ls: cannot access fred: No such file or directory
> dave@debbie:~$ echo $?
> 2
>
>
> You were saying
The question is what popen() returns. Yes I was sloppy in saying "what ls
returns" rather than "what popen("ls","r") returns" but it should have been
clear from the context. Here it is with a debug printout in place:
gnuplot>
gnuplot> foo = system("ls *.c")
popen("ls *.c","r") returns 15160096
gnuplot> foo = system("ls fred")
popen("ls fred","r") returns 15169872
ls: cannot access fred: No such file or directory
man page for "popen" says
RETURN VALUE
The popen() function returns NULL if the fork(2) or pipe(2) calls
fail, or
if it cannot allocate memory.
man page for "pipe" says
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno
is set
appropriately.
Clear as mud. But operationally is evident that pipe() returns zero from
"ls fred"
> --
> Dave Horsfall DTM (VK2KFU) "Those who don't understand security will
> suffer."
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> Membership management via: https://lists.sourceforge.net/
> lists/listinfo/gnuplot-info
>
|