1 /* $Id: rc.c,v 1.106 2007/05/23 15:06:06 inu Exp $ */
3 * Initialization file etc.
23 struct param_section {
25 struct param_ptr *params;
28 struct rc_search_table {
29 struct param_ptr *param;
33 static struct rc_search_table *RC_search_table;
34 static int RC_table_size;
41 #if defined(USE_SSL) && defined(USE_SSL_VERIFY)
54 /* FIXME: gettextize here */
56 static wc_ces OptionCharset = WC_CES_US_ASCII; /* FIXME: charset of source code */
57 static int OptionEncode = FALSE;
60 #define CMT_HELPER N_("External Viewer Setup")
61 #define CMT_TABSTOP N_("Tab width in characters")
62 #define CMT_INDENT_INCR N_("Indent for HTML rendering")
63 #define CMT_PIXEL_PER_CHAR N_("Number of pixels per character (4.0...32.0)")
64 #define CMT_PIXEL_PER_LINE N_("Number of pixels per line (4.0...64.0)")
65 #define CMT_PAGERLINE N_("Number of remembered lines when used as a pager")
66 #define CMT_HISTORY N_("Use URL history")
67 #define CMT_HISTSIZE N_("Number of remembered URL")
68 #define CMT_SAVEHIST N_("Save URL history")
69 #define CMT_FRAME N_("Render frames automatically")
70 #define CMT_ARGV_IS_URL N_("Treat argument without scheme as URL")
71 #define CMT_TSELF N_("Use _self as default target")
72 #define CMT_OPEN_TAB_BLANK N_("Open link on new tab if target is _blank or _new")
73 #define CMT_OPEN_TAB_DL_LIST N_("Open download list panel on new tab")
74 #define CMT_DISPLINK N_("Display link URL automatically")
75 #define CMT_DECODE_URL N_("Display decoded URL")
76 #define CMT_DISPLINEINFO N_("Display current line number")
77 #define CMT_DISP_IMAGE N_("Display inline images")
79 #define CMT_AUTO_IMAGE N_("Load inline images automatically")
80 #define CMT_MAX_LOAD_IMAGE N_("Maximum processes for parallel image loading")
81 #define CMT_EXT_IMAGE_VIEWER N_("Use external image viewer")
82 #define CMT_IMAGE_SCALE N_("Scale of image (%)")
83 #define CMT_IMGDISPLAY N_("External command to display image")
84 #define CMT_IMAGE_MAP_LIST N_("Use link list of image map")
86 #define CMT_MULTICOL N_("Display file names in multi-column format")
87 #define CMT_ALT_ENTITY N_("Use ASCII equivalents to display entities")
88 #define CMT_GRAPHIC_CHAR N_("Use graphic char for border of table and menu")
89 #define CMT_FOLD_TEXTAREA N_("Fold lines in TEXTAREA")
90 #define CMT_DISP_INS_DEL N_("Display INS, DEL, S and STRIKE element")
91 #define CMT_COLOR N_("Display with color")
92 #define CMT_B_COLOR N_("Color of normal character")
93 #define CMT_A_COLOR N_("Color of anchor")
94 #define CMT_I_COLOR N_("Color of image link")
95 #define CMT_F_COLOR N_("Color of form")
96 #define CMT_ACTIVE_STYLE N_("Enable coloring of active link")
97 #define CMT_C_COLOR N_("Color of currently active link")
98 #define CMT_VISITED_ANCHOR N_("Use visited link color")
99 #define CMT_V_COLOR N_("Color of visited link")
100 #define CMT_BG_COLOR N_("Color of background")
101 #define CMT_MARK_COLOR N_("Color of mark")
102 #define CMT_USE_PROXY N_("Use proxy")
103 #define CMT_HTTP_PROXY N_("URL of HTTP proxy host")
105 #define CMT_HTTPS_PROXY N_("URL of HTTPS proxy host")
108 #define CMT_GOPHER_PROXY N_("URL of GOPHER proxy host")
109 #endif /* USE_GOPHER */
110 #define CMT_FTP_PROXY N_("URL of FTP proxy host")
111 #define CMT_NO_PROXY N_("Domains to be accessed directly (no proxy)")
112 #define CMT_NOPROXY_NETADDR N_("Check noproxy by network address")
113 #define CMT_NO_CACHE N_("Disable cache")
115 #define CMT_NNTP_SERVER N_("News server")
116 #define CMT_NNTP_MODE N_("Mode of news server")
117 #define CMT_MAX_NEWS N_("Number of news messages")
119 #define CMT_DNS_ORDER N_("Order of name resolution")
120 #define CMT_DROOT N_("Directory corresponding to / (document root)")
121 #define CMT_PDROOT N_("Directory corresponding to /~user")
122 #define CMT_CGIBIN N_("Directory corresponding to /cgi-bin")
123 #define CMT_CONFIRM_QQ N_("Confirm when quitting with q")
124 #define CMT_CLOSE_TAB_BACK N_("Close tab if buffer is last when back")
126 #define CMT_USE_MARK N_("Enable mark operations")
128 #define CMT_EMACS_LIKE_LINEEDIT N_("Enable Emacs-style line editing")
129 #define CMT_VI_PREC_NUM N_("Enable vi-like numeric prefix")
130 #define CMT_LABEL_TOPLINE N_("Move cursor to top line when going to label")
131 #define CMT_NEXTPAGE_TOPLINE N_("Move cursor to top line when moving to next page")
132 #define CMT_FOLD_LINE N_("Fold lines of plain text file")
133 #define CMT_SHOW_NUM N_("Show line numbers")
134 #define CMT_SHOW_SRCH_STR N_("Show search string")
135 #define CMT_MIMETYPES N_("List of mime.types files")
136 #define CMT_MAILCAP N_("List of mailcap files")
137 #define CMT_URIMETHODMAP N_("List of urimethodmap files")
138 #define CMT_EDITOR N_("Editor")
139 #define CMT_MAILER N_("Mailer")
140 #define CMT_EXTBRZ N_("External Browser")
141 #define CMT_EXTBRZ2 N_("Second External Browser")
142 #define CMT_EXTBRZ3 N_("Third External Browser")
143 #define CMT_DISABLE_SECRET_SECURITY_CHECK N_("Disable secret file security check")
144 #define CMT_PASSWDFILE N_("Password file")
145 #define CMT_PRE_FORM_FILE N_("File for setting form on loading")
146 #define CMT_FTPPASS N_("Password for anonymous FTP (your mail address)")
147 #define CMT_FTPPASS_HOSTNAMEGEN N_("Generate domain part of password for FTP")
148 #define CMT_USERAGENT N_("User-Agent identification string")
149 #define CMT_ACCEPTENCODING N_("Accept-Encoding header")
150 #define CMT_ACCEPTMEDIA N_("Accept header")
151 #define CMT_ACCEPTLANG N_("Accept-Language header")
152 #define CMT_MARK_ALL_PAGES N_("Treat URL-like strings as links in all pages")
153 #define CMT_WRAP N_("Wrap search")
154 #define CMT_VIEW_UNSEENOBJECTS N_("Display unseen objects (e.g. bgimage tag)")
155 #define CMT_AUTO_UNCOMPRESS N_("Uncompress compressed data automatically when downloading")
157 #define CMT_BGEXTVIEW N_("Run external viewer in a separate session")
159 #define CMT_BGEXTVIEW N_("Run external viewer in the background")
161 #define CMT_EXT_DIRLIST N_("Use external program for directory listing")
162 #define CMT_DIRLIST_CMD N_("URL of directory listing command")
164 #define CMT_USE_DICTCOMMAND N_("Enable dictionary lookup through CGI")
165 #define CMT_DICTCOMMAND N_("URL of dictionary lookup command")
166 #endif /* USE_DICT */
167 #define CMT_IGNORE_NULL_IMG_ALT N_("Display link name for images lacking ALT")
168 #define CMT_IFILE N_("Index file for directories")
169 #define CMT_RETRY_HTTP N_("Prepend http:// to URL automatically")
170 #define CMT_DEFAULT_URL N_("Default value for open-URL command")
171 #define CMT_DECODE_CTE N_("Decode Content-Transfer-Encoding when saving")
172 #define CMT_PRESERVE_TIMESTAMP N_("Preserve timestamp when saving")
174 #define CMT_MOUSE N_("Enable mouse")
175 #define CMT_REVERSE_MOUSE N_("Scroll in reverse direction of mouse drag")
176 #define CMT_RELATIVE_WHEEL_SCROLL N_("Behavior of wheel scroll speed")
177 #define CMT_RELATIVE_WHEEL_SCROLL_RATIO N_("(A only)Scroll by # (%) of screen")
178 #define CMT_FIXED_WHEEL_SCROLL_COUNT N_("(B only)Scroll by # lines")
179 #endif /* USE_MOUSE */
180 #define CMT_CLEAR_BUF N_("Free memory of undisplayed buffers")
181 #define CMT_NOSENDREFERER N_("Suppress `Referer:' header")
182 #define CMT_IGNORE_CASE N_("Search case-insensitively")
183 #define CMT_USE_LESSOPEN N_("Use LESSOPEN")
185 #ifdef USE_SSL_VERIFY
186 #define CMT_SSL_VERIFY_SERVER N_("Perform SSL server verification")
187 #define CMT_SSL_CERT_FILE N_("PEM encoded certificate file of client")
188 #define CMT_SSL_KEY_FILE N_("PEM encoded private key file of client")
189 #define CMT_SSL_CA_PATH N_("Path to directory for PEM encoded certificates of CAs")
190 #define CMT_SSL_CA_FILE N_("File consisting of PEM encoded certificates of CAs")
191 #endif /* USE_SSL_VERIFY */
192 #define CMT_SSL_FORBID_METHOD N_("List of forbidden SSL methods (2: SSLv2, 3: SSLv3, t:TLSv1)")
195 #define CMT_USECOOKIE N_("Enable cookie processing")
196 #define CMT_SHOWCOOKIE N_("Print a message when receiving a cookie")
197 #define CMT_ACCEPTCOOKIE N_("Accept cookies")
198 #define CMT_ACCEPTBADCOOKIE N_("Action to be taken on invalid cookie")
199 #define CMT_COOKIE_REJECT_DOMAINS N_("Domains to reject cookies from")
200 #define CMT_COOKIE_ACCEPT_DOMAINS N_("Domains to accept cookies from")
202 #define CMT_FOLLOW_REDIRECTION N_("Number of redirections to follow")
203 #define CMT_META_REFRESH N_("Enable processing of meta-refresh tag")
206 #define CMT_USE_MIGEMO N_("Enable Migemo (Roma-ji search)")
207 #define CMT_MIGEMO_COMMAND N_("Migemo command")
208 #endif /* USE_MIGEMO */
211 #define CMT_DISPLAY_CHARSET N_("Display charset")
212 #define CMT_DOCUMENT_CHARSET N_("Default document charset")
213 #define CMT_AUTO_DETECT N_("Automatic charset detect when loading")
214 #define CMT_SYSTEM_CHARSET N_("System charset")
215 #define CMT_FOLLOW_LOCALE N_("System charset follows locale(LC_CTYPE)")
216 #define CMT_EXT_HALFDUMP N_("Output halfdump with display charset")
217 #define CMT_USE_WIDE N_("Use multi column characters")
218 #define CMT_USE_COMBINING N_("Use combining characters")
219 #define CMT_USE_LANGUAGE_TAG N_("Use Unicode language tags")
220 #define CMT_UCS_CONV N_("Charset conversion using Unicode map")
221 #define CMT_PRE_CONV N_("Charset conversion when loading")
222 #define CMT_SEARCH_CONV N_("Adjust search string for document charset")
223 #define CMT_FIX_WIDTH_CONV N_("Fix character width when conversion")
224 #define CMT_USE_GB12345_MAP N_("Use GB 12345 Unicode map instead of GB 2312's")
225 #define CMT_USE_JISX0201 N_("Use JIS X 0201 Roman for ISO-2022-JP")
226 #define CMT_USE_JISC6226 N_("Use JIS C 6226:1978 for ISO-2022-JP")
227 #define CMT_USE_JISX0201K N_("Use JIS X 0201 Katakana")
228 #define CMT_USE_JISX0212 N_("Use JIS X 0212:1990 (Supplemental Kanji)")
229 #define CMT_USE_JISX0213 N_("Use JIS X 0213:2000 (2000JIS)")
230 #define CMT_STRICT_ISO2022 N_("Strict ISO-2022-JP/KR/CN")
231 #define CMT_GB18030_AS_UCS N_("Treat 4 bytes char. of GB18030 as Unicode")
234 #define CMT_KEYMAP_FILE N_("keymap file")
250 static struct sel_c colorstr[] = {
251 {0, "black", N_("black")},
252 {1, "red", N_("red")},
253 {2, "green", N_("green")},
254 {3, "yellow", N_("yellow")},
255 {4, "blue", N_("blue")},
256 {5, "magenta", N_("magenta")},
257 {6, "cyan", N_("cyan")},
258 {7, "white", N_("white")},
259 {8, "terminal", N_("terminal")},
262 #endif /* USE_COLOR */
266 #define N_S(x) (x), N_STR(x)
267 #else /* for traditional cpp? */
268 static char n_s[][2] = {
273 #define N_S(x) (x), n_s[(x)]
277 static struct sel_c defaulturls[] = {
278 {N_S(DEFAULT_URL_EMPTY), N_("none")},
279 {N_S(DEFAULT_URL_CURRENT), N_("current URL")},
280 {N_S(DEFAULT_URL_LINK), N_("link URL")},
284 static struct sel_c displayinsdel[] = {
285 {N_S(DISPLAY_INS_DEL_SIMPLE), N_("simple")},
286 {N_S(DISPLAY_INS_DEL_NORMAL), N_("use tag")},
287 {N_S(DISPLAY_INS_DEL_FONTIFY), N_("fontify")},
292 static struct sel_c wheelmode[] = {
293 {TRUE, "1", N_("A:relative to screen height")},
294 {FALSE, "0", N_("B:fixed speed")},
300 static struct sel_c dnsorders[] = {
301 {N_S(DNS_ORDER_UNSPEC), N_("unspecified")},
302 {N_S(DNS_ORDER_INET_INET6), N_("inet inet6")},
303 {N_S(DNS_ORDER_INET6_INET), N_("inet6 inet")},
304 {N_S(DNS_ORDER_INET_ONLY), N_("inet only")},
305 {N_S(DNS_ORDER_INET6_ONLY), N_("inet6 only")},
311 static struct sel_c badcookiestr[] = {
312 {N_S(ACCEPT_BAD_COOKIE_DISCARD), N_("discard")},
314 {N_S(ACCEPT_BAD_COOKIE_ACCEPT), N_("accept")},
316 {N_S(ACCEPT_BAD_COOKIE_ASK), N_("ask")},
319 #endif /* USE_COOKIE */
322 static wc_ces_list *display_charset_str = NULL;
323 static wc_ces_list *document_charset_str = NULL;
324 static wc_ces_list *system_charset_str = NULL;
325 static struct sel_c auto_detect_str[] = {
326 {N_S(WC_OPT_DETECT_OFF), N_("OFF")},
327 {N_S(WC_OPT_DETECT_ISO_2022), N_("Only ISO 2022")},
328 {N_S(WC_OPT_DETECT_ON), N_("ON")},
333 struct param_ptr params1[] = {
334 {"tabstop", P_NZINT, PI_TEXT, (void *)&Tabstop, CMT_TABSTOP, NULL},
335 {"indent_incr", P_NZINT, PI_TEXT, (void *)&IndentIncr, CMT_INDENT_INCR,
337 {"pixel_per_char", P_PIXELS, PI_TEXT, (void *)&pixel_per_char,
338 CMT_PIXEL_PER_CHAR, NULL},
340 {"pixel_per_line", P_PIXELS, PI_TEXT, (void *)&pixel_per_line,
341 CMT_PIXEL_PER_LINE, NULL},
343 {"frame", P_CHARINT, PI_ONOFF, (void *)&RenderFrame, CMT_FRAME, NULL},
344 {"target_self", P_CHARINT, PI_ONOFF, (void *)&TargetSelf, CMT_TSELF, NULL},
345 {"open_tab_blank", P_INT, PI_ONOFF, (void *)&open_tab_blank,
346 CMT_OPEN_TAB_BLANK, NULL},
347 {"open_tab_dl_list", P_INT, PI_ONOFF, (void *)&open_tab_dl_list,
348 CMT_OPEN_TAB_DL_LIST, NULL},
349 {"display_link", P_INT, PI_ONOFF, (void *)&displayLink, CMT_DISPLINK,
351 {"decode_url", P_INT, PI_ONOFF, (void *)&DecodeURL, CMT_DECODE_URL, NULL},
352 {"display_lineinfo", P_INT, PI_ONOFF, (void *)&displayLineInfo,
353 CMT_DISPLINEINFO, NULL},
354 {"ext_dirlist", P_INT, PI_ONOFF, (void *)&UseExternalDirBuffer,
355 CMT_EXT_DIRLIST, NULL},
356 {"dirlist_cmd", P_STRING, PI_TEXT, (void *)&DirBufferCommand,
357 CMT_DIRLIST_CMD, NULL},
359 {"use_dictcommand", P_INT, PI_ONOFF, (void *)&UseDictCommand,
360 CMT_USE_DICTCOMMAND, NULL},
361 {"dictcommand", P_STRING, PI_TEXT, (void *)&DictCommand,
362 CMT_DICTCOMMAND, NULL},
363 #endif /* USE_DICT */
364 {"multicol", P_INT, PI_ONOFF, (void *)&multicolList, CMT_MULTICOL, NULL},
365 {"alt_entity", P_CHARINT, PI_ONOFF, (void *)&UseAltEntity, CMT_ALT_ENTITY,
367 {"graphic_char", P_CHARINT, PI_ONOFF, (void *)&UseGraphicChar,
368 CMT_GRAPHIC_CHAR, NULL},
369 {"fold_textarea", P_CHARINT, PI_ONOFF, (void *)&FoldTextarea,
370 CMT_FOLD_TEXTAREA, NULL},
371 {"display_ins_del", P_INT, PI_SEL_C, (void *)&displayInsDel,
372 CMT_DISP_INS_DEL, displayinsdel},
373 {"ignore_null_img_alt", P_INT, PI_ONOFF, (void *)&ignore_null_img_alt,
374 CMT_IGNORE_NULL_IMG_ALT, NULL},
375 {"view_unseenobject", P_INT, PI_ONOFF, (void *)&view_unseenobject,
376 CMT_VIEW_UNSEENOBJECTS, NULL},
377 /* XXX: emacs-w3m force to off display_image even if image options off */
378 {"display_image", P_INT, PI_ONOFF, (void *)&displayImage, CMT_DISP_IMAGE,
381 {"auto_image", P_INT, PI_ONOFF, (void *)&autoImage, CMT_AUTO_IMAGE, NULL},
382 {"max_load_image", P_INT, PI_TEXT, (void *)&maxLoadImage,
383 CMT_MAX_LOAD_IMAGE, NULL},
384 {"ext_image_viewer", P_INT, PI_ONOFF, (void *)&useExtImageViewer,
385 CMT_EXT_IMAGE_VIEWER, NULL},
386 {"image_scale", P_SCALE, PI_TEXT, (void *)&image_scale, CMT_IMAGE_SCALE,
388 {"imgdisplay", P_STRING, PI_TEXT, (void *)&Imgdisplay, CMT_IMGDISPLAY,
390 {"image_map_list", P_INT, PI_ONOFF, (void *)&image_map_list,
391 CMT_IMAGE_MAP_LIST, NULL},
393 {"fold_line", P_INT, PI_ONOFF, (void *)&FoldLine, CMT_FOLD_LINE, NULL},
394 {"show_lnum", P_INT, PI_ONOFF, (void *)&showLineNum, CMT_SHOW_NUM, NULL},
395 {"show_srch_str", P_INT, PI_ONOFF, (void *)&show_srch_str,
396 CMT_SHOW_SRCH_STR, NULL},
397 {"label_topline", P_INT, PI_ONOFF, (void *)&label_topline,
398 CMT_LABEL_TOPLINE, NULL},
399 {"nextpage_topline", P_INT, PI_ONOFF, (void *)&nextpage_topline,
400 CMT_NEXTPAGE_TOPLINE, NULL},
401 {NULL, 0, 0, NULL, NULL, NULL},
405 struct param_ptr params2[] = {
406 {"color", P_INT, PI_ONOFF, (void *)&useColor, CMT_COLOR, NULL},
407 {"basic_color", P_COLOR, PI_SEL_C, (void *)&basic_color, CMT_B_COLOR,
409 {"anchor_color", P_COLOR, PI_SEL_C, (void *)&anchor_color, CMT_A_COLOR,
411 {"image_color", P_COLOR, PI_SEL_C, (void *)&image_color, CMT_I_COLOR,
413 {"form_color", P_COLOR, PI_SEL_C, (void *)&form_color, CMT_F_COLOR,
416 {"mark_color", P_COLOR, PI_SEL_C, (void *)&mark_color, CMT_MARK_COLOR,
418 {"bg_color", P_COLOR, PI_SEL_C, (void *)&bg_color, CMT_BG_COLOR,
420 #endif /* USE_BG_COLOR */
421 {"active_style", P_INT, PI_ONOFF, (void *)&useActiveColor,
422 CMT_ACTIVE_STYLE, NULL},
423 {"active_color", P_COLOR, PI_SEL_C, (void *)&active_color, CMT_C_COLOR,
425 {"visited_anchor", P_INT, PI_ONOFF, (void *)&useVisitedColor,
426 CMT_VISITED_ANCHOR, NULL},
427 {"visited_color", P_COLOR, PI_SEL_C, (void *)&visited_color, CMT_V_COLOR,
429 {NULL, 0, 0, NULL, NULL, NULL},
431 #endif /* USE_COLOR */
434 struct param_ptr params3[] = {
435 {"pagerline", P_NZINT, PI_TEXT, (void *)&PagerMax, CMT_PAGERLINE, NULL},
437 {"use_history", P_INT, PI_ONOFF, (void *)&UseHistory, CMT_HISTORY, NULL},
438 {"history", P_INT, PI_TEXT, (void *)&URLHistSize, CMT_HISTSIZE, NULL},
439 {"save_hist", P_INT, PI_ONOFF, (void *)&SaveURLHist, CMT_SAVEHIST, NULL},
440 #endif /* USE_HISTORY */
441 {"confirm_qq", P_INT, PI_ONOFF, (void *)&confirm_on_quit, CMT_CONFIRM_QQ,
443 {"close_tab_back", P_INT, PI_ONOFF, (void *)&close_tab_back,
444 CMT_CLOSE_TAB_BACK, NULL},
446 {"mark", P_INT, PI_ONOFF, (void *)&use_mark, CMT_USE_MARK, NULL},
448 {"emacs_like_lineedit", P_INT, PI_ONOFF, (void *)&emacs_like_lineedit,
449 CMT_EMACS_LIKE_LINEEDIT, NULL},
450 {"vi_prec_num", P_INT, PI_ONOFF, (void *)&vi_prec_num, CMT_VI_PREC_NUM,
452 {"mark_all_pages", P_INT, PI_ONOFF, (void *)&MarkAllPages,
453 CMT_MARK_ALL_PAGES, NULL},
454 {"wrap_search", P_INT, PI_ONOFF, (void *)&WrapDefault, CMT_WRAP, NULL},
455 {"ignorecase_search", P_INT, PI_ONOFF, (void *)&IgnoreCase,
456 CMT_IGNORE_CASE, NULL},
458 {"use_migemo", P_INT, PI_ONOFF, (void *)&use_migemo, CMT_USE_MIGEMO,
460 {"migemo_command", P_STRING, PI_TEXT, (void *)&migemo_command,
461 CMT_MIGEMO_COMMAND, NULL},
462 #endif /* USE_MIGEMO */
464 {"use_mouse", P_INT, PI_ONOFF, (void *)&use_mouse, CMT_MOUSE, NULL},
465 {"reverse_mouse", P_INT, PI_ONOFF, (void *)&reverse_mouse,
466 CMT_REVERSE_MOUSE, NULL},
467 {"relative_wheel_scroll", P_INT, PI_SEL_C, (void *)&relative_wheel_scroll,
468 CMT_RELATIVE_WHEEL_SCROLL, (void *)wheelmode},
469 {"relative_wheel_scroll_ratio", P_INT, PI_TEXT,
470 (void *)&relative_wheel_scroll_ratio,
471 CMT_RELATIVE_WHEEL_SCROLL_RATIO, NULL},
472 {"fixed_wheel_scroll_count", P_INT, PI_TEXT,
473 (void *)&fixed_wheel_scroll_count,
474 CMT_FIXED_WHEEL_SCROLL_COUNT, NULL},
475 #endif /* USE_MOUSE */
476 {"clear_buffer", P_INT, PI_ONOFF, (void *)&clear_buffer, CMT_CLEAR_BUF,
478 {"decode_cte", P_CHARINT, PI_ONOFF, (void *)&DecodeCTE, CMT_DECODE_CTE,
480 {"auto_uncompress", P_CHARINT, PI_ONOFF, (void *)&AutoUncompress,
481 CMT_AUTO_UNCOMPRESS, NULL},
482 {"preserve_timestamp", P_CHARINT, PI_ONOFF, (void *)&PreserveTimestamp,
483 CMT_PRESERVE_TIMESTAMP, NULL},
484 {"keymap_file", P_STRING, PI_TEXT, (void *)&keymap_file, CMT_KEYMAP_FILE,
486 {NULL, 0, 0, NULL, NULL, NULL},
489 struct param_ptr params4[] = {
490 {"use_proxy", P_CHARINT, PI_ONOFF, (void *)&use_proxy, CMT_USE_PROXY,
492 {"http_proxy", P_STRING, PI_TEXT, (void *)&HTTP_proxy, CMT_HTTP_PROXY,
495 {"https_proxy", P_STRING, PI_TEXT, (void *)&HTTPS_proxy, CMT_HTTPS_PROXY,
499 {"gopher_proxy", P_STRING, PI_TEXT, (void *)&GOPHER_proxy,
500 CMT_GOPHER_PROXY, NULL},
501 #endif /* USE_GOPHER */
502 {"ftp_proxy", P_STRING, PI_TEXT, (void *)&FTP_proxy, CMT_FTP_PROXY, NULL},
503 {"no_proxy", P_STRING, PI_TEXT, (void *)&NO_proxy, CMT_NO_PROXY, NULL},
504 {"noproxy_netaddr", P_INT, PI_ONOFF, (void *)&NOproxy_netaddr,
505 CMT_NOPROXY_NETADDR, NULL},
506 {"no_cache", P_CHARINT, PI_ONOFF, (void *)&NoCache, CMT_NO_CACHE, NULL},
508 {NULL, 0, 0, NULL, NULL, NULL},
511 struct param_ptr params5[] = {
512 {"document_root", P_STRING, PI_TEXT, (void *)&document_root, CMT_DROOT,
514 {"personal_document_root", P_STRING, PI_TEXT,
515 (void *)&personal_document_root, CMT_PDROOT, NULL},
516 {"cgi_bin", P_STRING, PI_TEXT, (void *)&cgi_bin, CMT_CGIBIN, NULL},
517 {"index_file", P_STRING, PI_TEXT, (void *)&index_file, CMT_IFILE, NULL},
518 {NULL, 0, 0, NULL, NULL, NULL},
521 struct param_ptr params6[] = {
522 {"mime_types", P_STRING, PI_TEXT, (void *)&mimetypes_files, CMT_MIMETYPES,
524 {"mailcap", P_STRING, PI_TEXT, (void *)&mailcap_files, CMT_MAILCAP, NULL},
525 #ifdef USE_EXTERNAL_URI_LOADER
526 {"urimethodmap", P_STRING, PI_TEXT, (void *)&urimethodmap_files,
527 CMT_URIMETHODMAP, NULL},
529 {"editor", P_STRING, PI_TEXT, (void *)&Editor, CMT_EDITOR, NULL},
530 {"mailer", P_STRING, PI_TEXT, (void *)&Mailer, CMT_MAILER, NULL},
531 {"extbrowser", P_STRING, PI_TEXT, (void *)&ExtBrowser, CMT_EXTBRZ, NULL},
532 {"extbrowser2", P_STRING, PI_TEXT, (void *)&ExtBrowser2, CMT_EXTBRZ2,
534 {"extbrowser3", P_STRING, PI_TEXT, (void *)&ExtBrowser3, CMT_EXTBRZ3,
536 {"bgextviewer", P_INT, PI_ONOFF, (void *)&BackgroundExtViewer,
537 CMT_BGEXTVIEW, NULL},
538 {"use_lessopen", P_INT, PI_ONOFF, (void *)&use_lessopen, CMT_USE_LESSOPEN,
540 {NULL, 0, 0, NULL, NULL, NULL},
544 struct param_ptr params7[] = {
545 {"ssl_forbid_method", P_STRING, PI_TEXT, (void *)&ssl_forbid_method,
546 CMT_SSL_FORBID_METHOD, NULL},
547 #ifdef USE_SSL_VERIFY
548 {"ssl_verify_server", P_INT, PI_ONOFF, (void *)&ssl_verify_server,
549 CMT_SSL_VERIFY_SERVER, NULL},
550 {"ssl_cert_file", P_SSLPATH, PI_TEXT, (void *)&ssl_cert_file,
551 CMT_SSL_CERT_FILE, NULL},
552 {"ssl_key_file", P_SSLPATH, PI_TEXT, (void *)&ssl_key_file,
553 CMT_SSL_KEY_FILE, NULL},
554 {"ssl_ca_path", P_SSLPATH, PI_TEXT, (void *)&ssl_ca_path, CMT_SSL_CA_PATH,
556 {"ssl_ca_file", P_SSLPATH, PI_TEXT, (void *)&ssl_ca_file, CMT_SSL_CA_FILE,
558 #endif /* USE_SSL_VERIFY */
559 {NULL, 0, 0, NULL, NULL, NULL},
564 struct param_ptr params8[] = {
565 {"use_cookie", P_INT, PI_ONOFF, (void *)&use_cookie, CMT_USECOOKIE, NULL},
566 {"show_cookie", P_INT, PI_ONOFF, (void *)&show_cookie,
567 CMT_SHOWCOOKIE, NULL},
568 {"accept_cookie", P_INT, PI_ONOFF, (void *)&accept_cookie,
569 CMT_ACCEPTCOOKIE, NULL},
570 {"accept_bad_cookie", P_INT, PI_SEL_C, (void *)&accept_bad_cookie,
571 CMT_ACCEPTBADCOOKIE, (void *)badcookiestr},
572 {"cookie_reject_domains", P_STRING, PI_TEXT,
573 (void *)&cookie_reject_domains, CMT_COOKIE_REJECT_DOMAINS, NULL},
574 {"cookie_accept_domains", P_STRING, PI_TEXT,
575 (void *)&cookie_accept_domains, CMT_COOKIE_ACCEPT_DOMAINS, NULL},
576 {NULL, 0, 0, NULL, NULL, NULL},
580 struct param_ptr params9[] = {
581 {"passwd_file", P_STRING, PI_TEXT, (void *)&passwd_file, CMT_PASSWDFILE,
583 {"disable_secret_security_check", P_INT, PI_ONOFF,
584 (void *)&disable_secret_security_check, CMT_DISABLE_SECRET_SECURITY_CHECK,
586 {"ftppasswd", P_STRING, PI_TEXT, (void *)&ftppasswd, CMT_FTPPASS, NULL},
587 {"ftppass_hostnamegen", P_INT, PI_ONOFF, (void *)&ftppass_hostnamegen,
588 CMT_FTPPASS_HOSTNAMEGEN, NULL},
589 {"pre_form_file", P_STRING, PI_TEXT, (void *)&pre_form_file,
590 CMT_PRE_FORM_FILE, NULL},
591 {"user_agent", P_STRING, PI_TEXT, (void *)&UserAgent, CMT_USERAGENT, NULL},
592 {"no_referer", P_INT, PI_ONOFF, (void *)&NoSendReferer, CMT_NOSENDREFERER,
594 {"accept_language", P_STRING, PI_TEXT, (void *)&AcceptLang, CMT_ACCEPTLANG,
596 {"accept_encoding", P_STRING, PI_TEXT, (void *)&AcceptEncoding,
599 {"accept_media", P_STRING, PI_TEXT, (void *)&AcceptMedia, CMT_ACCEPTMEDIA,
601 {"argv_is_url", P_CHARINT, PI_ONOFF, (void *)&ArgvIsURL, CMT_ARGV_IS_URL,
603 {"retry_http", P_INT, PI_ONOFF, (void *)&retryAsHttp, CMT_RETRY_HTTP,
605 {"default_url", P_INT, PI_SEL_C, (void *)&DefaultURLString,
606 CMT_DEFAULT_URL, (void *)defaulturls},
607 {"follow_redirection", P_INT, PI_TEXT, &FollowRedirection,
608 CMT_FOLLOW_REDIRECTION, NULL},
609 {"meta_refresh", P_CHARINT, PI_ONOFF, (void *)&MetaRefresh,
610 CMT_META_REFRESH, NULL},
612 {"dns_order", P_INT, PI_SEL_C, (void *)&DNS_order, CMT_DNS_ORDER,
616 {"nntpserver", P_STRING, PI_TEXT, (void *)&NNTP_server, CMT_NNTP_SERVER,
618 {"nntpmode", P_STRING, PI_TEXT, (void *)&NNTP_mode, CMT_NNTP_MODE, NULL},
619 {"max_news", P_INT, PI_TEXT, (void *)&MaxNewsMessage, CMT_MAX_NEWS, NULL},
621 {NULL, 0, 0, NULL, NULL, NULL},
625 struct param_ptr params10[] = {
626 {"display_charset", P_CODE, PI_CODE, (void *)&DisplayCharset,
627 CMT_DISPLAY_CHARSET, (void *)&display_charset_str},
628 {"document_charset", P_CODE, PI_CODE, (void *)&DocumentCharset,
629 CMT_DOCUMENT_CHARSET, (void *)&document_charset_str},
630 {"auto_detect", P_CHARINT, PI_SEL_C, (void *)&WcOption.auto_detect,
631 CMT_AUTO_DETECT, (void *)auto_detect_str},
632 {"system_charset", P_CODE, PI_CODE, (void *)&SystemCharset,
633 CMT_SYSTEM_CHARSET, (void *)&system_charset_str},
634 {"follow_locale", P_CHARINT, PI_ONOFF, (void *)&FollowLocale,
635 CMT_FOLLOW_LOCALE, NULL},
636 {"ext_halfdump", P_CHARINT, PI_ONOFF, (void *)&ExtHalfdump,
637 CMT_EXT_HALFDUMP, NULL},
638 {"use_wide", P_CHARINT, PI_ONOFF, (void *)&WcOption.use_wide, CMT_USE_WIDE,
640 {"use_combining", P_CHARINT, PI_ONOFF, (void *)&WcOption.use_combining,
641 CMT_USE_COMBINING, NULL},
643 {"use_language_tag", P_CHARINT, PI_ONOFF,
644 (void *)&WcOption.use_language_tag, CMT_USE_LANGUAGE_TAG, NULL},
645 {"ucs_conv", P_CHARINT, PI_ONOFF, (void *)&WcOption.ucs_conv, CMT_UCS_CONV,
648 {"pre_conv", P_CHARINT, PI_ONOFF, (void *)&WcOption.pre_conv, CMT_PRE_CONV,
650 {"search_conv", P_CHARINT, PI_ONOFF, (void *)&SearchConv, CMT_SEARCH_CONV,
652 {"fix_width_conv", P_CHARINT, PI_ONOFF, (void *)&WcOption.fix_width_conv,
653 CMT_FIX_WIDTH_CONV, NULL},
655 {"use_gb12345_map", P_CHARINT, PI_ONOFF, (void *)&WcOption.use_gb12345_map,
656 CMT_USE_GB12345_MAP, NULL},
658 {"use_jisx0201", P_CHARINT, PI_ONOFF, (void *)&WcOption.use_jisx0201,
659 CMT_USE_JISX0201, NULL},
660 {"use_jisc6226", P_CHARINT, PI_ONOFF, (void *)&WcOption.use_jisc6226,
661 CMT_USE_JISC6226, NULL},
662 {"use_jisx0201k", P_CHARINT, PI_ONOFF, (void *)&WcOption.use_jisx0201k,
663 CMT_USE_JISX0201K, NULL},
664 {"use_jisx0212", P_CHARINT, PI_ONOFF, (void *)&WcOption.use_jisx0212,
665 CMT_USE_JISX0212, NULL},
666 {"use_jisx0213", P_CHARINT, PI_ONOFF, (void *)&WcOption.use_jisx0213,
667 CMT_USE_JISX0213, NULL},
668 {"strict_iso2022", P_CHARINT, PI_ONOFF, (void *)&WcOption.strict_iso2022,
669 CMT_STRICT_ISO2022, NULL},
671 {"gb18030_as_ucs", P_CHARINT, PI_ONOFF, (void *)&WcOption.gb18030_as_ucs,
672 CMT_GB18030_AS_UCS, NULL},
674 {NULL, 0, 0, NULL, NULL, NULL},
678 struct param_section sections[] = {
679 {N_("Display Settings"), params1},
681 {N_("Color Settings"), params2},
682 #endif /* USE_COLOR */
683 {N_("Miscellaneous Settings"), params3},
684 {N_("Directory Settings"), params5},
685 {N_("External Program Settings"), params6},
686 {N_("Network Settings"), params9},
687 {N_("Proxy Settings"), params4},
689 {N_("SSL Settings"), params7},
692 {N_("Cookie Settings"), params8},
695 {N_("Charset Settings"), params10},
700 static Str to_str(struct param_ptr *p);
703 compare_table(struct rc_search_table *a, struct rc_search_table *b)
705 return strcmp(a->param->name, b->param->name);
709 create_option_search_table()
715 /* count table size */
717 for (j = 0; sections[j].name != NULL; j++) {
719 while (sections[j].params[i].name) {
725 RC_search_table = New_N(struct rc_search_table, RC_table_size);
727 for (j = 0; sections[j].name != NULL; j++) {
729 while (sections[j].params[i].name) {
730 RC_search_table[k].param = §ions[j].params[i];
736 qsort(RC_search_table, RC_table_size, sizeof(struct rc_search_table),
737 (int (*)(const void *, const void *))compare_table);
740 for (i = 0; i < RC_table_size - 1; i++) {
741 p = RC_search_table[i].param->name;
742 q = RC_search_table[i + 1].param->name;
743 for (j = 0; p[j] != '\0' && q[j] != '\0' && p[j] == q[j]; j++) ;
746 RC_search_table[i].uniq_pos = diff1 + 1;
748 RC_search_table[i].uniq_pos = diff2 + 1;
754 search_param(char *name)
758 int len = strlen(name);
760 for (b = 0, e = RC_table_size - 1; b <= e;) {
762 cmp = strncmp(name, RC_search_table[i].param->name, len);
765 if (len >= RC_search_table[i].uniq_pos) {
766 return RC_search_table[i].param;
770 strcmp(name, RC_search_table[i].param->name)) <= 0)
772 return RC_search_table[i].param;
792 /* show parameter with bad options invokation */
794 show_params(FILE * fp)
802 OptionCharset = SystemCharset; /* FIXME */
806 fputs("\nconfiguration parameters\n", fp);
807 for (j = 0; sections[j].name != NULL; j++) {
811 wc_conv(_(sections[j].name), OptionCharset,
815 cmt = sections[j].name;
816 fprintf(fp, " section[%d]: %s\n", j, conv_to_system(cmt));
818 while (sections[j].params[i].name) {
819 switch (sections[j].params[i].type) {
824 t = (sections[j].params[i].inputtype ==
825 PI_ONOFF) ? "bool" : "number";
833 #if defined(USE_SSL) && defined(USE_SSL_VERIFY)
857 cmt = wc_conv(_(sections[j].params[i].comment),
858 OptionCharset, InnerCharset)->ptr;
861 cmt = sections[j].params[i].comment;
862 l = 30 - (strlen(sections[j].params[i].name) + strlen(t));
865 fprintf(fp, " -o %s=<%s>%*s%s\n",
866 sections[j].params[i].name, t, l, " ",
867 conv_to_system(cmt));
874 str_to_bool(char *value, int old)
878 switch (TOLOWER(*value)) {
880 case 'f': /* false */
882 case 'u': /* undef */
885 if (TOLOWER(value[1]) == 'f') /* off */
889 if (TOLOWER(value[1]) == 'o') /* toggle */
893 case 'r': /* reverse */
894 case 'x': /* exchange */
902 str_to_color(char *value)
905 return 8; /* terminal */
906 switch (TOLOWER(*value)) {
908 return 0; /* black */
914 return 2; /* green */
917 return 3; /* yellow */
922 return 5; /* magenta */
928 return 7; /* white */
931 return 8; /* terminal */
933 if (!strncasecmp(value, "blu", 3))
936 return 0; /* black */
938 return 8; /* terminal */
943 set_param(char *name, char *value)
950 p = search_param(name);
955 if (atoi(value) >= 0)
956 *(int *)p->varptr = (p->inputtype == PI_ONOFF)
957 ? str_to_bool(value, *(int *)p->varptr) : atoi(value);
961 *(int *)p->varptr = atoi(value);
964 *(short *)p->varptr = (p->inputtype == PI_ONOFF)
965 ? str_to_bool(value, *(short *)p->varptr) : atoi(value);
968 *(char *)p->varptr = (p->inputtype == PI_ONOFF)
969 ? str_to_bool(value, *(char *)p->varptr) : atoi(value);
972 *(char *)p->varptr = value[0];
975 *(char **)p->varptr = value;
977 #if defined(USE_SSL) && defined(USE_SSL_VERIFY)
979 if (value != NULL && value[0] != '\0')
980 *(char **)p->varptr = rcFile(value);
982 *(char **)p->varptr = NULL;
983 ssl_path_modified = 1;
988 *(int *)p->varptr = str_to_color(value);
993 *(wc_ces *) p->varptr =
994 wc_guess_charset_short(value, *(wc_ces *) p->varptr);
999 if (ppc >= MINIMUM_PIXEL_PER_CHAR && ppc <= MAXIMUM_PIXEL_PER_CHAR * 2)
1000 *(double *)p->varptr = ppc;
1004 if (ppc >= 10 && ppc <= 1000)
1005 *(double *)p->varptr = ppc;
1012 set_param_option(char *option)
1015 char *p = option, *q;
1017 while (*p && !IS_SPACE(*p) && *p != '=')
1018 Strcat_char(tmp, *p++);
1019 while (*p && IS_SPACE(*p))
1023 while (*p && IS_SPACE(*p))
1027 if (set_param(tmp->ptr, p))
1028 goto option_assigned;
1030 if (!strncmp(q, "no", 2)) { /* -o noxxx, -o no-xxx, -o no_xxx */
1032 if (*q == '-' || *q == '_')
1035 else if (tmp->ptr[0] == '-') /* -o -xxx */
1039 if (set_param(q, "0"))
1040 goto option_assigned;
1047 get_param_option(char *name)
1049 struct param_ptr *p;
1051 p = search_param(name);
1052 return p ? to_str(p)->ptr : NULL;
1056 interpret_rc(FILE * f)
1065 if (line->length == 0)
1067 Strremovefirstspaces(line);
1068 if (line->ptr[0] == '#') /* comment */
1072 while (*p && !IS_SPACE(*p))
1073 Strcat_char(tmp, *p++);
1074 while (*p && IS_SPACE(*p))
1077 set_param(tmp->ptr, p);
1084 if (non_null(HTTP_proxy))
1085 parseURL(HTTP_proxy, &HTTP_proxy_parsed, NULL);
1087 if (non_null(HTTPS_proxy))
1088 parseURL(HTTPS_proxy, &HTTPS_proxy_parsed, NULL);
1089 #endif /* USE_SSL */
1091 if (non_null(GOPHER_proxy))
1092 parseURL(GOPHER_proxy, &GOPHER_proxy_parsed, NULL);
1094 if (non_null(FTP_proxy))
1095 parseURL(FTP_proxy, &FTP_proxy_parsed, NULL);
1096 if (non_null(NO_proxy))
1097 set_no_proxy(NO_proxy);
1104 if (non_null(cookie_reject_domains))
1105 Cookie_reject_domains = make_domain_list(cookie_reject_domains);
1106 if (non_null(cookie_accept_domains))
1107 Cookie_accept_domains = make_domain_list(cookie_accept_domains);
1113 do_mkdir(const char *dir, long mode)
1115 char *r, abs[_MAX_PATH];
1118 _abspath(abs, rc_dir, _MAX_PATH); /* Translate '\\' to '/' */
1120 if (!(n = strlen(abs)))
1123 if (*(r = abs + n - 1) == '/') /* Ignore tailing slash if it is */
1126 return mkdir(abs, mode);
1128 #else /* not __EMX__ */
1129 #ifdef __MINGW32_VERSION
1130 #define do_mkdir(dir,mode) mkdir(dir)
1132 #define do_mkdir(dir,mode) mkdir(dir,mode)
1133 #endif /* not __MINW32_VERSION */
1134 #endif /* not __EMX__ */
1137 sync_with_option(void)
1139 if (PagerMax < LINES)
1141 WrapSearch = WrapDefault;
1148 #ifdef USE_EXTERNAL_URI_LOADER
1155 if (fmInitialized && displayImage)
1158 displayImage = FALSE; /* XXX */
1163 if (AcceptLang == NULL || *AcceptLang == '\0') {
1165 * AcceptLang default: this is used in Accept-Language: HTTP request
1166 * header. For example, ja.po should translate it as
1167 * "ja;q=1.0, en;q=0.5" like that.
1169 AcceptLang = _("en;q=1.0");
1171 if (AcceptEncoding == NULL || *AcceptEncoding == '\0')
1172 AcceptEncoding = acceptableEncoding();
1173 if (AcceptMedia == NULL || *AcceptMedia == '\0')
1174 AcceptMedia = acceptableMimeTypes();
1175 if (fmInitialized) {
1196 rc_dir = expandPath(RC_DIR);
1198 if (i > 1 && rc_dir[i - 1] == '/')
1199 rc_dir[i - 1] = '\0';
1202 display_charset_str = wc_get_ces_list();
1203 document_charset_str = display_charset_str;
1204 system_charset_str = display_charset_str;
1207 if (stat(rc_dir, &st) < 0) {
1208 if (errno == ENOENT) { /* no directory */
1209 if (do_mkdir(rc_dir, 0700) < 0) {
1210 fprintf(stderr, "Can't create config directory (%s)!", rc_dir);
1218 fprintf(stderr, "Can't open config directory (%s)!", rc_dir);
1222 if (!S_ISDIR(st.st_mode)) {
1223 /* not a directory */
1224 fprintf(stderr, "%s is not a directory!", rc_dir);
1227 if (!(st.st_mode & S_IWUSR)) {
1228 fprintf(stderr, "%s is not writable!", rc_dir);
1234 if (config_file == NULL)
1235 config_file = rcFile(CONFIG_FILE);
1237 create_option_search_table();
1240 /* open config file */
1241 if ((f = fopen(etcFile(W3MCONFIG), "rt")) != NULL) {
1245 if ((f = fopen(confFile(CONFIG_FILE), "rt")) != NULL) {
1249 if ((f = fopen(config_file, "rt")) != NULL) {
1257 if (((tmp_dir = getenv("TMPDIR")) == NULL || *tmp_dir == '\0') &&
1258 ((tmp_dir = getenv("TMP")) == NULL || *tmp_dir == '\0') &&
1259 ((tmp_dir = getenv("TEMP")) == NULL || *tmp_dir == '\0'))
1264 static char optionpanel_src1[] =
1265 "<html><head><title>Option Setting Panel</title></head><body>\
1266 <h1 align=center>Option Setting Panel<br>(w3m version %s)</b></h1>\
1267 <form method=post action=\"file:///$LIB/" W3MHELPERPANEL_CMDNAME "\">\
1268 <input type=hidden name=mode value=panel>\
1269 <input type=hidden name=cookie value=\"%s\">\
1270 <input type=submit value=\"%s\">\
1272 <form method=internal action=option>";
1274 static Str optionpanel_str = NULL;
1277 to_str(struct param_ptr *p)
1286 return Sprintf("%d", (int)(*(wc_ces *) p->varptr));
1289 return Sprintf("%d", *(int *)p->varptr);
1291 return Sprintf("%d", *(short *)p->varptr);
1293 return Sprintf("%d", *(char *)p->varptr);
1295 return Sprintf("%c", *(char *)p->varptr);
1297 #if defined(USE_SSL) && defined(USE_SSL_VERIFY)
1300 /* SystemCharset -> InnerCharset */
1301 return Strnew_charp(conv_from_system(*(char **)p->varptr));
1304 return Sprintf("%g", *(double *)p->varptr);
1311 load_option_panel(void)
1314 struct param_ptr *p;
1323 if (optionpanel_str == NULL)
1324 optionpanel_str = Sprintf(optionpanel_src1, w3m_version,
1325 html_quote(localCookie()->ptr), _(CMT_HELPER));
1328 OptionCharset = SystemCharset; /* FIXME */
1330 if (!OptionEncode) {
1332 wc_Str_conv(optionpanel_str, OptionCharset, InnerCharset);
1333 for (i = 0; sections[i].name != NULL; i++) {
1335 wc_conv(_(sections[i].name), OptionCharset,
1337 for (p = sections[i].params; p->name; p++) {
1339 wc_conv(_(p->comment), OptionCharset,
1341 if (p->inputtype == PI_SEL_C
1343 && p->select != colorstr
1346 for (s = (struct sel_c *)p->select; s->text != NULL; s++) {
1348 wc_conv(_(s->text), OptionCharset,
1355 for (s = colorstr; s->text; s++)
1356 s->text = wc_conv(_(s->text), OptionCharset,
1359 OptionEncode = TRUE;
1362 src = Strdup(optionpanel_str);
1364 Strcat_charp(src, "<table><tr><td>");
1365 for (i = 0; sections[i].name != NULL; i++) {
1366 Strcat_m_charp(src, "<h1>", sections[i].name, "</h1>", NULL);
1367 p = sections[i].params;
1368 Strcat_charp(src, "<table width=100% cellpadding=0>");
1370 Strcat_m_charp(src, "<tr><td>", p->comment, NULL);
1371 Strcat(src, Sprintf("</td><td width=%d>",
1372 (int)(28 * pixel_per_char)));
1373 switch (p->inputtype) {
1375 Strcat_m_charp(src, "<input type=text name=",
1378 html_quote(to_str(p)->ptr), "\">", NULL);
1381 x = atoi(to_str(p)->ptr);
1382 Strcat_m_charp(src, "<input type=radio name=",
1385 (x ? " checked" : ""),
1386 ">YES <input type=radio name=",
1388 " value=0", (x ? "" : " checked"), ">NO", NULL);
1392 Strcat_m_charp(src, "<select name=", p->name, ">", NULL);
1393 for (s = (struct sel_c *)p->select; s->text != NULL; s++) {
1394 Strcat_charp(src, "<option value=");
1395 Strcat(src, Sprintf("%s\n", s->cvalue));
1396 if ((p->type != P_CHAR && s->value == atoi(tmp->ptr)) ||
1397 (p->type == P_CHAR && (char)s->value == *(tmp->ptr)))
1398 Strcat_charp(src, " selected");
1399 Strcat_char(src, '>');
1400 Strcat_charp(src, s->text);
1402 Strcat_charp(src, "</select>");
1407 Strcat_m_charp(src, "<select name=", p->name, ">", NULL);
1408 for (c = *(wc_ces_list **) p->select; c->desc != NULL; c++) {
1409 Strcat_charp(src, "<option value=");
1410 Strcat(src, Sprintf("%s\n", c->name));
1411 if (c->id == atoi(tmp->ptr))
1412 Strcat_charp(src, " selected");
1413 Strcat_char(src, '>');
1414 Strcat_charp(src, c->desc);
1416 Strcat_charp(src, "</select>");
1420 Strcat_charp(src, "</td></tr>\n");
1424 "<tr><td></td><td><p><input type=submit value=\"OK\"></td></tr>");
1425 Strcat_charp(src, "</table><hr width=50%>");
1427 Strcat_charp(src, "</table></form></body></html>");
1428 buf = loadHTMLString(src);
1431 buf->document_charset = OptionCharset;
1437 panel_set_option(struct parsed_tagarg *arg)
1443 disp_message("There's no ~/.w3m directory... config not saved", FALSE);
1446 f = fopen(config_file, "wt");
1448 disp_message("Can't write option!", FALSE);
1452 /* InnerCharset -> SystemCharset */
1454 p = conv_to_system(arg->value);
1455 if (set_param(arg->arg, p)) {
1457 fprintf(f, "%s %s\n", arg->arg, p);
1474 && (base[1] == '/' || (base[1] == '.' && base[2] == '/')))
1475 || (base[0] == '~' && base[1] == '/')))
1476 /* /file, ./file, ../file, ~/file */
1477 return expandPath(base);
1478 return expandPath(Strnew_m_charp(rc_dir, "/", base, NULL)->ptr);
1482 auxbinFile(char *base)
1484 return expandPath(Strnew_m_charp(w3m_auxbin_dir(), "/", base, NULL)->ptr);
1487 #if 0 /* not used */
1491 return expandPath(Strnew_m_charp(w3m_lib_dir(), "/", base, NULL)->ptr);
1498 return expandPath(Strnew_m_charp(w3m_etc_dir(), "/", base, NULL)->ptr);
1502 confFile(char *base)
1504 return expandPath(Strnew_m_charp(w3m_conf_dir(), "/", base, NULL)->ptr);
1507 #ifndef USE_HELP_CGI
1509 helpFile(char *base)
1511 return expandPath(Strnew_m_charp(w3m_help_dir(), "/", base, NULL)->ptr);