FOSSology  4.4.0
Open Source License Compliance by Open Source Software
adj2nest.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <signal.h>
#include <libgen.h>
#include "libfossology.h"
Include dependency graph for adj2nest.c:

Go to the source code of this file.

Classes

struct  uploadtree
 Contains information required by uploadtree elements. More...
 

Macros

#define MAXCMD   4096
 
#define myBUFSIZ   2048
 

Typedefs

typedef struct uploadtree uploadtree
 

Functions

void WalkTree (long Index, long Depth)
 
void SetParent (long Parent, long Child)
 
void LoadAdj (long UploadPk)
 
void RunAllNew ()
 
void ListUploads ()
 
int MatchField (char *Field, char *S)
 
char * SkipFieldValue (char *S)
 
char * UntaintValue (char *Sin, char *Sout)
 
int SetParm (char *ParmName, char *Parm)
 
int UpdateUpload (long UploadPk)
 Finish updating the upload record and permissions data. More...
 
void Usage (char *Name)
 
int main (int argc, char *argv[])
 

Variables

char SQL [256]
 SQL query to execute.
 
char BuildVersion [] ="adj2nest build version: NULL.\n"
 
PGconn * pgConn = NULL
 Database connection. More...
 
uploadtreeTree =NULL
 
char * uploadtree_tablename
 upload.uploadtree_tablename More...
 
long TreeSize =0
 
long TreeSet =0
 
long SetNum =0
 
int isBigUpload =0
 

Function Documentation

◆ LoadAdj()

void LoadAdj ( long  UploadPk)

Given an upload_pk, load the adjacency table. This is in the format "every child knows its parent". Returns the adjacency tree.

Parameters
UploadPkUpload ID to be aj2nested

Definition at line 219 of file adj2nest.c.

◆ SetParent()

void SetParent ( long  Parent,
long  Child 
)

Given a parent and a child, add the child to the parent's chain. NOTE: This is iterative!

Parameters
ParentID of the parent to add child.
ChildID of the child to be added.

Definition at line 156 of file adj2nest.c.

◆ UpdateUpload()

int UpdateUpload ( long  UploadPk)

Finish updating the upload record and permissions data.

Parameters
UploadPkUpload ID to be updated
Returns
int -1 failure, 0 success

Definition at line 536 of file adj2nest.c.

◆ WalkTree()

void WalkTree ( long  Index,
long  Depth 
)

Given a tree, recursively walk it.

Parameters
IndexID of the uploadtree element
DepthMaximum depth for the recursion

Definition at line 114 of file adj2nest.c.

Variable Documentation

◆ pgConn

PGconn* pgConn = NULL

Database connection.

DB connection.

Definition at line 86 of file adj2nest.c.

◆ SetNum

long SetNum =0

index for tracking set numbers

Definition at line 103 of file adj2nest.c.

◆ TreeSet

long TreeSet =0

index for inserting the next child

Definition at line 102 of file adj2nest.c.

◆ uploadtree_tablename

char* uploadtree_tablename

upload.uploadtree_tablename

Name of DB table (uploadtree, uploadtree_a,...)

Definition at line 100 of file adj2nest.c.