mirror of
https://github.com/fscotto/fsnap.git
synced 2026-11-26 03:09:51 +00:00
Add list command [WIP]
This commit is contained in:
15
src/main.c
15
src/main.c
@@ -1,5 +1,4 @@
|
||||
#include "create.h"
|
||||
#include "scan.h"
|
||||
#include "command.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -40,6 +39,18 @@ int main(int argc, char *argv[]) {
|
||||
fprintf(stderr, "create failed: %s\n", strerror(err));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
} else if (strcmp(cmd, "list") == 0) {
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "%s: command %s expected param [snapshot_file]", argv[0],
|
||||
cmd);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
const char *snapshot = argv[2];
|
||||
if (list(snapshot) == -1) {
|
||||
const int err = errno;
|
||||
fprintf(stderr, "list failed: %s\n", strerror(err));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "command %s is not valid\n", cmd);
|
||||
return EXIT_FAILURE;
|
||||
|
||||
Reference in New Issue
Block a user