FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
process.c
Go to the documentation of this file.
1 /***************************************************************
2  Copyright (C) 2006-2011 Hewlett-Packard Development Company, L.P.
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License
6  version 2 as published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 
17  ***************************************************************/
23 #include "nomos.h"
24 #include "process.h"
25 #include "licenses.h"
26 #include "util.h"
27 #include "list.h"
28 
29 #ifdef MEMSTATS
30 extern void memStats();
31 #endif /* MEMSTATS */
32 
33 #define BOGUS_MD5 "wwww0001xxxx0002yyyy0004zzzz0008"
34 
35 
42 {
43  /* item_t *p; doesn't look like this is used */
44 
45 #if defined(PROC_TRACE) || defined(UNPACK_DEBUG)
46  traceFunc("== processNonPackagedFiles()\n");
47 #endif /* PROC_TRACE || UNPACK_DEBUG */
48 
49  /*
50  * If there are unused/unreferenced source archives, they need to be
51  * processed individually. Create the global 'unused archives' list
52  * and hand it off to be processed.
53  */
54 #ifdef UNPACK_DEBUG
55  listDump(&cur.regfList, NO);
56 #endif /* UNPACK_DEBUG */
57  if (!cur.regfList.used) {
58  printf("No-data!\n");
59  return;
60  } else {
61  /* CDB *cur.basename = NULL_CHAR; */
63  /* since p isn't used, reduce the following to just the listGetItem
64  since it mods the global cur
65  p = listGetItem(&cur.fLicFoundMap, BOGUS_MD5);
66  p->buf = copyString(cur.compLic, MTAG_COMPLIC);
67  p->refCount++;
68  p->buf = copyString(BOGUS_MD5, MTAG_MD5SUM);
69  */
70  listGetItem(&cur.fLicFoundMap, BOGUS_MD5);
71  }
72  return;
73 }
74 
75 
76 
77 #ifdef notdef
78 
81 void stripLine(char *textp, int offset, int size)
82 {
83  char *start, *end;
84  extern char *findBol();
85 
86 #ifdef PROC_TRACE
87  traceFunc("== stripLine(%s, %d, %d)\n", textp, offset, size);
88 #endif /* PROC_TRACE */
89 
90  if ((end = findEol((char *)(textp+offset))) == NULL_STR) {
91  Assert(NO, "No EOL found!");
92  }
93  if ((start = findBol((char *)(textp+offset), textp)) == NULL_STR) {
94  Assert(NO, "No BOL found!");
95  }
96 #ifdef DEBUG
97  printf("Textp %p start %p end %p\n", textp, start, end);
98  printf("@START(%d): %s", strlen(start), start);
99  printf("@END+1(%d): %s", strlen(end+1), end+1);
100 #endif /* DEBUG */
101  if (*(end+1) == NULL_CHAR) { /* EOF */
102  *start = NULL_CHAR;
103  }
104  else {
105 #ifdef DEBUG
106  printf("MOVE %d bytes\n", size-(end-textp));
107 #endif /* DEBUG */
108  (void) memmove(start, (char *)(end+1),
109  (size_t)((size)-(end-textp)));
110  }
111 #ifdef DEBUG
112  printf("FINISH: @START(%d): %s", strlen(start), start);
113 #endif /* DEBUG */
114  return;
115 }
116 #endif /* notdef */
117 
118 
126 {
127 #ifdef PROC_TRACE
128  traceFunc("== processRawSource()\n");
129 #endif /* PROC_TRACE */
130 
131 #ifdef PACKAGE_DEBUG
132  listDump(&cur.regfList, NO);
133 #endif /* PACKAGE_DEBUG */
134 
136  return;
137 }
138 
148 {
149 #ifdef PROC_TRACE
150  traceFunc("== processRegularFiles()\n");
151 #endif /* PROC_TRACE */
152 
153  /* CDB (void) sprintf(cur.basename, "misc-files"); */
154  /* loop through the list here -- and delete files with link-count >1? */
155  licenseScan(&cur.regfList);
156  return;
157 }
158 
void processRegularFiles()
Process a list of regular files.
Definition: process.c:147
void licenseScan(list_t *licenseList)
scan the list for a license(s)
Definition: licenses.c:759
static void processNonPackagedFiles()
Definition: process.c:41
int used
Definition: nomos.h:323
void processRawSource()
Definition: process.c:125
item_t * listGetItem(list_t *l, char *s)
get an item from the itemlist. If the item is not in the itemlist, then add it to the itemlist...
Definition: list.c:259
#define NULL_CHAR
NULL character.
Definition: nomos.h:247
void Assert(int fatalFlag, const char *fmt,...)
Raise an assert.
Definition: util.c:1407
start($application)
start the application Assumes application is restartable via /etc/init.d/<script>. The application passed in should match the script name in /etc/init.d
Definition: pkgConfig.php:1225
#define NULL_STR
NULL string.
Definition: nomos.h:248
char * findEol(char *s)
Find first ROL in a string.
Definition: util.c:390
Nomos header file.
void listDump(list_t *l, int verbose)
print the passed in list
Definition: list.c:842
char * findBol(char *s, char *upperLimit)
Find Begin of Line in a string.
Definition: util.c:352
#define NO
Definition: nomos.h:184