Thread: [Cryptar-cvs] cryptar option.c,1.15,1.16
Status: Beta
Brought to you by:
jma2
From: Jeff A. <jm...@us...> - 2004-05-28 18:12:05
|
Update of /cvsroot/cryptar/cryptar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12752 Modified Files: option.c Log Message: Improve commandline user interface. Index: option.c =================================================================== RCS file: /cvsroot/cryptar/cryptar/option.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** option.c 15 May 2004 14:42:01 -0000 1.15 --- option.c 28 May 2004 18:11:55 -0000 1.16 *************** *** 45,53 **** static struct option long_options[] = { ! {"archive-name", required_argument, NULL, 'a'}, ! {"backup", optional_argument, NULL, 'b'}, {"create", no_argument, NULL, 'c'}, ! {"extract", optional_argument, NULL, 'x'}, ! {"list", optional_argument, NULL, 't'}, {"ping", no_argument, NULL, 'p'}, {"verbose", optional_argument, NULL, 'v'}, --- 45,52 ---- static struct option long_options[] = { ! {"backup", no_argument, NULL, 'b'}, {"create", no_argument, NULL, 'c'}, ! {"extract", no_argument, NULL, 'x'}, ! {"list", no_argument, NULL, 't'}, {"ping", no_argument, NULL, 'p'}, {"verbose", optional_argument, NULL, 'v'}, *************** *** 72,102 **** options_init(); ! while (c = getopt_long (argc, argv, "c:x:t:v::h", long_options, 0), c != EOF) { switch (c) { ! case 'a': ! log_am_client(); ! set_char_option(kArchive_target, g_strdup(optarg)); ! if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) ! g_message ("Archive is '%s'", ! char_option_safe(kArchive_target)); ! break; ! case 'b': log_am_client(); set_int_option(kOption_backup, 1); - if(optarg) - set_char_option(kBackup_pattern, g_strdup(optarg)); if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) ! g_message ("action archive: %s", ! char_option(kBackup_pattern)); break; case 'c': log_am_client(); ! set_int_option(kOption_backup, 1); if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) ! g_message ("action create:"); break; --- 71,91 ---- options_init(); ! while (c = getopt_long (argc, argv, "bcxtpv::nh", long_options, 0), c != EOF) { switch (c) { ! case 'b': log_am_client(); set_int_option(kOption_backup, 1); if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) ! g_message ("action backup"); break; case 'c': log_am_client(); ! set_int_option(kOption_create, 1); if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) ! g_message ("action create"); break; *************** *** 104,112 **** log_am_client(); set_int_option(kOption_extract, 1); - if(optarg) - set_char_option(kExtract_pattern, g_strdup(optarg)); if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) ! g_message("action extract, file '%s'", ! char_option_safe(kExtract_pattern)); break; --- 93,98 ---- log_am_client(); set_int_option(kOption_extract, 1); if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) ! g_message("action extract"); break; *************** *** 114,122 **** log_am_client(); set_int_option(kOption_list, 1); - if(optarg) - set_char_option(kList_pattern, g_strdup(optarg)); if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) ! g_message("option list, file '%s'", ! char_option_safe(kList_pattern)); break; --- 100,105 ---- log_am_client(); set_int_option(kOption_list, 1); if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) ! g_message("option list"); break; *************** *** 149,152 **** --- 132,136 ---- set_int_option(kOption_verbose, int_option(kOption_verbose | VERBOSE_FILES)); + g_error("This option isn't currently implemented."); break; *************** *** 189,192 **** --- 173,182 ---- num_args = argc - optind; + if(optind < argc) { + set_char_option(kArchive_target, argv[optind++]); + if(int_option(kOption_verbose) & VERBOSE_FLOW_PLUS) + g_message ("Archive is '%s'", + char_option_safe(kArchive_target)); + } g_args = g_ptr_array_new(); while(optind < argc) |