assert(args);
args->resize = false;
- args->update = true;
+ args->update = false;
struct option long_options[] = {
{"resize", no_argument, NULL, 'r'},
int opt;
while ((opt = getopt_long_only(argc, argv, "rh", long_options, NULL)) !=-1) {
- args->update = false;
-
switch (opt) {
case 'r': {
args->resize = true;
}
}
- return 0;
+ print_help(argv[0]);
+
+ return 1;
}
static void print_help(char *my_name)
assert(my_name);
printf("Usage:\n"
- " %s [--resize|--update]\n\n"
- "Possible arguments:\n"
- " --help Print this help\n"
- " --update Trigger the OS Upgrade\n"
- " --resize Run resize2fs on the rootfs partition.\n"
- " After that, performing the OS Upgrade will be impossible.\n\n"
- "By default, without an argument, the OS Upgrade will be triggered.\n\n", my_name);
+ " %s [--help|--resize|--update]\n\n"
+ "Possible arguments:\n"
+ " --help Print this help\n"
+ " --update Trigger the OS Upgrade\n"
+ " --resize Run resize2fs on the rootfs partition.\n"
+ " After that, performing the OS Upgrade will be impossible.\n\n" ,my_name);
}
static int do_update()
int main(int argc, char **argv)
{
- int ret = 0;
struct arguments args;
if (parse_args(argc, argv, &args) != 0) {
return 1;
}
- if (args.resize) {
- ret = do_resize();
- } else if (args.update) {
- ret = do_update();
- }
+ if (args.resize)
+ return do_resize();
- return ret;
+ if (args.update)
+ return do_update();
+
+ print_help(argv[0]);
+
+ return 1;
}