FOSSology  4.4.0
Open Source License Compliance by Open Source Software
regexscan-Stage2.c File Reference

Stage 2 demonstration. More...

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <signal.h>
#include <libgen.h>
#include <regex.h>
#include <stdbool.h>
#include "libfossology.h"
Include dependency graph for regexscan-Stage2.c:

Go to the source code of this file.

Macros

#define MAXCMD   4096
 
#define myBUFSIZ   2048
 

Functions

int regexScan (char *regexStr, FILE *scanFilePtr, char *fileName)
 Regex scanner. More...
 
void Usage (char *Name)
 Say how to run this program. More...
 
int main (int argc, char *argv[])
 

Variables

char SQL [256]
 For DB. More...
 
PGconn * pgConn = NULL
 Database connection. More...
 

Detailed Description

Stage 2 demonstration.

This is stage 2 and demonstrates the fundamental agent requirements:

  1. Connect to database
  2. Connect to Scheduler
  3. Process -r as a regex argument
  4. Process filename and report regex scan results
  5. Terminate

Definition in file regexscan-Stage2.c.

Function Documentation

◆ regexScan()

int regexScan ( char *  regexStr,
FILE *  scanFilePtr,
char *  fileName 
)

Regex scanner.

Parameters
regexStrString containing the regex
scanFilePtrHandle for file to scan
fileNameString name of file to scan
Returns
0 = OK, otherwise error code

Definition at line 53 of file regexscan-Stage2.c.

◆ Usage()

void Usage ( char *  Name)

Say how to run this program.

Print usage of bucket agent

Parameters
NameAbsolute path of agent

Many agents permit running from the command-line for testing. At minimum, you need "-i" to initialize the DB and exit.

Say how to run this program.

Parameters
Name- the name of the executable, usually it is mimetype

Say how to run this program.

Parameters
NamePath to nomos binary

Usage():

Definition at line 119 of file regexscan-Stage2.c.

Variable Documentation

◆ pgConn

PGconn* pgConn = NULL

Database connection.

DB connection.

Database connection.

Definition at line 44 of file regexscan-Stage2.c.

◆ SQL

char SQL[256]

For DB.

SQL query to execute.

Definition at line 34 of file regexscan-Stage2.c.