You are not logged in.

#1 2005-04-28 21:03:40

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

i hate glob()

ok, anyone here with experience using glob?  On occasion it returns -1, which isn't a defined return code, so I have no clue where this comes from... adding an errofunc doesn't help...

Offline

#2 2005-04-28 21:28:24

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: i hate glob()

I have no clue, but I found this..

If glob succeeds, it returns 0. Otherwise, it returns one of these error codes:

GLOB_ABORTED
    There was an error opening a directory, and you used the flag GLOB_ERR or your specified errfunc returned a nonzero value. for an explanation of the GLOB_ERR flag and errfunc.
GLOB_NOMATCH
    The pattern didn't match any existing files. If you use the GLOB_NOCHECK flag, then you never get this error code, because that flag tells glob to pretend that the pattern matched at least one file.
GLOB_NOSPACE
    It was impossible to allocate memory to hold the result.

http://www.gnu.org/software/libc/manual … -Glob.html


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2005-04-28 21:38:22

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: i hate glob()

yeah, from the header:

/* Error returns from `glob'.  */
#define  GLOB_NOSPACE   1  /* Ran out of memory.  */
#define  GLOB_ABORTED   2  /* Read error.  */
#define  GLOB_NOMATCH   3  /* No matches found.  */
#define  GLOB_NOSYS       4   /* Not implemented.  */

... but no "-1" that's why I'm so confused.... I understand it failed, but there's no indication as to why...

Offline

#4 2005-04-28 23:15:59

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: i hate glob()

Try checking errno...

Offline

#5 2005-04-29 03:34:48

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: i hate glob()

i3839 wrote:

Try checking errno...

yeah, I looked through it... if the error returned is not from one of those specified, it's from one of the underlying opendir/readdir/closedir calls... makes sense...

Offline

Board footer

Powered by FluxBB