static bool handle_parameters(int argc, char** argv, char** dev_name) { int c; int log_level = SYNCE_LOG_LEVEL_LOWEST; while ((c = getopt(argc, argv, "d:hp:")) != -1) { switch (c) { case 'd': log_level = atoi(optarg); break; case 'p': *dev_name = optarg; break; case 'h': default: show_usage(argv[0]); return false; } } synce_log_set_level(log_level); return true; }
static bool handle_parameters(int argc, char** argv, char** source, char** dest, char** tzfile, char** codepage, uint32_t *flags) { int c; int path_count; int log_level = SYNCE_LOG_LEVEL_ERROR; while ((c = getopt(argc, argv, "d:c:t:u")) != -1) { switch (c) { case 'd': log_level = atoi(optarg); break; case 'c': *codepage = optarg; break; case 't': *tzfile = optarg; break; case 'u': *flags = *flags | RRA_APPOINTMENT_UTF8; break; case 'h': default: show_usage(argv[0]); return false; } } synce_log_set_level(log_level); path_count = argc - optind; if (path_count != 2) { fprintf(stderr, "%s: You need to specify source and destination file names on command line\n\n", argv[0]); show_usage(argv[0]); return false; } *source = strdup(argv[optind++]); *dest = strdup(argv[optind++]); return true; }
static bool handle_parameters(int argc, char** argv, char** source, char** dest) { int c; int path_count; int log_level = SYNCE_LOG_LEVEL_LOWEST; while ((c = getopt(argc, argv, "d:hp:")) != -1) { switch (c) { case 'd': log_level = atoi(optarg); break; case 'p': devpath = optarg; break; case 'h': default: show_usage(argv[0]); return false; } } synce_log_set_level(log_level); path_count = argc - optind; if (path_count < 1 || path_count > 2) { fprintf(stderr, "%s: You need to specify source and destination file names on command line\n\n", argv[0]); show_usage(argv[0]); return false; } *source = strdup(argv[optind++]); if (path_count > 1) *dest = strdup(argv[optind++]); return true; }
static bool handle_parameters(int argc, char** argv, char** program, char** parameters) { int c; int log_level = SYNCE_LOG_LEVEL_LOWEST; while ((c = getopt(argc, argv, "d:p:h")) != -1) { switch (c) { case 'd': log_level = atoi(optarg); break; case 'p': devpath = optarg; break; case 'h': default: show_usage(argv[0]); return false; } } synce_log_set_level(log_level); if (optind == argc) { fprintf(stderr, "%s: No program specified on command line\n\n", argv[0]); show_usage(argv[0]); return false; } *program = strdup(argv[optind++]); if (optind < argc) *parameters = strdup(argv[optind]); return true; }
static bool handle_parameters(int argc, char** argv, char **shortcut, char **target) { int c; int log_level = SYNCE_LOG_LEVEL_LOWEST; while ((c = getopt(argc, argv, "d:hp:")) != -1) { switch (c) { case 'd': log_level = atoi(optarg); break; case 'p': devpath = optarg; break; case 'h': default: show_usage(argv[0]); return false; } } synce_log_set_level(log_level); if ((argc - optind) != 2) { fprintf(stderr, "%s: You need to specify shortcut and target file names on command line\n\n", argv[0]); show_usage(argv[0]); return false; } *shortcut = strdup(argv[optind++]); *target = strdup(argv[optind++]); return true; }