493 |
Mail_T r; |
Mail_T r; |
494 |
Device_T dl; |
Device_T dl; |
495 |
Resource_T q; |
Resource_T q; |
|
Checksum_T c; |
|
496 |
Timestamp_T t; |
Timestamp_T t; |
497 |
Size_T sl; |
Size_T sl; |
498 |
Dependant_T d; |
Dependant_T d; |
523 |
printf("\n"); |
printf("\n"); |
524 |
} |
} |
525 |
|
|
526 |
for(c= s->checksumlist; c; c= c->next) { |
if(s->md5) |
527 |
|
printf(" %-20s = %s\n", "Checksum", s->md5); |
|
printf(" %-20s = %s %s\n", "Checksum", c->md5, c->file); |
|
|
|
|
|
} |
|
528 |
|
|
529 |
for(d= s->dependantlist; d; d= d->next) |
for(d= s->dependantlist; d; d= d->next) |
530 |
if(d->dependant != NULL) |
if(d->dependant != NULL) |
570 |
for(t= s->timestamplist; t; t= t->next) { |
for(t= s->timestamplist; t; t= t->next) { |
571 |
|
|
572 |
if(t->test_changes) { |
if(t->test_changes) { |
573 |
printf(" %-20s = if %s was changed then %s\n", |
printf(" %-20s = if changed then %s\n", |
574 |
"Timestamp", |
"Timestamp", |
|
t->pathname, |
|
575 |
actionnames[t->action]); |
actionnames[t->action]); |
576 |
} else { |
} else { |
577 |
printf(" %-20s = if %s %s %d second(s) then %s\n", |
printf(" %-20s = if %s %d second(s) then %s\n", |
578 |
"Timestamp", |
"Timestamp", |
|
t->pathname, |
|
579 |
operatornames[t->operator], |
operatornames[t->operator], |
580 |
t->time, |
t->time, |
581 |
actionnames[t->action]); |
actionnames[t->action]); |
586 |
for(sl= s->sizelist; sl; sl= sl->next) { |
for(sl= s->sizelist; sl; sl= sl->next) { |
587 |
|
|
588 |
if(sl->test_changes) { |
if(sl->test_changes) { |
589 |
printf(" %-20s = if %s was changed then %s\n", |
printf(" %-20s = if changed then %s\n", |
590 |
"Size", |
"Size", |
|
s->path, |
|
591 |
actionnames[sl->action]); |
actionnames[sl->action]); |
592 |
} else { |
} else { |
593 |
printf(" %-20s = if %s %s %lu byte(s) then %s\n", |
printf(" %-20s = if %s %lu byte(s) then %s\n", |
594 |
"Size", |
"Size", |
|
s->path, |
|
595 |
operatornames[sl->operator], |
operatornames[sl->operator], |
596 |
sl->size, |
sl->size, |
597 |
actionnames[sl->action]); |
actionnames[sl->action]); |
920 |
|
|
921 |
|
|
922 |
/** |
/** |
|
* Compute a md5 checksum for the given file and save the result |
|
|
* in an allocated area pointed to by dest. The caller is responsible |
|
|
* for freeing dest. |
|
|
* @param dest a pointer to an allocated area with the computed md5 sum |
|
|
* @param file The name of file to compute a md5 sum for |
|
|
* @return TRUE if success otherwise FALSE. |
|
|
*/ |
|
|
int set_md5sum(char **dest, char *file) { |
|
|
|
|
|
ASSERT(dest); |
|
|
ASSERT(file); |
|
|
|
|
|
if(! (*dest= get_md5sum(file))) |
|
|
return FALSE; |
|
|
|
|
|
return TRUE; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
923 |
* @return a md5 checksum for the given file, or NULL if error. |
* @return a md5 checksum for the given file, or NULL if error. |
924 |
*/ |
*/ |
925 |
char *get_md5sum(char *file) { |
char *get_md5sum(char *file) { |
947 |
|
|
948 |
fclose(f); |
fclose(f); |
949 |
|
|
950 |
for(i= 0; i < 16; ++i) { |
for(i= 0; i < 16; ++i) |
|
|
|
951 |
r+= sprintf(r, "%02x", md5buf[i]); |
r+= sprintf(r, "%02x", md5buf[i]); |
|
|
|
|
} |
|
952 |
|
|
953 |
return (xstrdup(result)); |
return (xstrdup(result)); |
954 |
|
|
981 |
|
|
982 |
int rv; |
int rv; |
983 |
|
|
984 |
rv= (!strncmp(sum, newSum, 31)); |
rv= (!strncmp(sum, newSum, 32)); |
985 |
free(newSum); |
free(newSum); |
986 |
|
|
987 |
return (rv); |
return (rv); |