-
Notifications
You must be signed in to change notification settings - Fork 0
/
process.c
158 lines (135 loc) · 3.87 KB
/
process.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/***************************************************************
Copyright (C) 2006-2011 Hewlett-Packard Development Company, L.P.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
***************************************************************/
/**
* \file
* \brief some common functions that process the files for scanning
*/
#include "nomos.h"
#include "process.h"
#include "licenses.h"
#include "util.h"
#include "list.h"
#ifdef MEMSTATS
extern void memStats();
#endif /* MEMSTATS */
#define BOGUS_MD5 "wwww0001xxxx0002yyyy0004zzzz0008"
/**
* processNonPackageFiles
*
* \callgraph
*/
static void processNonPackagedFiles()
{
/* item_t *p; doesn't look like this is used */
#if defined(PROC_TRACE) || defined(UNPACK_DEBUG)
traceFunc("== processNonPackagedFiles()\n");
#endif /* PROC_TRACE || UNPACK_DEBUG */
/*
* If there are unused/unreferenced source archives, they need to be
* processed individually. Create the global 'unused archives' list
* and hand it off to be processed.
*/
#ifdef UNPACK_DEBUG
listDump(&cur.regfList, NO);
#endif /* UNPACK_DEBUG */
if (!cur.regfList.used) {
printf("No-data!\n");
return;
} else {
/* CDB *cur.basename = NULL_CHAR; */
processRegularFiles();
/* since p isn't used, reduce the following to just the listGetItem
since it mods the global cur
p = listGetItem(&cur.fLicFoundMap, BOGUS_MD5);
p->buf = copyString(cur.compLic, MTAG_COMPLIC);
p->refCount++;
p->buf = copyString(BOGUS_MD5, MTAG_MD5SUM);
*/
listGetItem(&cur.fLicFoundMap, BOGUS_MD5);
}
return;
}
#ifdef notdef
/**
* \brief Remove the line at textp+offset from the buffer
*/
void stripLine(char *textp, int offset, int size)
{
char *start, *end;
extern char *findBol();
#ifdef PROC_TRACE
traceFunc("== stripLine(%s, %d, %d)\n", textp, offset, size);
#endif /* PROC_TRACE */
if ((end = findEol((char *)(textp+offset))) == NULL_STR) {
Assert(NO, "No EOL found!");
}
if ((start = findBol((char *)(textp+offset), textp)) == NULL_STR) {
Assert(NO, "No BOL found!");
}
#ifdef DEBUG
printf("Textp %p start %p end %p\n", textp, start, end);
printf("@START(%d): %s", strlen(start), start);
printf("@END+1(%d): %s", strlen(end+1), end+1);
#endif /* DEBUG */
if (*(end+1) == NULL_CHAR) { /* EOF */
*start = NULL_CHAR;
}
else {
#ifdef DEBUG
printf("MOVE %d bytes\n", size-(end-textp));
#endif /* DEBUG */
(void) memmove(start, (char *)(end+1),
(size_t)((size)-(end-textp)));
}
#ifdef DEBUG
printf("FINISH: @START(%d): %s", strlen(start), start);
#endif /* DEBUG */
return;
}
#endif /* notdef */
/**
* processRawSource
*
* \callgraph
*
*/
void processRawSource()
{
#ifdef PROC_TRACE
traceFunc("== processRawSource()\n");
#endif /* PROC_TRACE */
#ifdef PACKAGE_DEBUG
listDump(&cur.regfList, NO);
#endif /* PACKAGE_DEBUG */
processNonPackagedFiles();
return;
}
/**
* processRegularFiles
* \brief Process a list of regular files.
*
* \callgraph
* CDB - This really isn't a list, there should only be a single file in
* regfList.
*/
void processRegularFiles()
{
#ifdef PROC_TRACE
traceFunc("== processRegularFiles()\n");
#endif /* PROC_TRACE */
/* CDB (void) sprintf(cur.basename, "misc-files"); */
/* loop through the list here -- and delete files with link-count >1? */
licenseScan(&cur.regfList);
return;
}