Commit f0837cca f0837cca3b625cbeb6da401726b32c4d75f21c17 by Sergey Poznyakoff

Fixed option handling

1 parent 16354fd3
...@@ -23,33 +23,36 @@ ...@@ -23,33 +23,36 @@
23 23
24 const char *argp_program_version = "comp (" PACKAGE_STRING ")"; 24 const char *argp_program_version = "comp (" PACKAGE_STRING ")";
25 static char doc[] = N_("GNU MH comp\v" 25 static char doc[] = N_("GNU MH comp\v"
26 "Options marked with `*' are not yet implemented.\n"
26 "Use -help to obtain the list of traditional MH options."); 27 "Use -help to obtain the list of traditional MH options.");
27 static char args_doc[] = "[msg]"; 28 static char args_doc[] = "[msg]";
28 29
29 #define ARG_NOEDIT 1
30 #define ARG_WHATNOWPROC 2
31 #define ARG_NOWHATNOWPROC 3
32 #define ARG_NODRAFTFOLDER 4
33 #define ARG_FILE 5
34
35 /* GNU options */ 30 /* GNU options */
36 static struct argp_option options[] = { 31 static struct argp_option options[] = {
37 {"build", 'b', 0, 0, 32 {"build", ARG_BUILD, 0, 0,
38 N_("Build the draft and quit immediately.")}, 33 N_("Build the draft and quit immediately.")},
39 {"draftfolder", 'd', N_("FOLDER"), 0, 34 {"draftfolder", ARG_DRAFTFOLDER, N_("FOLDER"), 0,
40 N_("Specify the folder for message drafts")}, 35 N_("Specify the folder for message drafts")},
41 {"nodraftfolder", ARG_NODRAFTFOLDER, 0, 0, 36 {"nodraftfolder", ARG_NODRAFTFOLDER, 0, 0,
42 N_("Undo the effect of the last --draftfolder option")}, 37 N_("Undo the effect of the last --draftfolder option")},
43 {"draftmessage" , 'm', N_("MSG"), 0, 38 {"draftmessage" , ARG_DRAFTMESSAGE, N_("MSG"), 0,
44 N_("Invoke the draftmessage facility")}, 39 N_("Invoke the draftmessage facility")},
45 {"folder", 'f', N_("FOLDER"), 0, N_("Specify folder to operate upon")}, 40 {"folder", ARG_FOLDER, N_("FOLDER"), 0,
46 {"file", ARG_FILE, N_("FILE"), 0, N_("Use FILE as the message draft")}, 41 N_("Specify folder to operate upon")},
47 {"editor", 'e', N_("PROG"), 0, N_("Set the editor program to use")}, 42 {"file", ARG_FILE, N_("FILE"), 0,
48 {"noedit", ARG_NOEDIT, 0, 0, N_("Suppress the initial edit")}, 43 N_("Use FILE as the message draft")},
49 {"form", 'F', N_("FILE"), 0, N_("Read format from given file")}, 44 {"editor", ARG_EDITOR, N_("PROG"), 0,
50 {"whatnowproc", ARG_WHATNOWPROC, N_("PROG"), 0, 45 N_("Set the editor program to use")},
51 N_("Set the replacement for whatnow program")}, 46 {"noedit", ARG_NOEDIT, 0, 0,
52 {"use", 'u', N_("BOOL"), OPTION_ARG_OPTIONAL, N_("Use draft file preserved after the last session") }, 47 N_("Suppress the initial edit")},
48 {"form", ARG_FORM, N_("FILE"), 0,
49 N_("Read format from given file")},
50 {"whatnowproc", ARG_WHATNOWPROC, N_("PROG"), 0,
51 N_("* Set the replacement for whatnow program")},
52 {"nowhatnowproc", ARG_NOWHATNOWPROC, NULL, 0,
53 N_("* Ignore whatnowproc variable. Use standard `whatnow' shell instead.")},
54 {"use", ARG_USE, N_("BOOL"), OPTION_ARG_OPTIONAL,
55 N_("Use draft file preserved after the last session") },
53 { 0 } 56 { 0 }
54 }; 57 };
55 58
...@@ -86,33 +89,32 @@ opt_handler (int key, char *arg, void *unused) ...@@ -86,33 +89,32 @@ opt_handler (int key, char *arg, void *unused)
86 { 89 {
87 switch (key) 90 switch (key)
88 { 91 {
89 case 'b': 92 case ARG_BUILD:
90 case ARG_NOWHATNOWPROC:
91 build_only = 1; 93 build_only = 1;
92 break; 94 break;
93 95
94 case 'd': 96 case ARG_DRAFTFOLDER:
95 wh_env.draftfolder = arg; 97 wh_env.draftfolder = arg;
96 break; 98 break;
97 99
98 case 'e': 100 case ARG_EDITOR:
99 wh_env.editor = arg; 101 wh_env.editor = arg;
100 break; 102 break;
101 103
102 case '+': 104 case '+':
103 case 'f': 105 case ARG_FOLDER:
104 current_folder = arg; 106 current_folder = arg;
105 break; 107 break;
106 108
107 case 'F': 109 case ARG_FORM:
108 formfile = mh_expand_name (MHLIBDIR, arg, 0); 110 formfile = mh_expand_name (MHLIBDIR, arg, 0);
109 break; 111 break;
110 112
111 case 'm': 113 case ARG_DRAFTMESSAGE:
112 wh_env.draftmessage = arg; 114 wh_env.draftmessage = arg;
113 break; 115 break;
114 116
115 case 'u': 117 case ARG_USE:
116 use_draft = is_true (arg); 118 use_draft = is_true (arg);
117 break; 119 break;
118 120
...@@ -129,6 +131,7 @@ opt_handler (int key, char *arg, void *unused) ...@@ -129,6 +131,7 @@ opt_handler (int key, char *arg, void *unused)
129 break; 131 break;
130 132
131 case ARG_WHATNOWPROC: 133 case ARG_WHATNOWPROC:
134 case ARG_NOWHATNOWPROC:
132 mh_error (_("option is not yet implemented")); 135 mh_error (_("option is not yet implemented"));
133 exit (1); 136 exit (1);
134 137
......
...@@ -26,10 +26,14 @@ static char args_doc[] = ""; ...@@ -26,10 +26,14 @@ static char args_doc[] = "";
26 26
27 /* GNU options */ 27 /* GNU options */
28 static struct argp_option options[] = { 28 static struct argp_option options[] = {
29 {"form", 'F', N_("FILE"), 0, N_("Read format from given file")}, 29 {"form", ARG_FORM, N_("FILE"), 0,
30 {"format", 't', N_("FORMAT"), 0, N_("Use this format string")}, 30 N_("Read format from given file")},
31 {"dump", 'd', NULL, 0, N_("Dump the listing of compiled format code")}, 31 {"format", ARG_FORMAT, N_("FORMAT"), 0,
32 { "debug", 'D', NULL, 0, N_("Enable parser debugging output"),}, 32 N_("Use this format string")},
33 {"dump", ARG_DUMP, NULL, 0,
34 N_("Dump the listing of compiled format code")},
35 { "debug", ARG_DEBUG, NULL, 0,
36 N_("Enable parser debugging output"),},
33 { 0 } 37 { 0 }
34 }; 38 };
35 39
...@@ -64,19 +68,19 @@ opt_handler (int key, char *arg, void *unused) ...@@ -64,19 +68,19 @@ opt_handler (int key, char *arg, void *unused)
64 { 68 {
65 switch (key) 69 switch (key)
66 { 70 {
67 case 'F': 71 case ARG_FORM:
68 mh_read_formfile (arg, &format_str); 72 mh_read_formfile (arg, &format_str);
69 break; 73 break;
70 74
71 case 't': 75 case ARG_FORMAT:
72 format_str = arg; 76 format_str = arg;
73 break; 77 break;
74 78
75 case 'd': 79 case ARG_DUMP:
76 action = action_dump; 80 action = action_dump;
77 break; 81 break;
78 82
79 case 'D': 83 case ARG_DEBUG:
80 mh_format_debug (1); 84 mh_format_debug (1);
81 break; 85 break;
82 86
......
...@@ -26,19 +26,28 @@ static char args_doc[] = N_("[+folder]"); ...@@ -26,19 +26,28 @@ static char args_doc[] = N_("[+folder]");
26 26
27 /* GNU options */ 27 /* GNU options */
28 static struct argp_option options[] = { 28 static struct argp_option options[] = {
29 {"file", 'i', N_("FILE"), 0, N_("Incorporate mail from named file")}, 29 {"file", ARG_FILE, N_("FILE"), 0,
30 {"folder", 'f', N_("FOLDER"), 0, N_("Specify folder to incorporate mail to")}, 30 N_("Incorporate mail from named file")},
31 {"audit", 'a', N_("FILE"), 0, N_("Enable audit")}, 31 {"folder", ARG_FOLDER, N_("FOLDER"), 0,
32 {"noaudit", 'n', 0, 0, N_("Disable audit")}, 32 N_("Specify folder to incorporate mail to")},
33 {"changecur", 'c', N_("BOOL"), OPTION_ARG_OPTIONAL, 33 {"audit", ARG_AUDIT, N_("FILE"), 0,
34 N_("Enable audit")},
35 {"noaudit", ARG_NOAUDIT, 0, 0,
36 N_("Disable audit")},
37 {"changecur", ARG_CHANGECUR, N_("BOOL"), OPTION_ARG_OPTIONAL,
34 N_("Mark first incorporated message as current (default)")}, 38 N_("Mark first incorporated message as current (default)")},
35 {"form", 'F', N_("FILE"), 0, N_("Read format from given file")}, 39 {"form", ARG_FORM, N_("FILE"), 0,
36 {"format", 't', N_("FORMAT"), 0, N_("Use this format string")}, 40 N_("Read format from given file")},
37 {"truncate", 'T', N_("BOOL"), OPTION_ARG_OPTIONAL, 41 {"format", ARG_FORMAT, N_("FORMAT"), 0,
42 N_("Use this format string")},
43 {"truncate", ARG_TRUNCATE, N_("BOOL"), OPTION_ARG_OPTIONAL,
38 N_("Truncate source mailbox after incorporating (default)")}, 44 N_("Truncate source mailbox after incorporating (default)")},
39 {"width", 'w', N_("NUMBER"), 0, N_("Set output width")}, 45 {"width", ARG_WIDTH, N_("NUMBER"), 0,
40 {"quiet", 'q', 0, 0, N_("Be quiet")}, 46 N_("Set output width")},
41 {"license", 'l', 0, 0, N_("Display software license"), -1}, 47 {"quiet", ARG_QUIET, 0, 0,
48 N_("Be quiet")},
49 {"license", ARG_LICENSE, 0, 0,
50 N_("Display software license"), -1},
42 { 0 } 51 { 0 }
43 }; 52 };
44 53
...@@ -76,36 +85,36 @@ opt_handler (int key, char *arg, void *unused) ...@@ -76,36 +85,36 @@ opt_handler (int key, char *arg, void *unused)
76 append_folder = mh_global_profile_get ("Inbox", "inbox"); 85 append_folder = mh_global_profile_get ("Inbox", "inbox");
77 break; 86 break;
78 87
79 case 'a': 88 case ARG_AUDIT:
80 audit_file = arg; 89 audit_file = arg;
81 break; 90 break;
82 91
83 case 'n': 92 case ARG_NOAUDIT:
84 audit_file = NULL; 93 audit_file = NULL;
85 break; 94 break;
86 95
87 case 'c': 96 case ARG_CHANGECUR:
88 changecur = is_true(arg); 97 changecur = is_true(arg);
89 break; 98 break;
90 99
91 case '+': 100 case '+':
92 case 'f': 101 case ARG_FOLDER:
93 append_folder = arg; 102 append_folder = arg;
94 break; 103 break;
95 104
96 case 'F': 105 case ARG_FORM:
97 mh_read_formfile (arg, &format_str); 106 mh_read_formfile (arg, &format_str);
98 break; 107 break;
99 108
100 case 'i': 109 case ARG_FILE:
101 input_file = arg; 110 input_file = arg;
102 break; 111 break;
103 112
104 case 'T': 113 case ARG_TRUNCATE:
105 truncate_source = is_true(arg); 114 truncate_source = is_true(arg);
106 break; 115 break;
107 116
108 case 'w': 117 case ARG_WIDTH:
109 width = strtoul (arg, NULL, 0); 118 width = strtoul (arg, NULL, 0);
110 if (!width) 119 if (!width)
111 { 120 {
...@@ -114,11 +123,11 @@ opt_handler (int key, char *arg, void *unused) ...@@ -114,11 +123,11 @@ opt_handler (int key, char *arg, void *unused)
114 } 123 }
115 break; 124 break;
116 125
117 case 'q': 126 case ARG_QUIET:
118 quiet = 1; 127 quiet = 1;
119 break; 128 break;
120 129
121 case 'l': 130 case ARG_LICENSE:
122 mh_license (argp_program_version); 131 mh_license (argp_program_version);
123 break; 132 break;
124 133
......
...@@ -26,7 +26,8 @@ static char args_doc[] = N_("[+folder] [msgs]"); ...@@ -26,7 +26,8 @@ static char args_doc[] = N_("[+folder] [msgs]");
26 26
27 /* GNU options */ 27 /* GNU options */
28 static struct argp_option options[] = { 28 static struct argp_option options[] = {
29 {"folder", 'f', N_("FOLDER"), 0, N_("Specify folder to operate upon")}, 29 {"folder", ARG_FOLDER, N_("FOLDER"), 0,
30 N_("Specify folder to operate upon")},
30 { 0 } 31 { 0 }
31 }; 32 };
32 33
...@@ -41,7 +42,7 @@ opt_handler (int key, char *arg, void *unused) ...@@ -41,7 +42,7 @@ opt_handler (int key, char *arg, void *unused)
41 switch (key) 42 switch (key)
42 { 43 {
43 case '+': 44 case '+':
44 case 'f': 45 case ARG_FOLDER:
45 current_folder = arg; 46 current_folder = arg;
46 break; 47 break;
47 48
......
...@@ -31,16 +31,18 @@ static char args_doc[] = N_("messages folder [folder...]"); ...@@ -31,16 +31,18 @@ static char args_doc[] = N_("messages folder [folder...]");
31 31
32 /* GNU options */ 32 /* GNU options */
33 static struct argp_option options[] = { 33 static struct argp_option options[] = {
34 {"folder", 'f', N_("FOLDER"), 0, N_("Specify folder to operate upon")}, 34 {"folder", ARG_FOLDER, N_("FOLDER"), 0,
35 {"draft", 'd', NULL, 0, N_("Use <mh-dir>/draft as the source message")}, 35 N_("Specify folder to operate upon")},
36 {"link", 'l', N_("BOOL"), OPTION_ARG_OPTIONAL, 36 {"draft", ARG_DRAFT, NULL, 0,
37 N_("Use <mh-dir>/draft as the source message")},
38 {"link", ARG_LINK, N_("BOOL"), OPTION_ARG_OPTIONAL,
37 N_("(not implemented) Preserve the source folder copy")}, 39 N_("(not implemented) Preserve the source folder copy")},
38 {"preserve", 'p', N_("BOOL"), OPTION_ARG_OPTIONAL, 40 {"preserve", ARG_PRESERVE, N_("BOOL"), OPTION_ARG_OPTIONAL,
39 N_("(not implemented) Try to preserve message sequence numbers")}, 41 N_("(not implemented) Try to preserve message sequence numbers")},
40 {"source", 's', N_("FOLDER"), 0, 42 {"source", ARG_SOURCE, N_("FOLDER"), 0,
41 N_("Specify source folder. FOLDER will become the current folder after the program exits.")}, 43 N_("Specify source folder. FOLDER will become the current folder after the program exits.")},
42 {"src", 0, NULL, OPTION_ALIAS, NULL}, 44 {"src", 0, NULL, OPTION_ALIAS, NULL},
43 {"file", 'F', N_("FILE"), 0, N_("Use FILE as the source message")}, 45 {"file", ARG_FILE, N_("FILE"), 0, N_("Use FILE as the source message")},
44 { 0 } 46 { 0 }
45 }; 47 };
46 48
...@@ -135,27 +137,27 @@ opt_handler (int key, char *arg, void *unused) ...@@ -135,27 +137,27 @@ opt_handler (int key, char *arg, void *unused)
135 switch (key) 137 switch (key)
136 { 138 {
137 case '+': 139 case '+':
138 case 'f': 140 case ARG_FOLDER:
139 add_folder (arg); 141 add_folder (arg);
140 break; 142 break;
141 143
142 case 'd': 144 case ARG_DRAFT:
143 source_file = mh_expand_name (NULL, "draft", 0); 145 source_file = mh_expand_name (NULL, "draft", 0);
144 break; 146 break;
145 147
146 case 'l': 148 case ARG_LINK:
147 link_flag = is_true(arg); 149 link_flag = is_true(arg);
148 break; 150 break;
149 151
150 case 'p': 152 case ARG_PRESERVE:
151 preserve_flag = is_true(arg); 153 preserve_flag = is_true(arg);
152 break; 154 break;
153 155
154 case 's': 156 case ARG_SOURCE:
155 current_folder = arg; 157 current_folder = arg;
156 break; 158 break;
157 159
158 case 'F': 160 case ARG_FILE:
159 source_file = arg; 161 source_file = arg;
160 break; 162 break;
161 163
...@@ -219,7 +221,7 @@ main (int argc, char **argv) ...@@ -219,7 +221,7 @@ main (int argc, char **argv)
219 mh_error (_("both message set and source file given")); 221 mh_error (_("both message set and source file given"));
220 exit (1); 222 exit (1);
221 } 223 }
222 mbox = mh_open_msg_file (source_file); 224 mbox = mh_open_msg_file (NULL, source_file);
223 mh_msgset_parse (mbox, &msgset, 0, NULL, "first"); 225 mh_msgset_parse (mbox, &msgset, 0, NULL, "first");
224 } 226 }
225 else 227 else
......
...@@ -23,49 +23,44 @@ ...@@ -23,49 +23,44 @@
23 23
24 const char *argp_program_version = "reply (" PACKAGE_STRING ")"; 24 const char *argp_program_version = "reply (" PACKAGE_STRING ")";
25 static char doc[] = N_("GNU MH repl\v" 25 static char doc[] = N_("GNU MH repl\v"
26 "Options marked with `*' are not yet implemented.\n"
26 "Use -help to obtain the list of traditional MH options."); 27 "Use -help to obtain the list of traditional MH options.");
27 static char args_doc[] = N_("[+folder] [msg]"); 28 static char args_doc[] = N_("[+folder] [msg]");
28 29
29 #define ARG_NOEDIT 1
30 #define ARG_FCC 2
31 #define ARG_FILTER 3
32 #define ARG_INPLACE 4
33 #define ARG_QUERY 5
34 #define ARG_WHATNOWPROC 6
35 #define ARG_NOWHATNOWPROC 7
36 #define ARG_NODRAFTFOLDER 8
37 30
38 /* GNU options */ 31 /* GNU options */
39 static struct argp_option options[] = { 32 static struct argp_option options[] = {
40 {"annotate", 'a', N_("BOOL"), OPTION_ARG_OPTIONAL, 33 {"annotate", ARG_ANNOTATE, N_("BOOL"), OPTION_ARG_OPTIONAL,
41 N_("Add Replied: header to the message being replied to")}, 34 N_("* Add Replied: header to the message being replied to")},
42 {"build", 'b', 0, 0, 35 {"build", ARG_BUILD, 0, 0,
43 N_("Build the draft and quit immediately.")}, 36 N_("Build the draft and quit immediately.")},
44 {"draftfolder", 'd', N_("FOLDER"), 0, 37 {"draftfolder", ARG_DRAFTFOLDER, N_("FOLDER"), 0,
45 N_("Specify the folder for message drafts")}, 38 N_("Specify the folder for message drafts")},
46 {"nodraftfolder", ARG_NODRAFTFOLDER, 0, 0, 39 {"nodraftfolder", ARG_NODRAFTFOLDER, 0, 0,
47 N_("Undo the effect of the last --draftfolder option")}, 40 N_("Undo the effect of the last --draftfolder option")},
48 {"draftmessage" , 'm', N_("MSG"), 0, 41 {"draftmessage" , ARG_DRAFTMESSAGE, N_("MSG"), 0,
49 N_("Invoke the draftmessage facility")}, 42 N_("Invoke the draftmessage facility")},
50 {"cc", 'c', "{all|to|cc|me}", 0, 43 {"cc", ARG_CC, "{all|to|cc|me}", 0,
51 N_("Specify whom to place on the Cc: list of the reply")}, 44 N_("Specify whom to place on the Cc: list of the reply")},
52 {"nocc", 'n', "{all|to|cc|me}", 0, 45 {"nocc", ARG_NOCC, "{all|to|cc|me}", 0,
53 N_("Specify whom to remove from the Cc: list of the reply")}, 46 N_("Specify whom to remove from the Cc: list of the reply")},
54 {"folder", 'f', N_("FOLDER"), 0, N_("Specify folder to operate upon")}, 47 {"folder", ARG_FOLDER, N_("FOLDER"), 0, N_("Specify folder to operate upon")},
55 {"editor", 'e', N_("PROG"), 0, N_("Set the editor program to use")}, 48 {"editor", ARG_EDITOR, N_("PROG"), 0, N_("Set the editor program to use")},
56 {"noedit", ARG_NOEDIT, 0, 0, N_("Suppress the initial edit")}, 49 {"noedit", ARG_NOEDIT, 0, 0, N_("Suppress the initial edit")},
57 {"fcc", ARG_FCC, N_("FOLDER"), 0, N_("Set the folder to receive Fcc's.")}, 50 {"fcc", ARG_FCC, N_("FOLDER"), 0, N_("* Set the folder to receive Fcc's.")},
58 {"filter", ARG_FILTER, N_("PROG"), 0, 51 {"filter", ARG_FILTER, N_("PROG"), 0,
59 N_("Set the filter program to preprocess the body of the message being replied")}, 52 N_("* Set the filter program to preprocess the body of the message being replied")},
60 {"form", 'F', N_("FILE"), 0, N_("Read format from given file")}, 53 {"form", ARG_FORM, N_("FILE"), 0, N_("Read format from given file")},
61 {"inplace", ARG_INPLACE, N_("BOOL"), OPTION_ARG_OPTIONAL, 54 {"inplace", ARG_INPLACE, N_("BOOL"), OPTION_ARG_OPTIONAL,
62 N_("Annotate the message in place")}, 55 N_("* Annotate the message in place")},
63 {"query", ARG_QUERY, N_("BOOL"), OPTION_ARG_OPTIONAL, 56 {"query", ARG_QUERY, N_("BOOL"), OPTION_ARG_OPTIONAL,
64 N_("Query for addresses to place in To: and Cc: lists")}, 57 N_("* Query for addresses to place in To: and Cc: lists")},
65 {"width", 'w', N_("NUMBER"), 0, N_("Set output width")}, 58 {"width", ARG_WIDTH, N_("NUMBER"), 0, N_("Set output width")},
66 {"whatnowproc", ARG_WHATNOWPROC, N_("PROG"), 0, 59 {"whatnowproc", ARG_WHATNOWPROC, N_("PROG"), 0,
67 N_("Set the replacement for whatnow program")}, 60 N_("* Set the replacement for whatnow program")},
68 {"use", 'u', N_("BOOL"), OPTION_ARG_OPTIONAL, N_("Use draft file preserved after the last session") }, 61 {"nowhatnowproc", ARG_NOWHATNOWPROC, NULL, 0,
62 N_("* Ignore whatnowproc variable. Use standard `whatnow' shell instead.")},
63 {"use", ARG_USE, N_("BOOL"), OPTION_ARG_OPTIONAL, N_("Use draft file preserved after the last session") },
69 { 0 } 64 { 0 }
70 }; 65 };
71 66
...@@ -133,47 +128,46 @@ opt_handler (int key, char *arg, void *unused) ...@@ -133,47 +128,46 @@ opt_handler (int key, char *arg, void *unused)
133 128
134 switch (key) 129 switch (key)
135 { 130 {
136 case 'b': 131 case ARG_BUILD:
137 case ARG_NOWHATNOWPROC:
138 build_only = 1; 132 build_only = 1;
139 break; 133 break;
140 134
141 case 'c': 135 case ARG_CC:
142 rcpt_mask |= decode_cc_flag ("-cc", arg); 136 rcpt_mask |= decode_cc_flag ("-cc", arg);
143 break; 137 break;
144 138
145 case 'n': 139 case ARG_NOCC:
146 rcpt_mask &= ~decode_cc_flag ("-nocc", arg); 140 rcpt_mask &= ~decode_cc_flag ("-nocc", arg);
147 break; 141 break;
148 142
149 case 'd': 143 case ARG_DRAFTFOLDER:
150 wh_env.draftfolder = arg; 144 wh_env.draftfolder = arg;
151 break; 145 break;
152 146
153 case 'e': 147 case ARG_EDITOR:
154 wh_env.editor = arg; 148 wh_env.editor = arg;
155 break; 149 break;
156 150
157 case '+': 151 case '+':
158 case 'f': 152 case ARG_FOLDER:
159 current_folder = arg; 153 current_folder = arg;
160 break; 154 break;
161 155
162 case 'F': 156 case ARG_FORM:
163 s = mh_expand_name (MHLIBDIR, arg, 0); 157 s = mh_expand_name (MHLIBDIR, arg, 0);
164 mh_read_formfile (s, &format_str); 158 mh_read_formfile (s, &format_str);
165 free (s); 159 free (s);
166 break; 160 break;
167 161
168 case 'm': 162 case ARG_DRAFTMESSAGE:
169 wh_env.draftmessage = arg; 163 wh_env.draftmessage = arg;
170 break; 164 break;
171 165
172 case 'u': 166 case ARG_USE:
173 use_draft = is_true (arg); 167 use_draft = is_true (arg);
174 break; 168 break;
175 169
176 case 'w': 170 case ARG_WIDTH:
177 width = strtoul (arg, NULL, 0); 171 width = strtoul (arg, NULL, 0);
178 if (!width) 172 if (!width)
179 { 173 {
...@@ -194,11 +188,12 @@ opt_handler (int key, char *arg, void *unused) ...@@ -194,11 +188,12 @@ opt_handler (int key, char *arg, void *unused)
194 query_mode = is_true (arg); 188 query_mode = is_true (arg);
195 break; 189 break;
196 190
197 case 'a': 191 case ARG_ANNOTATE:
198 case ARG_FCC: 192 case ARG_FCC:
199 case ARG_FILTER: 193 case ARG_FILTER:
200 case ARG_INPLACE: 194 case ARG_INPLACE:
201 case ARG_WHATNOWPROC: 195 case ARG_WHATNOWPROC:
196 case ARG_NOWHATNOWPROC:
202 mh_error (_("option is not yet implemented")); 197 mh_error (_("option is not yet implemented"));
203 exit (1); 198 exit (1);
204 199
......
...@@ -35,10 +35,12 @@ static char args_doc[] = N_("[+folder]"); ...@@ -35,10 +35,12 @@ static char args_doc[] = N_("[+folder]");
35 35
36 /* GNU options */ 36 /* GNU options */
37 static struct argp_option options[] = { 37 static struct argp_option options[] = {
38 {"folder", 'f', N_("FOLDER"), 0, N_("Specify the folder to delete")}, 38 {"folder", ARG_FOLDER, N_("FOLDER"), 0,
39 {"interactive", 'i', N_("BOOL"), OPTION_ARG_OPTIONAL, 39 N_("Specify the folder to delete")},
40 {"interactive", ARG_INTERACTIVE, N_("BOOL"), OPTION_ARG_OPTIONAL,
40 N_("Interactive mode: ask for confirmation before removing each folder")}, 41 N_("Interactive mode: ask for confirmation before removing each folder")},
41 {"recursive", 'r', NULL, 0, N_("Recursively delete all subfolders")}, 42 {"recursive", ARG_RECURSIVE, NULL, 0,
43 N_("Recursively delete all subfolders")},
42 { 0 } 44 { 0 }
43 }; 45 };
44 46
...@@ -58,16 +60,16 @@ opt_handler (int key, char *arg, void *unused) ...@@ -58,16 +60,16 @@ opt_handler (int key, char *arg, void *unused)
58 switch (key) 60 switch (key)
59 { 61 {
60 case '+': 62 case '+':
61 case 'f': 63 case ARG_FOLDER:
62 explicit_folder = 1; 64 explicit_folder = 1;
63 current_folder = arg; 65 current_folder = arg;
64 break; 66 break;
65 67
66 case 'i': 68 case ARG_INTERACTIVE:
67 interactive = is_true (arg); 69 interactive = is_true (arg);
68 break; 70 break;
69 71
70 case 'r': 72 case ARG_RECURSIVE:
71 recurse = is_true (arg); 73 recurse = is_true (arg);
72 break; 74 break;
73 75
......
...@@ -26,7 +26,8 @@ static char args_doc[] = N_("[+folder] [msgs]"); ...@@ -26,7 +26,8 @@ static char args_doc[] = N_("[+folder] [msgs]");
26 26
27 /* GNU options */ 27 /* GNU options */
28 static struct argp_option options[] = { 28 static struct argp_option options[] = {
29 {"folder", 'f', N_("FOLDER"), 0, N_("Specify folder to operate upon")}, 29 {"folder", ARG_FOLDER, N_("FOLDER"), 0,
30 N_("Specify folder to operate upon")},
30 { 0 } 31 { 0 }
31 }; 32 };
32 33
...@@ -41,7 +42,7 @@ opt_handler (int key, char *arg, void *unused) ...@@ -41,7 +42,7 @@ opt_handler (int key, char *arg, void *unused)
41 switch (key) 42 switch (key)
42 { 43 {
43 case '+': 44 case '+':
44 case 'f': 45 case ARG_FOLDER:
45 current_folder = arg; 46 current_folder = arg;
46 break; 47 break;
47 48
......
...@@ -33,17 +33,25 @@ static char args_doc[] = N_("[+folder] [msgs]"); ...@@ -33,17 +33,25 @@ static char args_doc[] = N_("[+folder] [msgs]");
33 33
34 /* GNU options */ 34 /* GNU options */
35 static struct argp_option options[] = { 35 static struct argp_option options[] = {
36 {"folder", 'f', N_("FOLDER"), 0, N_("Specify folder to scan")}, 36 {"folder", ARG_FOLDER, N_("FOLDER"), 0,
37 {"clear", 'c', N_("BOOL"), OPTION_ARG_OPTIONAL, 37 N_("Specify folder to scan")},
38 {"clear", ARG_CLEAR, N_("BOOL"), OPTION_ARG_OPTIONAL,
38 N_("Clear screen after displaying the list")}, 39 N_("Clear screen after displaying the list")},
39 {"form", 'F', N_("FILE"), 0, N_("Read format from given file")}, 40 {"form", ARG_FORM, N_("FILE"), 0,
40 {"format", 't', N_("FORMAT"), 0, N_("Use this format string")}, 41 N_("Read format from given file")},
41 {"header", 'H', N_("BOOL"), OPTION_ARG_OPTIONAL, N_("Display header")}, 42 {"format", ARG_FORMAT, N_("FORMAT"), 0,
42 {"width", 'w', N_("NUMBER"), 0, N_("Set output width")}, 43 N_("Use this format string")},
43 {"reverse", 'r', N_("BOOL"), OPTION_ARG_OPTIONAL, N_("List messages in reverse order")}, 44 {"header", ARG_HEADER, N_("BOOL"), OPTION_ARG_OPTIONAL,
44 {"file", 'i', N_("FILE"), 0, N_("[Not yet implemented]")}, 45 N_("Display header")},
46 {"width", ARG_WIDTH, N_("NUMBER"), 0,
47 N_("Set output width")},
48 {"reverse", ARG_REVERSE, N_("BOOL"), OPTION_ARG_OPTIONAL,
49 N_("List messages in reverse order")},
50 {"file", ARG_FILE, N_("FILE"), 0,
51 N_("[Not yet implemented]")},
45 52
46 {"license", 'l', 0, 0, N_("Display software license"), -1}, 53 {"license", ARG_LICENSE, 0, 0,
54 N_("Display software license"), -1},
47 55
48 { 0 } 56 { 0 }
49 }; 57 };
...@@ -81,27 +89,27 @@ opt_handler (int key, char *arg, void *unused) ...@@ -81,27 +89,27 @@ opt_handler (int key, char *arg, void *unused)
81 switch (key) 89 switch (key)
82 { 90 {
83 case '+': 91 case '+':
84 case 'f': 92 case ARG_FOLDER:
85 current_folder = arg; 93 current_folder = arg;
86 break; 94 break;
87 95
88 case 'c': 96 case ARG_CLEAR:
89 clear = is_true(arg); 97 clear = is_true(arg);
90 break; 98 break;
91 99
92 case 'F': 100 case ARG_FORM:
93 mh_read_formfile (arg, &format_str); 101 mh_read_formfile (arg, &format_str);
94 break; 102 break;
95 103
96 case 't': 104 case ARG_FORMAT:
97 format_str = arg; 105 format_str = arg;
98 break; 106 break;
99 107
100 case 'H': 108 case ARG_HEADER:
101 header = is_true(arg); 109 header = is_true(arg);
102 break; 110 break;
103 111
104 case 'w': 112 case ARG_WIDTH:
105 width = strtoul (arg, NULL, 0); 113 width = strtoul (arg, NULL, 0);
106 if (!width) 114 if (!width)
107 { 115 {
...@@ -110,15 +118,15 @@ opt_handler (int key, char *arg, void *unused) ...@@ -110,15 +118,15 @@ opt_handler (int key, char *arg, void *unused)
110 } 118 }
111 break; 119 break;
112 120
113 case 'r': 121 case ARG_REVERSE:
114 reverse = is_true(arg); 122 reverse = is_true(arg);
115 break; 123 break;
116 124
117 case 'i': 125 case ARG_FILE:
118 mh_error (_("'i' is not yet implemented.")); 126 mh_error (_("option is not yet implemented"));
119 break; 127 break;
120 128
121 case 'l': 129 case ARG_LICENSE:
122 mh_license (argp_program_version); 130 mh_license (argp_program_version);
123 break; 131 break;
124 132
......
...@@ -23,20 +23,17 @@ const char *argp_program_version = "whatnow (" PACKAGE_STRING ")"; ...@@ -23,20 +23,17 @@ const char *argp_program_version = "whatnow (" PACKAGE_STRING ")";
23 static char doc[] = "GNU MH whatnow"; 23 static char doc[] = "GNU MH whatnow";
24 static char args_doc[] = N_("[FILE]"); 24 static char args_doc[] = N_("[FILE]");
25 25
26 #define ARG_NODRAFTFOLDER 1
27 #define ARG_NOEDIT 2
28
29 /* GNU options */ 26 /* GNU options */
30 static struct argp_option options[] = { 27 static struct argp_option options[] = {
31 {"draftfolder", 'd', N_("FOLDER"), 0, 28 {"draftfolder", ARG_DRAFTFOLDER, N_("FOLDER"), 0,
32 N_("Specify the folder for message drafts")}, 29 N_("Specify the folder for message drafts")},
33 {"nodraftfolder", ARG_NODRAFTFOLDER, 0, 0, 30 {"nodraftfolder", ARG_NODRAFTFOLDER, 0, 0,
34 N_("Undo the effect of the last --draftfolder option")}, 31 N_("Undo the effect of the last --draftfolder option")},
35 {"draftmessage" , 'm', N_("MSG"), 0, 32 {"draftmessage" , ARG_DRAFTMESSAGE, N_("MSG"), 0,
36 N_("Invoke the draftmessage facility")}, 33 N_("Invoke the draftmessage facility")},
37 {"editor", 'e', N_("PROG"), 0, N_("Set the editor program to use")}, 34 {"editor", ARG_EDITOR, N_("PROG"), 0, N_("Set the editor program to use")},
38 {"noedit", ARG_NOEDIT, 0, 0, N_("Suppress the initial edit")}, 35 {"noedit", ARG_NOEDIT, 0, 0, N_("Suppress the initial edit")},
39 {"prompt", 'p', N_("STRING"), 0, N_("Set the prompt")}, 36 {"prompt", ARG_PROMPT, N_("STRING"), 0, N_("Set the prompt")},
40 { NULL } 37 { NULL }
41 }; 38 };
42 39
...@@ -59,11 +56,11 @@ opt_handler (int key, char *arg, void *unused) ...@@ -59,11 +56,11 @@ opt_handler (int key, char *arg, void *unused)
59 { 56 {
60 switch (key) 57 switch (key)
61 { 58 {
62 case 'd': 59 case ARG_DRAFTFOLDER:
63 wh_env.draftfolder = arg; 60 wh_env.draftfolder = arg;
64 break; 61 break;
65 62
66 case 'e': 63 case ARG_EDITOR:
67 wh_env.editor = arg; 64 wh_env.editor = arg;
68 break; 65 break;
69 66
...@@ -75,11 +72,11 @@ opt_handler (int key, char *arg, void *unused) ...@@ -75,11 +72,11 @@ opt_handler (int key, char *arg, void *unused)
75 initial_edit = 0; 72 initial_edit = 0;
76 break; 73 break;
77 74
78 case 'm': 75 case ARG_DRAFTMESSAGE:
79 wh_env.draftmessage = arg; 76 wh_env.draftmessage = arg;
80 break; 77 break;
81 78
82 case 'p': 79 case ARG_PROMPT:
83 wh_env.prompt = arg; 80 wh_env.prompt = arg;
84 break; 81 break;
85 82
......