|  | FOSSology
    3.2.0rc1
    Open Source License Compliance by Open Source Software | 
The word count agent, count the word count for one file. More...
#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <string.h>#include <ctype.h>#include <signal.h>#include <libgen.h>#include "libfossology.h"
Go to the source code of this file.
| Macros | |
| #define | MAXCMD 2048 | 
| Functions | |
| int | IsFile (long mode) | 
| Check if the pfile_id is a file.  More... | |
| int | ProcessData (long PfileFk, char *Pfile) | 
| This function does the work.  More... | |
| void | Usage (char *Name) | 
| Say how to run this program.  More... | |
| int | main (int argc, char *argv[]) | 
| main function  More... | |
| Variables | |
| void * | pgConn = NULL | 
| Database connection.  More... | |
| long | GlobalPfileFk =-1 | 
| char | GlobalPfile [MAXCMD] | 
The word count agent, count the word count for one file.
Definition in file wc_agent.c.
| int IsFile | ( | long | mode | ) | 
Check if the pfile_id is a file.
The pfile (sha1.md5.len) to process
| mode | mode of the pfile, if is from ufile_mode in table upload_tree container=1<<29, artifact=1<<28, project=1<<27, replica(same pfile)=1<<26, package=1<<25,directory=1<<18 | 
if ((mode & 1<<18) + (mode & 0040000) != 0), is dir if ((mode & 1<<28) != 0), is artifact if ((mode & 1<<29) != 0), is container a file is not dir, artifact, and container
Definition at line 67 of file wc_agent.c.
| int main | ( | int | argc, | 
| char * | argv[] | ||
| ) | 
main function
< is a file?
Definition at line 178 of file wc_agent.c.
| int ProcessData | ( | long | PfileFk, | 
| char * | Pfile | ||
| ) | 
This function does the work.
In this example, we'll just run wc and store the results in the database.
| PfileFk | pfile id | 
| Pfile | the file path in repo | 
Definition at line 91 of file wc_agent.c.
| void Usage | ( | char * | Name | ) | 
Say how to run this program.
Many agents permit running from the command-line for testing. At minimum, you need "-i" to initialize the DB and exit.
Definition at line 166 of file wc_agent.c.
| char GlobalPfile[MAXCMD] | 
The pfile_fk to process
Definition at line 57 of file wc_agent.c.
| void* pgConn = NULL |