}
}
- if (optind >= argc) {
+ set_argv0(argv);
+ argc = argc - optind;
+ if (check_argc_min(argc, 1)) {
usage();
exit(1);
}
}
}
argc = argc - optind;
- if (argc != 1) {
+ set_argv0(argv);
+ if (check_argc_exact(argc, 1)) {
print_usage();
return 1;
}
print_usage();
}
}
+ set_argv0(av);
ac = ac - optind;
- if (ac == 0)
+ if (check_argc_min(ac, 1))
print_usage();
dev = av[optind];
#include <stdlib.h>
#include <unistd.h>
#include "crc32c.h"
+#include "utils.h"
void usage(void)
{
}
}
+ set_argv0(argv);
str = argv[optind];
if (!loop) {
- if (optind >= argc) {
- fprintf(stderr, "not enough arguments\n");
+ if (check_argc_min(argc - optind, 1))
return 255;
- }
+
printf("%12u - %s\n", crc32c(~1, str, strlen(str)), str);
return 0;
}
print_usage();
}
}
+ set_argv0(av);
ac = ac - optind;
- if (ac != 1)
+ if (check_argc_exact(ac, 1))
print_usage();
info = open_ctree_fs_info(av[optind], 0, 0, OPEN_CTREE_PARTIAL);
}
}
- if (optind >= argc) {
+ set_argv0(argv);
+ argc = argc - optind;
+ if (check_argc_min(argc, 1)) {
usage();
exit(1);
}
}
}
- if (optind < argc) {
- path = argv[optind++];
- } else {
+ set_argv0(argv);
+ argc = argc - optind;
+ if (check_argc_min(argc, 1)) {
usage();
exit(1);
}
+ path = argv[optind++];
+
fd = open_file_or_dir(path, &dirstream);
if (fd < 0) {
fprintf(stderr, "ERROR: can't access '%s'\n", path);
print_usage();
}
}
+ set_argv0(av);
ac = ac - optind;
- if (ac == 0)
+ if (check_argc_min(ac, 1))
print_usage();
if (logical == 0)
print_usage();
print_usage();
}
}
+ set_argv0(av);
ac = ac - optind;
- if (ac != 1)
+ if (check_argc_exact(ac, 1))
print_usage();
if (bytenr == 0) {
}
}
- if (argc < optind + 1) {
+ set_argv0(argv);
+ if (check_argc_min(argc - optind, 1)) {
print_usage();
exit(1);
}
struct btrfs_trans_handle *trans;
int ret;
- if (ac != 2)
+ set_argv0(av);
+ if (check_argc_exact(ac, 2))
print_usage();
radix_tree_init();
}
}
+ set_argv0(argv);
argc = argc - optind;
device = argv[optind];
- if (argc != 1) {
+ if (check_argc_exact(argc, 1)) {
print_usage();
return 1;
}
}
argc = argc - optind;
- if (argc != 1)
+ if (check_argc_exact(argc, 1))
usage(cmd_check_usage);
radix_tree_init();
}
}
- if (!list_roots && optind + 1 >= argc)
+ set_argv0(argv);
+ if (!list_roots && check_argc_min(argc - optind, 2))
usage(cmd_restore_usage);
- else if (list_roots && optind >= argc)
+ else if (list_roots && check_argc_min(argc - optind, 1))
usage(cmd_restore_usage);
if (fs_location && root_objectid) {
}
}
- if (optind == argc)
+ if (check_argc_min(argc - optind, 1))
usage(cmd_send_usage);
if (outname != NULL) {