-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from larsewi/purge
CFE-4373: Implemented new purge functionality
- Loading branch information
Showing
14 changed files
with
341 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "purge.h" | ||
|
||
#include <stdio.h> | ||
|
||
#include "common.h" | ||
|
||
enum OPTION_VALUE { | ||
OPTION_HELP = 1, | ||
}; | ||
|
||
struct arguments { | ||
const char *arg; | ||
const char *desc; | ||
}; | ||
|
||
static const struct option OPTIONS[] = { | ||
{"help", no_argument, NULL, OPTION_HELP}, | ||
{NULL, 0, NULL, 0}, | ||
}; | ||
|
||
static const char *const DESCRIPTIONS[] = { | ||
"print help message", | ||
}; | ||
|
||
static void PrintHelp(void) { | ||
PrintVersion(); | ||
printf("\n"); | ||
PrintOptions(OPTIONS, DESCRIPTIONS); | ||
printf("\n"); | ||
PrintBugreport(); | ||
printf("\n"); | ||
} | ||
|
||
int Purge(const char *const work_dir, int argc, char *argv[]) { | ||
int opt; | ||
while ((opt = getopt_long(argc, argv, "+", OPTIONS, NULL)) != -1) { | ||
switch (opt) { | ||
case OPTION_HELP: | ||
PrintHelp(); | ||
return EXIT_SUCCESS; | ||
default: | ||
return EXIT_FAILURE; | ||
} | ||
} | ||
|
||
if (!LCH_Purge(work_dir)) { | ||
fprintf(stderr, "Failed to purge blocks"); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
} |
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,6 @@ | ||
#ifndef _LEECH_PURGE_H | ||
#define _LEECH_PURGE_H | ||
|
||
int Purge(const char *work_dir, int argc, char *argv[]); | ||
|
||
#endif // _LEECH_PURGE_H |
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
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
Oops, something went wrong.