FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
Traverse directories. More...
Go to the source code of this file.
Functions | |
void | TraverseStart (char *Filename, char *Label, char *NewDir, int Recurse) |
Find all files (assuming a directory) and process (unpack) all of them. More... | |
void | TraverseChild (int Index, ContainerInfo *CI, char *NewDir) |
Called by exec'd child to process. More... | |
int | CountFilename (char *Pathname, char *Dirname) |
Count the number of times Dirname appears in Pathname This is used to limit recursion in test archives that infinitely recurse. More... | |
int | Traverse (char *Filename, char *Basename, char *Label, char *NewDir, int Recurse, ParentInfo *PI) |
Find all files, traverse all directories. This is a depth-first search, in inode order! More... | |
Traverse directories.
Definition in file traverse.c.
int CountFilename | ( | char * | Pathname, |
char * | Dirname | ||
) |
Count the number of times Dirname appears in Pathname This is used to limit recursion in test archives that infinitely recurse.
Pathname | Pathname of file to process |
Dirname | Directory name to search for |
Full Dirname (includes forward and trailing slashes and null terminator)
Definition at line 238 of file traverse.c.
int Traverse | ( | char * | Filename, |
char * | Basename, | ||
char * | Label, | ||
char * | NewDir, | ||
int | Recurse, | ||
ParentInfo * | PI | ||
) |
Find all files, traverse all directories. This is a depth-first search, in inode order!
Filename | Pathname of file to process |
Basename | Optional basename() of Filename |
Label | is used for debugging. |
NewDir | Optional, specifies an alternate directory to extract to. Default (NewDir==NULL) is to extract to the same directory as Filename. |
Recurse | >0 to recurse |
PI | ParentInfo |
Definition at line 275 of file traverse.c.
void TraverseChild | ( | int | Index, |
ContainerInfo * | CI, | ||
char * | NewDir | ||
) |
Called by exec'd child to process.
The child never leaves here! It calls EXIT! Exit is 0 on success, non-zero on failure.
Index | Child index into the queue table |
CI | The ContainerInfo |
NewDir | Optional, specifies an alternate directory to extract to. |
If the file processed is one original uploaded file and it is an archive, also using repository, need to reset the file name in the archive, if do not reset, for the gz Z bz2 archives, the file name in the archive is sha1.md5.size file name, that is:
For example:
so in order to get the original file name(CI->PartnameNew): we need get the upload archive name first, then get rid of the postfix.
For example: for test.gz, get rid of .gz, get the original file name 'test', replace sha1.md5.size file name with 'test'.
If the file processed is a sub-archive, in the other words, it is part of other archive, or not using repository, need get rid of the postfix two time, for example:
Definition at line 96 of file traverse.c.
void TraverseStart | ( | char * | Filename, |
char * | Label, | ||
char * | NewDir, | ||
int | Recurse | ||
) |
Find all files (assuming a directory) and process (unpack) all of them.
Filename | Pathname of file to process |
Label | String displayed by debug messages |
NewDir | Optional, specifies an alternate directory to extract to. |
Recurse | >0 to recurse |
Definition at line 23 of file traverse.c.