static void getdir( struct charblob * cb, struct one_wire_query * owq ) { if ( FS_dir( getdircallback, cb, PN(owq) ) != 0 ) { CharblobClear( cb ) ; } else if ( CharblobLength(cb) == 0 ) { CharblobAddChar( '\0', cb) ; } }
/* Get a directory, returning a copy of the contents in *buffer (which must be free-ed elsewhere) return length of string, or <0 for error *buffer will be returned as NULL on error */ static void getdircallback( void * v, const struct parsedname * const pn_entry ) { struct charblob * cb = v ; const char * buf = FS_DirName(pn_entry) ; CharblobAdd( buf, strlen(buf), cb ) ; if ( IsDir(pn_entry) ) { CharblobAddChar( '/', cb ) ; } }
static int getdir( struct charblob * cb, struct one_wire_query * owq ) { int ret = 0; if ( (ret = FS_dir( getdircallback, cb, PN(owq) )) != 0 ) { CharblobClear( cb ) ; } else if ( CharblobLength(cb) == 0 ) { CharblobAddChar( '\0', cb) ; } return ret; }