-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- use simple exit codes in function archive_sum - fixes check with different base dir usage help text, adds test for this - adds some more comments - new utility to sanitize filenames - this simplifies file handling in sum and check - aligns sum and check, they are basically largely the same - with a generic archive entry iterator, this could become even simpler - removes unused check function test setup
- Loading branch information
1 parent
a1dab79
commit db34a86
Showing
9 changed files
with
82 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
#include "archive-sum.h" | ||
#include "util.h" | ||
#include "archive-sum.h" | ||
|
||
#include <sys/stat.h> | ||
#include <stdio.h> | ||
#include <sys/stat.h> | ||
|
||
int bsize(const char *file, blksize_t *size) { | ||
struct stat s; | ||
#define STDIN_BUF_SIZE 32768 | ||
|
||
if (stat(file, &s) == -1) { | ||
perror(file); | ||
return 0; | ||
} | ||
int bsize(const char *filename, blksize_t *size) { | ||
if (filename == NULL) { | ||
*size = STDIN_BUF_SIZE; | ||
} else { | ||
struct stat s; | ||
|
||
*size = s.st_blksize; | ||
if (stat(filename, &s) == -1) { | ||
perror(filename); | ||
return 0; | ||
} | ||
|
||
*size = s.st_blksize; | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
void sanitize_filename(char *filename, char **open_filename, char **sanitized_filename) { | ||
if (filename == NULL || strcmp("-", filename) == 0) { | ||
*open_filename = NULL; | ||
*sanitized_filename = "stdin"; | ||
} else { | ||
*open_filename = filename; | ||
*sanitized_filename = filename; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
source setup-archive-sum-test.sh || exit 1 | ||
trap "rm -fr $TMP_DIR" EXIT | ||
|
||
mkdir migrate | ||
mv $TEST_ARCHIVE_DIR migrate | ||
|
||
$ARCHIVE_SUM -cmigrate $TEST_ARCHIVE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters