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