Line 0
Link Here
|
|
|
1 |
diff -ruN ../0.4.0/libMG/src/libMG.h ./libMG/src/libMG.h |
2 |
--- ../0.4.0/libMG/src/libMG.h Sun Dec 11 17:39:06 2005 |
3 |
+++ ./libMG/src/libMG.h Tue Dec 13 07:39:00 2005 |
4 |
@@ -48,6 +48,7 @@ |
5 |
#include <sys/types.h> |
6 |
#include <sys/wait.h> |
7 |
#include <sysexits.h> |
8 |
+#include <time.h> |
9 |
#include <unistd.h> |
10 |
|
11 |
#include <sys/resource.h> |
12 |
@@ -155,6 +156,24 @@ |
13 |
while( fflush( stderr ) ); \ |
14 |
assert( 0 ); \ |
15 |
} |
16 |
+ |
17 |
+#define MGmSystem( command, environment ) \ |
18 |
+ MGm__pid = fork(); \ |
19 |
+ if( MGm__pid == 0 ) /* child */ \ |
20 |
+ { \ |
21 |
+ execve( command[0], command, environment ); \ |
22 |
+ _exit(127); \ |
23 |
+ } \ |
24 |
+ while( waitpid( MGm__pid, &MGm__forkStatus, 0 ) < 0 ) /* parent */ \ |
25 |
+ { \ |
26 |
+ if( WIFEXITED( MGm__forkStatus ) == 0 ) \ |
27 |
+ { \ |
28 |
+ fprintf( stderr, "%s error: command %s exited abnormally\n", id, command[0] ); \ |
29 |
+ while( fflush( stderr ) ); \ |
30 |
+ assert( 0 ); \ |
31 |
+ } \ |
32 |
+ } |
33 |
+ |
34 |
|
35 |
#define MGmFopen( fileStream, fileName, mode ) \ |
36 |
if( mode[0] == 'w' ) \ |
37 |
diff -ruN ../0.4.0/libMGPM/src/MGPMlogAdd.c ./libMGPM/src/MGPMlogAdd.c |
38 |
--- ../0.4.0/libMGPM/src/MGPMlogAdd.c Sun Dec 11 09:34:27 2005 |
39 |
+++ ./libMGPM/src/MGPMlogAdd.c Tue Dec 13 08:03:34 2005 |
40 |
@@ -34,6 +34,9 @@ |
41 |
{ |
42 |
FILE* logFileStream; |
43 |
char id[] = "MGPMlogAdd"; |
44 |
+ time_t timeObj; |
45 |
+ |
46 |
+ timeObj = time(NULL); |
47 |
|
48 |
if( property->log == 0 ) |
49 |
{ |
50 |
@@ -48,7 +51,8 @@ |
51 |
} |
52 |
|
53 |
MGmFopen( logFileStream, property->logFile->parent.path, "a" ); |
54 |
- fprintf( logFileStream, "%-35s %-30s\n %-35s %-35s %-30s\n\n", victemName, victemDir, crime, suspectName, suspectDir ); |
55 |
+ fprintf( logFileStream, "%s %-35s %-30s\n %-35s %-35s %-30s\n\n", |
56 |
+ ctime( &timeObj ), victemName, victemDir, crime, suspectName, suspectDir ); |
57 |
fclose( logFileStream ); |
58 |
return( 0 ); |
59 |
} |
60 |
diff -ruN ../0.4.0/libMGPM/src/MGPMlogDestroy.c ./libMGPM/src/MGPMlogDestroy.c |
61 |
--- ../0.4.0/libMGPM/src/MGPMlogDestroy.c Sun Dec 11 09:33:14 2005 |
62 |
+++ ./libMGPM/src/MGPMlogDestroy.c Tue Dec 13 08:03:40 2005 |
63 |
@@ -32,9 +32,14 @@ |
64 |
|
65 |
int MGPMlogDestroy( structProperty* property ) |
66 |
{ |
67 |
+ FILE* logHandle; |
68 |
char id[] = "MGPMlogDestroy"; |
69 |
char* command = NULL; |
70 |
|
71 |
+ time_t timeObj; |
72 |
+ |
73 |
+ timeObj = time(NULL); |
74 |
+ |
75 |
if( property->log == 0 ) |
76 |
{ |
77 |
return( 1 ); |
78 |
@@ -49,11 +54,11 @@ |
79 |
assert(0); |
80 |
} |
81 |
|
82 |
- MGmStrcpy( command, "echo \" end of log \" " ); |
83 |
- MGmStrcat( command, " >> /var/log/portmanager.log" ); |
84 |
- system( command ); |
85 |
- MGmStrcpy( command, "date >> /var/log/portmanager.log" ); |
86 |
- system( command ); |
87 |
+ |
88 |
+ MGmFopen( logHandle, "/var/log/portmanager.log", "a" ); |
89 |
+ fprintf( logHandle, "%s end of log\n", ctime( &timeObj ) ); |
90 |
+ |
91 |
+ fclose( logHandle ); |
92 |
|
93 |
/* 666 indicates demise of this object */ |
94 |
property->logFile->parent.type = 666; |
95 |
diff -ruN ../0.4.0/libMGPM/src/MGPMrCommandLine.c ./libMGPM/src/MGPMrCommandLine.c |
96 |
--- ../0.4.0/libMGPM/src/MGPMrCommandLine.c Sun Dec 11 09:41:53 2005 |
97 |
+++ ./libMGPM/src/MGPMrCommandLine.c Mon Dec 12 16:30:28 2005 |
98 |
@@ -64,7 +64,7 @@ |
99 |
int rParseCommandLine( structProperty* property, int argc, char** argv ); |
100 |
int rSetXtermTitle( void ); |
101 |
|
102 |
-int MGPMrCommandLine( int argc, char** argv ) |
103 |
+int MGPMrCommandLine( int argc, char** argv, char** argp ) |
104 |
{ |
105 |
DIR* dirStream = NULL; |
106 |
char id[] = "MGPMrCommandLine"; |
107 |
@@ -76,6 +76,9 @@ |
108 |
|
109 |
signal( SIGINT, MGPMrCatchSignal ); |
110 |
|
111 |
+ |
112 |
+ property.argp = argp; |
113 |
+ |
114 |
path = (char*)calloc( 511, 1 ); |
115 |
|
116 |
/* |
117 |
@@ -260,7 +263,7 @@ |
118 |
buffer = calloc( bufferSize, 1 ); |
119 |
MGmFopen( handle, property->helpFile, "r" ); |
120 |
fread( buffer, bufferSize, 1, handle ); |
121 |
- fprintf( stdout, buffer ); |
122 |
+ fprintf( stdout, "%s\n", buffer ); |
123 |
free( buffer ); |
124 |
fclose( handle ); |
125 |
return( 0 ); |
126 |
diff -ruN ../0.4.0/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c |
127 |
--- ../0.4.0/libMGPM/src/MGPMrUpdate.c Sun Dec 11 21:12:02 2005 |
128 |
+++ ./libMGPM/src/MGPMrUpdate.c Tue Dec 13 05:48:01 2005 |
129 |
@@ -31,6 +31,10 @@ |
130 |
#define OK 0 |
131 |
#include <libMGPM.h> |
132 |
|
133 |
+ |
134 |
+int MGrIfDirEntry( char* dirName, char* fileName ); |
135 |
+ |
136 |
+ |
137 |
int rBsdPortMkPatch( structProperty* property, structLocalProperty* localProperty ); |
138 |
int rCleanDir( char* portDir, char* workDir ); |
139 |
int rCleanUp( structProperty* property, structLocalProperty* localProperty ); |
140 |
@@ -48,12 +52,10 @@ |
141 |
char backUp[] = "--back-up"; |
142 |
char bu[] = "-bu"; |
143 |
char exact[] = "exact"; |
144 |
- char failMsg1[] = "failed during make, adding to ignore.db"; |
145 |
char id[] = "MGPMrUpdate"; |
146 |
char ip[] = "-ip"; |
147 |
char l[] = "-l"; |
148 |
char log[] = "--log"; |
149 |
- char space[] = " "; |
150 |
char strike[] = "0"; |
151 |
char y[] = "-y"; |
152 |
char yes[] = "--yes"; |
153 |
@@ -66,6 +68,7 @@ |
154 |
char* stinker = NULL; |
155 |
char* stopPortDirPtr = NULL; |
156 |
char* strikePtr = NULL; |
157 |
+ char** cmd; |
158 |
int answer = 1; |
159 |
int availableDependenciesDbIDX = 0; |
160 |
int availableDependenciesDbQTY = 0; |
161 |
@@ -80,7 +83,13 @@ |
162 |
|
163 |
property->optionsChanged = 0; |
164 |
|
165 |
- localProperty.options = calloc( MAXBUFFERSIZE, 1 ); |
166 |
+ localProperty.environment = malloc( sizeof( char** ) * 4 ); |
167 |
+ localProperty.environment[0] = malloc( MAXSTRINGSIZE ); |
168 |
+ localProperty.environment[1] = malloc( MAXSTRINGSIZE ); |
169 |
+ localProperty.environment[2] = malloc( MAXSTRINGSIZE ); |
170 |
+ localProperty.environment[3] = 0; |
171 |
+ |
172 |
+ localProperty.CURDIR = calloc( MAXSTRINGSIZE, 1 ); |
173 |
localProperty.afterOptionsFileSize = calloc( MAXSTRINGSIZE, 1 ); |
174 |
localProperty.afterOptionsFileTime = calloc( MAXSTRINGSIZE, 1 ); |
175 |
localProperty.batchCheck = calloc( MAXSTRINGSIZE, 1 ); |
176 |
@@ -92,6 +101,7 @@ |
177 |
localProperty.installedPortName = calloc( MAXSTRINGSIZE, 1 ); |
178 |
localProperty.newPortDir = calloc( MAXSTRINGSIZE, 1 ); |
179 |
localProperty.newPortName = calloc( MAXSTRINGSIZE, 1 ); |
180 |
+ localProperty.options = calloc( MAXBUFFERSIZE, 1 ); |
181 |
localProperty.optionsCheck = calloc( MAXSTRINGSIZE, 1 ); |
182 |
localProperty.optionsDir = calloc( MAXSTRINGSIZE, 1 ); |
183 |
localProperty.startPortCmd = calloc( MAXSTRINGSIZE, 1 ); |
184 |
@@ -99,6 +109,7 @@ |
185 |
localProperty.stopPortCmd = calloc( MAXSTRINGSIZE, 1 ); |
186 |
localProperty.stopPortDir = calloc( MAXSTRINGSIZE, 1 ); |
187 |
localProperty.workDir = calloc( MAXSTRINGSIZE, 1 ); |
188 |
+ localProperty.workFullPath = calloc( MAXSTRINGSIZE, 1 ); |
189 |
|
190 |
property->availableDependenciesDb = MGdbOpen( property->availableDependenciesDbFileName ); |
191 |
property->availablePortsDb = MGdbOpen( property->availablePortsDbFileName ); |
192 |
@@ -111,15 +122,39 @@ |
193 |
if( ( strcmp( "/sysutils/portmanager", oldPortDir ) == 0 || strcmp( "/local/sysutils/portmanager", oldPortDir ) == 0 ) && property->forced ) |
194 |
{ |
195 |
fprintf( stdout, "ignoring portmanager, will not self update in forced mode by design\n" ); |
196 |
+ while( fflush( stdout ) ); |
197 |
MGPMlogAdd( property, "ignoring portmanager ", "will not self update in forced mode by design", |
198 |
oldPortDir, "added to ignore.db", " " ); |
199 |
|
200 |
MGdbAdd( property->ignoreDb, oldPortDir, "skipping portmanager, will not self update in forced mode by design\n", NULL ); |
201 |
- while( fflush( stdout ) ); |
202 |
rCleanUp( property, &localProperty ); |
203 |
return( 0 ); |
204 |
} |
205 |
|
206 |
+ /* |
207 |
+ * setup environment |
208 |
+ */ |
209 |
+ MGmStrcpy( localProperty.environment[0], "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin" ); |
210 |
+ |
211 |
+ if( getenv( "CCACHE_DIR" ) != NULL ) |
212 |
+ { |
213 |
+ MGmStrcpy( localProperty.environment[1], "CCACHE_DIR=" ); |
214 |
+ MGmStrcat( localProperty.environment[1], getenv( "CCACHE_DIR" ) ); |
215 |
+ } |
216 |
+ else |
217 |
+ { |
218 |
+ localProperty.environment[1][0] = 0; |
219 |
+ } |
220 |
+ |
221 |
+ if( getenv( "CCACHE_PATH" ) != NULL ) |
222 |
+ { |
223 |
+ MGmStrcpy( localProperty.environment[2], "CCACHE_PATH=/usr/bin:/usr/local/bin" ); |
224 |
+ } |
225 |
+ else |
226 |
+ { |
227 |
+ localProperty.environment[2][0] = 0; |
228 |
+ } |
229 |
+ |
230 |
/* |
231 |
* test for bsd.ports.mk patch |
232 |
*/ |
233 |
@@ -128,6 +163,30 @@ |
234 |
property->bsdPortMkPatched = rBsdPortMkPatch( property, &localProperty ); |
235 |
} |
236 |
|
237 |
+ /* |
238 |
+ * store localProperty.CURDIR |
239 |
+ */ |
240 |
+ MGmStrcpy( localProperty.CURDIR, "cd " ); |
241 |
+ MGmStrcat( localProperty.CURDIR, PORTSDIR ); |
242 |
+ MGmStrcat( localProperty.CURDIR, oldPortDir ); |
243 |
+ MGmStrcat( localProperty.CURDIR, " && make -V .CURDIR" ); |
244 |
+ localProperty.buffer[0] = 0; |
245 |
+ pHandle = popen( localProperty.CURDIR, "r" ); |
246 |
+ fread( localProperty.buffer, MAXBUFFERSIZE, 1, pHandle ); |
247 |
+ pclose( pHandle ); |
248 |
+ idx = 0; |
249 |
+ while( idx < MAXSTRINGSIZE ) |
250 |
+ { |
251 |
+ if( localProperty.buffer[idx] == LINEFEED || localProperty.buffer[idx] == TAB || localProperty.buffer[idx] == SPACE ) |
252 |
+ { |
253 |
+ localProperty.buffer[idx] = 0; |
254 |
+ break; |
255 |
+ } |
256 |
+ idx++; |
257 |
+ } |
258 |
+ MGmStrcpy( localProperty.CURDIR, localProperty.buffer ); |
259 |
+ |
260 |
+ |
261 |
/* |
262 |
* store localProperty.workDir |
263 |
*/ |
264 |
@@ -152,6 +211,13 @@ |
265 |
MGmStrcpy( localProperty.workDir, localProperty.buffer ); |
266 |
|
267 |
/* |
268 |
+ * build localProperty.workFullPath |
269 |
+ */ |
270 |
+ MGmStrcpy( localProperty.workFullPath, localProperty.workDir ); |
271 |
+ MGmStrcat( localProperty.workFullPath, localProperty.CURDIR ); |
272 |
+ MGmStrcat( localProperty.workFullPath, "/work" ); |
273 |
+ |
274 |
+ /* |
275 |
* store localProperty.optionsDir |
276 |
*/ |
277 |
MGmStrcpy( localProperty.optionsDir, "cd " ); |
278 |
@@ -182,8 +248,6 @@ |
279 |
|
280 |
if( MGrIfFileExist( localProperty.optionsDir ) ) |
281 |
{ |
282 |
- MGmFopen( fileStream, localProperty.optionsDir, "r" ); |
283 |
- fclose( fileStream ); |
284 |
MGmStrcpy( localProperty.beforeOptionsFileTime, MGrIntToString( (int)MGrFileTime( localProperty.optionsDir ) ) ); |
285 |
MGmStrcpy( localProperty.beforeOptionsFileSize, MGrIntToString( MGrFileSize( localProperty.optionsDir ) ) ); |
286 |
} |
287 |
@@ -402,7 +466,7 @@ |
288 |
/************************************************************************/ |
289 |
/* Command "2" " make conf" */ |
290 |
/************************************************************************/ |
291 |
- if( MGrStrlen( localProperty.buffer ) > 4 ) |
292 |
+ if( MGrBufferlen( localProperty.buffer, MAXBUFFERSIZE ) > 4 ) |
293 |
{ |
294 |
/* |
295 |
fprintf( stderr, "%s DEBUG: MGrStrlen( localProperty.buffer )-=>%d localProperty.buffer-=>%s localProperty.optionsDir->%s\n", id, |
296 |
@@ -410,8 +474,8 @@ |
297 |
while( fflush( stderr ) ); |
298 |
*/ |
299 |
/* |
300 |
- * If here we know OPTIONS is defined, now need to know if |
301 |
- * /var/db/ports/{package name}/options exists |
302 |
+ * If here we know OPTIONS is defined, need to run make config |
303 |
+ * if /var/db/ports/{package name}/options exists |
304 |
*/ |
305 |
if( MGrIfFileExist( localProperty.optionsDir ) == 0 ) |
306 |
{ |
307 |
@@ -429,20 +493,12 @@ |
308 |
fprintf( stdout, "%s %s command: #2 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command ); |
309 |
fprintf( stdout, "%s\n", SINGLE_LINES ); |
310 |
while( fflush( stdout ) ); |
311 |
- |
312 |
system(localProperty.command); |
313 |
- fclose( fileStream ); |
314 |
- |
315 |
- localProperty.afterOptionsFileTime[0] = 0; |
316 |
- localProperty.afterOptionsFileSize[0] = 0; |
317 |
} |
318 |
- else |
319 |
- { |
320 |
- MGmStrcpy( localProperty.afterOptionsFileTime, |
321 |
+ MGmStrcpy( localProperty.afterOptionsFileTime, |
322 |
MGrIntToString( (int)MGrFileTime( localProperty.optionsDir ) ) ); |
323 |
- MGmStrcpy( localProperty.afterOptionsFileSize, |
324 |
+ MGmStrcpy( localProperty.afterOptionsFileSize, |
325 |
MGrIntToString( MGrFileSize( localProperty.optionsDir ) ) ); |
326 |
- } |
327 |
|
328 |
/* |
329 |
* test to see if any options changed |
330 |
@@ -958,29 +1014,70 @@ |
331 |
/************************************************************************/ |
332 |
/* Command "9" " make" */ |
333 |
/************************************************************************/ |
334 |
- MGmStrcpy( localProperty.command, "cd " ); |
335 |
- MGmStrcat( localProperty.command, PORTSDIR ); |
336 |
- MGmStrcat( localProperty.command, oldPortDir ); |
337 |
- MGmStrcat( localProperty.command, " && make " ); |
338 |
if( MGrStrlen( localProperty.options ) > 0 ) |
339 |
{ |
340 |
- MGmStrcat( localProperty.command, localProperty.options ); |
341 |
+ cmd = malloc( sizeof( char** ) * 3 ); |
342 |
+ cmd[0] = malloc( MAXSTRINGSIZE ); |
343 |
+ cmd[1] = malloc( MAXBUFFERSIZE ); |
344 |
+ cmd[2] = 0; |
345 |
+ MGmStrcpy( cmd[0], PORTSDIR ); |
346 |
+ MGmStrcat( cmd[0], oldPortDir ); |
347 |
+ if( chdir( cmd[0] ) != 0 ) |
348 |
+ { |
349 |
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] ); |
350 |
+ perror( "chroot" ); |
351 |
+ while( fflush( stderr ) ); |
352 |
+ assert( 0 ); |
353 |
+ } |
354 |
+ MGmStrcpy( cmd[0], "/usr/bin/make" ); |
355 |
+ MGmBuffercpy( cmd[1], localProperty.options, MAXBUFFERSIZE ); |
356 |
+ fprintf( stdout, "%s\n", SINGLE_LINES ); |
357 |
+ fprintf( stdout, "update %s \n", oldPortName ); |
358 |
+ fprintf( stdout, "%s %s command: #9 of 14 %s\nOPTIONS-=>%s\n", id, PACKAGE_VERSION, cmd[0], cmd[1] ); |
359 |
+ fprintf( stdout, "%s\n", SINGLE_LINES ); |
360 |
+ while( fflush( stdout ) ); |
361 |
+ MGmSystem( cmd, localProperty.environment ); |
362 |
+ free( cmd[0] ); |
363 |
+ free( cmd[1] ); |
364 |
+ free( cmd ); |
365 |
} |
366 |
- |
367 |
- fprintf( stdout, "%s\n", SINGLE_LINES ); |
368 |
- fprintf( stdout, "update %s \n", oldPortName ); |
369 |
- fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, localProperty.command ); |
370 |
- fprintf( stdout, "%s\n", SINGLE_LINES ); |
371 |
- while( fflush( stdout ) ); |
372 |
- if( ( errorCode = system(localProperty.command) ) ) |
373 |
+ else |
374 |
{ |
375 |
- MGPMlogAdd( property, oldPortName, oldPortDir, failMsg1, space, space ); |
376 |
- fprintf( stdout, "%s %s error: make returned an error, adding %s to ignore.db\n", id, PACKAGE_VERSION, oldPortDir ); |
377 |
+ cmd = malloc( sizeof( char** ) * 2 ); |
378 |
+ cmd[0] = malloc( MAXSTRINGSIZE ); |
379 |
+ cmd[1] = 0; |
380 |
+ MGmStrcpy( cmd[0], PORTSDIR ); |
381 |
+ MGmStrcat( cmd[0], oldPortDir ); |
382 |
+ if( chdir( cmd[0] ) != 0 ) |
383 |
+ { |
384 |
+ fprintf( stderr, "%s error: chdir %s failed\n", id, cmd[0] ); |
385 |
+ perror( "chroot" ); |
386 |
+ while( fflush( stderr ) ); |
387 |
+ assert( 0 ); |
388 |
+ } |
389 |
+ MGmStrcpy( cmd[0], "/usr/bin/make" ); |
390 |
+ fprintf( stdout, "%s\n", SINGLE_LINES ); |
391 |
+ fprintf( stdout, "update %s \n", oldPortName ); |
392 |
+ fprintf( stdout, "%s %s command: #9 of 14 %s\n", id, PACKAGE_VERSION, cmd[0] ); |
393 |
+ fprintf( stdout, "%s\n", SINGLE_LINES ); |
394 |
while( fflush( stdout ) ); |
395 |
- MGdbAdd( property->ignoreDb, oldPortDir, "failed during make", NULL ); |
396 |
+ MGmSystem( cmd, localProperty.environment ); |
397 |
+ free( cmd[0] ); |
398 |
+ free( cmd ); |
399 |
+ } |
400 |
+ |
401 |
+ if( MGrIfDirEntry( localProperty.workFullPath, ".build_done" ) == 0 ) |
402 |
+ { |
403 |
+ fprintf( stderr, "%s\n", SINGLE_LINES ); |
404 |
+ fprintf( stderr, "%s error: %s %s failed during make, adding to ignore.db\n", id, oldPortName, oldPortDir ); |
405 |
+ fprintf( stderr, "%s\n", SINGLE_LINES ); |
406 |
+ while( fflush( stderr ) ); |
407 |
+ MGPMlogAdd( property, oldPortName, oldPortDir, "port failed to build during make, adding to ignore.db", " ", " " ); |
408 |
+ MGdbAdd( property->ignoreDb, oldPortDir, "port failed to build during make\n", NULL ); |
409 |
rCleanUp( property, &localProperty ); |
410 |
return(0); |
411 |
} |
412 |
+ |
413 |
/************************************************************************/ |
414 |
/* Command "10" pkg_create -b */ |
415 |
/************************************************************************/ |
416 |
@@ -1468,6 +1565,13 @@ |
417 |
MGdbDestroy( property->installedPortsDb ); |
418 |
MGdbDestroy( property->strikesDb ); |
419 |
|
420 |
+ |
421 |
+ free( localProperty->environment[0] ); |
422 |
+ free( localProperty->environment[1] ); |
423 |
+ free( localProperty->environment[2] ); |
424 |
+ free( localProperty->environment ); |
425 |
+ |
426 |
+ free( localProperty->CURDIR ); |
427 |
free( localProperty->afterOptionsFileSize ); |
428 |
free( localProperty->afterOptionsFileTime ); |
429 |
free( localProperty->batchCheck ); |
430 |
@@ -1487,6 +1591,7 @@ |
431 |
free( localProperty->stopPortCmd ); |
432 |
free( localProperty->stopPortDir ); |
433 |
free( localProperty->workDir ); |
434 |
+ free( localProperty->workFullPath ); |
435 |
|
436 |
return(0); |
437 |
} |
438 |
@@ -1782,4 +1887,27 @@ |
439 |
} |
440 |
free( command ); |
441 |
return( 0 ); |
442 |
+} |
443 |
+ |
444 |
+int MGrIfDirEntry( char* dirName, char* fileName ) |
445 |
+{ |
446 |
+/* char id[] = "MGrIfDirEntry"; */ |
447 |
+ DIR* dirStream; |
448 |
+ struct dirent* dirRecord; |
449 |
+ unsigned int fileNameLength = 0; |
450 |
+ |
451 |
+ fileNameLength = MGrStrlen( fileName ); |
452 |
+ |
453 |
+ dirStream = opendir( dirName ); |
454 |
+ |
455 |
+ while( ( dirRecord = readdir( dirStream ) ) != NULL ) |
456 |
+ { |
457 |
+ if( dirRecord->d_namlen >= fileNameLength && strncmp( fileName, dirRecord->d_name, fileNameLength ) == 0 ) |
458 |
+ { |
459 |
+ closedir( dirStream ); |
460 |
+ return( 1 ); /* FOUND */ |
461 |
+ } |
462 |
+ } |
463 |
+ closedir( dirStream ); |
464 |
+ return( 0 ); /* NOT_FOUND */ |
465 |
} |
466 |
diff -ruN ../0.4.0/libMGPM/src/libMGPM.h ./libMGPM/src/libMGPM.h |
467 |
--- ../0.4.0/libMGPM/src/libMGPM.h Sun Dec 11 09:33:14 2005 |
468 |
+++ ./libMGPM/src/libMGPM.h Mon Dec 12 21:00:55 2005 |
469 |
@@ -91,6 +91,7 @@ |
470 |
|
471 |
typedef struct |
472 |
{ |
473 |
+ char* CURDIR; |
474 |
char* afterOptionsFileSize; |
475 |
char* afterOptionsFileTime; |
476 |
char* batchCheck; |
477 |
@@ -112,13 +113,16 @@ |
478 |
char* stopPortCmd; |
479 |
char* stopPortDir; |
480 |
char* workDir; |
481 |
+ char* workFullPath; |
482 |
char* xtermTitle; |
483 |
+ char** environment; |
484 |
int bufferSize; |
485 |
int optionsBufferSize; |
486 |
} structLocalProperty; |
487 |
|
488 |
typedef struct |
489 |
{ |
490 |
+ char** argp; |
491 |
/* |
492 |
* default flags |
493 |
*/ |
494 |
@@ -227,7 +231,7 @@ |
495 |
int MGPMlogDestroy( structProperty* property ); |
496 |
int MGPMrBestOldPort( structProperty* property, char* oldPortDir, char* oldPortName ); |
497 |
int MGPMrCleanUp( structProperty* property ); |
498 |
-int MGPMrCommandLine( int argc, char** argv ); |
499 |
+int MGPMrCommandLine( int argc, char** argv, char** argp ); |
500 |
int MGPMrController( structProperty* property, char* path, char** argv ); |
501 |
int MGPMrCreateAllUpdateStatusDb( structProperty* property ); |
502 |
int MGPMrCreateInstalledDb( structProperty* property ); |
503 |
diff -ruN ../0.4.0/portmanager/portmanager.c ./portmanager/portmanager.c |
504 |
--- ../0.4.0/portmanager/portmanager.c Sat Dec 10 06:00:32 2005 |
505 |
+++ ./portmanager/portmanager.c Mon Dec 12 16:20:58 2005 |
506 |
@@ -31,11 +31,11 @@ |
507 |
/* |
508 |
* Jumping through a hoop so main is accessable with gdb |
509 |
*/ |
510 |
-int main( int argc, char** argv ) |
511 |
+int main( int argc, char** argv, char** argp) |
512 |
{ |
513 |
int errorCode = 0; |
514 |
|
515 |
- errorCode = MGPMrCommandLine( argc, (char**)argv ); |
516 |
+ errorCode = MGPMrCommandLine( argc, (char**)argv, (char**)argp ); |
517 |
exit( errorCode ); |
518 |
} |
519 |
|
520 |
Binary files ../0.4.0/portmanager-0.4.1.tar.gz and ./portmanager-0.4.1.tar.gz differ |