43 #include <sys/types.h> 48 #include "ununpack-ar.h" 49 #include "ununpack-disk.h" 50 #include "ununpack-iso.h" 52 #define Last(x) (x)[strlen(x)-1] 74 typedef enum cmdtype cmdtype;
96 char ChildRecurse[FILENAME_MAX+1];
101 struct stat ChildStat;
122 char Source[FILENAME_MAX];
123 char Partdir[FILENAME_MAX];
124 char Partname[FILENAME_MAX];
125 char PartnameNew[FILENAME_MAX];
168 int TaintString (
char *Dest,
int DestLen,
char *
Src,
int ProtectQuotes,
char *Replace);
169 extern int Prune (
char *Fname,
struct stat Stat);
170 extern int MkDirs (
char *Fname);
171 extern int MkDir (
char *Fname);
172 extern int IsDir (
char *Fname);
174 int IsFile (
char *Fname,
int Link);
175 int ReadLine (FILE *Fin,
char *Line,
int MaxLine);
185 void SetDir (
char *Dest,
int DestLen,
char *Smain,
char *Sfile);
192 void Usage (
char *Name,
char *Version);
193 void deleteTmpFiles(
char *dir);
char * PathCheck(char *DirPath)
Check if path contains a "%U" or "%H". If so, substitute a unique ID for U.
int Quiet
Run in quiet mode?
int ParentWait()
Wait for a child. Sets child status.
Queue for files to be unpacked.
Structure for storing information about a particular file.
void CopyFile(char *Source, char *Type, char *Name)
int RemoveDir(char *dirpath)
Remove all files under dirpath (rm -rf)
int IsFile(long mode)
Check if the pfile_id is a file.
int DisplayContainerInfo(ContainerInfo *CI, int Cmd)
Print what can be printed in XML.
int IsDir(char *Fname)
Given a filename, is it a directory?
int IsInflatedFile(char *FileName, int InflateSize)
Test if the file is a compression bomb.
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! ...
int IsDebianSourceFile(char *Filename)
Read file to see if it is a Debian source file.
int MkDir(char *Fname)
Smart mkdir.
int FindCmd(char *Filename)
Given a file name, determine the type of extraction command. This uses Magic.
void SetDir(char *Dest, int DestLen, char *Smain, char *Sfile)
Set a destination directory name.
static char * Src
Souce location.
void RemovePostfix(char *Name)
get rid of the postfix
Command table's single row.
void SQLNoticeProcessor(void *arg, const char *message)
Dummy postgresql notice processor. This prevents Notices from being written to stderr.
int IsExe(char *Exe, int Quiet)
Check if the executable exists.
static char * Dst
Destination location.
dirlist * MakeDirList(char *Fullname)
Create a list of files in a directory.
Usage()
Print Usage statement.
The main FOSSology C library.
void CheckCommands(int Show)
Make sure all commands are usable.
char * NewDir
Test result directory.
int Prune(char *Fname, struct stat Stat)
Given a filename and its stat, prune it.
int AddToRepository(ContainerInfo *CI, char *Fuid, int Mask)
Add a ContainerInfo record to the repository AND to the database.
void FreeDirList(dirlist *DL)
Free a list of files in a directory list.
char * TaintString(char *S)
Create a string with taint quoting.
void TraverseChild(int Index, ContainerInfo *CI, char *NewDir)
Called by exec'd child to process.
int RunCommand(char *Cmd, char *CmdPre, char *File, char *CmdPost, char *Out, char *Where)
Try a command and return command code.
int ReadLine(FILE *Fin, char *Line, int MaxLine)
int MkDirs(char *Fname)
Same as command-line "mkdir -p".
int DBInsertUploadTree(ContainerInfo *CI, int Mask)
Insert an UploadTree record.
void InitCmd()
Initialize the metahandler CMD table.
void TraverseStart(char *Filename, char *Label, char *NewDir, int Recurse)
Find all files (assuming a directory) and process (unpack) all of them.
void SafeExit(int rc)
Close scheduler and database connections, then exit.
int Recurse
Level of unpack recursion. Default to infinite.
int InitMagic()
Open and load Magic file Initializes global MagicCookie.
void DebugContainerInfo(ContainerInfo *CI)
Print a ContainerInfo structure.
int DBInsertPfile(ContainerInfo *CI, char *Fuid)
Insert a Pfile record. Sets the pfile_pk in CI.