Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 476 lines (441 sloc) 16.629 kb
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
1 /* optglob.c */
2 /* Copyright 1995 by Steve Kirkendall */
3
4
5 /* This file contains gobal options for the portable parts of elvis. */
6
7 #include "elvis.h"
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
8 #ifdef FEATURE_RCSID
2fe6e17 @mbert Import Elvis 2.2_1 (written by Steve Kirkendall)
authored
9 char id_optglob[] = "$Id: optglob.c,v 2.119 2004/03/26 21:34:40 steve Exp $";
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
10 #endif
11
12 #ifdef FEATURE_LISTCHARS
13 static int optislistchars P_((struct optdesc_s *opt, OPTVAL *val, CHAR *newval));
14 #else
15 # define optislistchars optispacked
16 #endif
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
17
18 /* descriptions of the global options */
19 static OPTDESC ogdesc[] =
20 {
21 {"blksize", "bsz", optnstring, optisnumber, "256:8192" },
22 {"blkhash", "hash", optnstring, optisnumber, "1:500" },
23 {"blkcache", "cache", optnstring, optisnumber, "5:200" },
24 {"blkgrow", "bgr", optnstring, optisnumber, "1:32" },
25 {"blkfill", "bfill", optnstring, optisnumber },
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
26 {"blkhit", "bh", optnstring, optisnumber },
27 {"blkmiss", "bm", optnstring, optisnumber },
28 {"blkwrite", "bw", optnstring, optisnumber },
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
29 {"version", "ver", optsstring, optisstring },
30 {"bitsperchar", "bits", optnstring, optisnumber },
31 {"gui", "gui", optsstring, optisstring },
32 {"os", "os", optsstring, optisstring },
33 {"session", "ses", optsstring, optisstring },
34 {"recovering", "rflag", NULL, NULL },
35 {"digraph", "dig", NULL, NULL },
36 {"exrc", "ex", NULL, NULL },
37 {"modeline","ml", NULL, NULL },
38 {"modelines","mls", optnstring, optisnumber, "1:100"},
39 {"ignorecase", "ic", NULL, NULL },
40 {"magic", "ma", NULL, NULL },
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
41 {"magicchar", "mac", optsstring, optisstring },
42 {"magicname", "man", NULL, NULL, },
43 {"magicperl", "map", NULL, NULL, },
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
44 {"novice", "novice", NULL, NULL },
45 {"prompt", "prompt", NULL, NULL },
46 {"remap", "remap", NULL, NULL },
47 {"report", "report", optnstring, optisnumber },
48 {"shell", "sh", optsstring, optisstring },
49 {"sync", "sync", NULL, NULL },
50 {"taglength", "tl", optnstring, optisnumber },
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
51 {"tagkind", "tk", NULL, NULL },
52 {"taglibrary", "tlib", NULL, NULL },
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
53 {"tags", "tagpath", optsstring, optisstring },
54 {"tagstack", "tsk", NULL, NULL },
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
55 {"tagprg", "tp", optsstring, optisstring },
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
56 {"autoprint", "ap", NULL, NULL },
57 {"autowrite", "aw", NULL, NULL },
58 {"autoselect", "as", NULL, NULL, },
59 {"warn", "warn", NULL, NULL },
60 {"window", "wi", optnstring, optisnumber },
61 {"wrapscan", "ws", NULL, NULL },
62 {"writeany", "wa", NULL, NULL },
63 {"defaultreadonly","dro",NULL, NULL },
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
64 {"initialstate","init", opt1string, optisoneof, "input replace vi ex"},
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
65 {"exitcode", "exit", optnstring, optisnumber, "0:255"},
66 {"keytime", "kt", optnstring, optisnumber, "0:20"},
67 {"usertime", "ut", optnstring, optisnumber, "0:20"},
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
68 {"security", "sec", opt1string, optisoneof, "normal safer restricted"},
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
69 {"tempsession", "temp", NULL, NULL },
70 {"newsession", "temp", NULL, NULL },
71 {"exrefresh", "er", NULL, NULL },
72 {"home", "home", optsstring, optisstring },
73 {"elvispath", "epath", optsstring, optisstring },
74 {"terse", "te", NULL, NULL },
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
75 {"previousdir", "pdir", optsstring, optisstring },
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
76 {"previousfile", "#", optsstring, optisstring },
77 {"previousfileline","@",optnstring, optisnumber },
78 {"previouscommand", "!",optsstring, optisstring },
79 {"previoustag", "ptag", optsstring, optisstring },
80 {"nearscroll", "ns", optnstring, optisnumber, "0:100"},
81 {"optimize", "op", NULL, NULL },
82 {"edcompatible", "ed", NULL, NULL },
83 {"pollfrequency", "pf", optnstring, optisnumber, "1:1000"},
84 {"sentenceend", "se", optsstring, optisstring },
85 {"sentencequote", "sq", optsstring, optisstring },
86 {"sentencegap", "sg", optnstring, optisnumber, "0:3"},
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
87 {"verbose", "-v", optnstring, optisnumber, "0:9"},
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
88 {"anyerror", "ae", NULL, NULL },
89 {"directory", "dir", optsstring, optisstring },
90 {"errorbells", "eb", NULL, NULL },
91 {"warningbells", "wb", NULL, NULL },
92 {"flash", "vbell", NULL, NULL },
93 {"program", "argv0", optsstring, optisstring },
94 {"backup", "bk", NULL, NULL },
95 {"showmarkups", "smu", NULL, NULL },
96 {"nonascii", "asc", opt1string, optisoneof, "all most none strip"},
97 {"beautify", "bf", NULL, NULL },
98 {"mesg", "mesg", NULL, NULL },
99 {"sessionpath", "spath",optsstring, optisstring },
100 {"maptrace", "mt", opt1string, optisoneof, "off run step"},
101 {"maplog", "mlog", opt1string, optisoneof, "off reset append"},
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
102 {"gdefault", "gd", NULL, NULL },
103 {"matchchar", "mc", optsstring, optisstring },
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
104 {"show", "show", optsstring, optisstring },
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
105 {"writeeol", "weol", opt1string, optisoneof, "unix dos mac text binary same"},
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
106 {"binary", "bin", NULL, NULL },
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
107 {"saveregexp", "sre", NULL, NULL },
108 {"true", "True", optsstring, optisstring },
109 {"false", "False", optsstring, optisstring },
110 {"animation", "anim", optnstring, optisnumber, "1:100"},
97d8998 @mbert Import Elvis 2.1_4 (written by Steve Kirkendall)
authored
111 {"completebinary", "cob", NULL, NULL },
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
112 {"optionwidth", "ow", optnstring, optisnumber, },
97d8998 @mbert Import Elvis 2.1_4 (written by Steve Kirkendall)
authored
113 {"smarttab", "sta", NULL, NULL },
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
114 {"smartcase", "scs", NULL, NULL },
115 {"hlsearch", "hls", NULL, NULL },
116 {"background", "bg", opt1string, colorisbg, "light dark"},
117 {"incsearch", "is", NULL, NULL },
118 {"spelldict", "spd", optsstring, optisstring },
119 {"spellautoload","sal", NULL, NULL },
120 {"spellsuffix", "sps", optsstring, optisstring },
121 {"locale", "locale", optsstring, optisstring },
122 {"mkexrcfile", "rc", optsstring, optisstring },
123 {"prefersyntax","psyn", opt1string, optisoneof, "never local writable always" },
124 {"eventignore", "ei", optsstring, optisstring },
125 {"eventerrors", "ee", NULL, NULL, },
126 {"tweaksection", "twks",NULL, NULL, },
127 {"timeout", "to", NULL, NULL },
128 {"listchars", "lcs", optsstring, optislistchars, "eol:,tab:,trail:,ff:,cr:,esc:,bs:,del:,nul:,precedes:,extends:,markup" },
129 {"cleantext", "ct", optsstring, optispacked, "bs,input,short,long,ex" },
130 {"filenamerules", "fnr",optsstring, optispacked, "tilde,dollar,paren,wildcard,special,space" },
2fe6e17 @mbert Import Elvis 2.2_1 (written by Steve Kirkendall)
authored
131 {"state", "state", optsstring, optisstring },
132 {"initializing", "ing", NULL, NULL },
133 {"persistfile", "perf", optsstring, optisstring },
134 {"persist", "pers", optsstring, optispacked, "cursor,change,hours:,marks,regions,folds,external:,ex:,search:,args,max:"},
135
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
136 /* added these for the sake of backward compatibility : */
137 {"more", "mo", NULL, NULL },
138 {"hardtabs", "ht", optnstring, optisnumber, "1:1000"},
139 {"redraw", "red", NULL, NULL }
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
140 };
141
142
143 /* where the values are stored */
144 OPTVAL optglob[QTY_GLOBAL_OPTS];
145
146
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
147 #ifdef FEATURE_LPR
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
148 /* printer options */
149 static OPTDESC lpdesc[] =
150 {
151 {"lptype", "lpt", optsstring, optisstring },
152 {"lpcrlf", "lpc", NULL, NULL },
153 {"lpout", "lpo", optsstring, optisstring },
154 {"lpcolumns", "lpcols", optnstring, optisnumber, "0:300"},
155 {"lpwrap", "lpw", NULL, NULL },
156 {"lplines", "lprows", optnstring, optisnumber, "0:100"},
157 {"lpconvert", "lpcvt", NULL, NULL },
158 {"lpformfeed", "lpff", NULL, NULL },
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
159 {"lpoptions", "lpopt", optsstring, optispacked, "paper:,frame:,bar:,punch:,clip:"},
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
160 {"lpnumber", "lpn", NULL, NULL },
161 {"lpheader", "lph", NULL, NULL },
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
162 {"lpcolor", "lpcl", NULL, NULL },
163 {"lpcontrast", "lpct", optnstring, optisnumber, "0:100"}
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
164 };
165
166 /* where the values are stored */
167 OPTVAL lpval[QTY_LP_OPTS];
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
168 #endif /* FEATURE_LPR */
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
169
170
171 #ifndef NO_USERVARS
172 /* descriptions of the user options */
173 static OPTDESC userdesc[] =
174 {
175 {"a", "a", optsstring, optisstring },
176 {"b", "b", optsstring, optisstring },
177 {"c", "c", optsstring, optisstring },
178 {"d", "d", optsstring, optisstring },
179 {"e", "e", optsstring, optisstring },
180 {"f", "f", optsstring, optisstring },
181 {"g", "g", optsstring, optisstring },
182 {"h", "h", optsstring, optisstring },
183 {"i", "i", optsstring, optisstring },
184 {"j", "j", optsstring, optisstring },
185 {"k", "k", optsstring, optisstring },
186 {"l", "l", optsstring, optisstring },
187 {"m", "m", optsstring, optisstring },
188 {"n", "n", optsstring, optisstring },
189 {"o", "o", optsstring, optisstring },
190 {"p", "p", optsstring, optisstring },
191 {"q", "q", optsstring, optisstring },
192 {"r", "r", optsstring, optisstring },
193 {"s", "s", optsstring, optisstring },
194 {"t", "t", optsstring, optisstring },
195 {"u", "u", optsstring, optisstring },
196 {"v", "v", optsstring, optisstring },
197 {"w", "w", optsstring, optisstring },
198 {"x", "x", optsstring, optisstring },
199 {"y", "y", optsstring, optisstring },
200 {"z", "z", optsstring, optisstring },
201 };
202
203 /* where the values are stored */
204 static OPTVAL optuser[QTY(userdesc)];
205 #endif /* not NO_USERVARS */
206
207
208 /* This function inializes the global options. This can't be done in the
209 * usual way, because the values are declared as a union, and C doesn't allow
210 * unions to be initialized.
211 */
212 void optglobinit()
213 {
214 int i;
215 char *envval;
216
217 assert(QTY(ogdesc) == QTY_GLOBAL_OPTS);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
218 #ifdef FEATURE_LPR
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
219 assert(QTY(lpdesc) == QTY_LP_OPTS);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
220 #endif
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
221
222 /* set each option to a reasonable default */
223 optpreset(o_blksize, BLKSIZE, OPT_LOCK|OPT_HIDE);
224 optpreset(o_blkhash, BLKHASH, OPT_HIDE);
225 optpreset(o_blkcache, BLKCACHE, OPT_HIDE);
226 optpreset(o_blkgrow, BLKGROW, OPT_HIDE);
227 optflags(o_blkfill) = OPT_LOCK|OPT_HIDE;
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
228 optflags(o_blkhit) = OPT_LOCK|OPT_HIDE;
229 optflags(o_blkmiss) = OPT_LOCK|OPT_HIDE;
230 optflags(o_blkwrite) = OPT_LOCK|OPT_HIDE;
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
231 optpreset(o_version, toCHAR(VERSION), OPT_LOCK|OPT_HIDE);
232 optpreset(o_bitsperchar, 8 * sizeof(CHAR), OPT_LOCK|OPT_HIDE);
233 optpreset(o_os, toCHAR(OSNAME), OPT_LOCK|OPT_HIDE);
234 optflags(o_gui) = OPT_LOCK|OPT_HIDE;
235 optflags(o_session) = OPT_LOCK|OPT_HIDE;
236 optflags(o_recovering) = OPT_HIDE;
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
237 o_magic = ElvTrue;
238 optpreset(o_magicchar, toCHAR("^$.[*"), OPT_HIDE);
239 optpreset(o_magicname, ElvFalse, OPT_HIDE);
240 optpreset(o_magicperl, ElvFalse, OPT_HIDE);
241 o_prompt = ElvTrue;
242 o_autoprint = ElvTrue;
243 o_remap = ElvTrue;
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
244 o_report = 5;
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
245 optpreset(o_modeline, ElvFalse, OPT_UNSAFE);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
246 optpreset(o_modelines, 5, OPT_HIDE);
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
247 #ifdef OSSHELLENV
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
248 optpreset(o_shell, toCHAR(getenv(OSSHELLENV)), OPT_HIDE | OPT_UNSAFE);
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
249 #else
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
250 optpreset(o_shell, toCHAR(getenv("SHELL")), OPT_HIDE | OPT_UNSAFE);
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
251 #endif
252 if (!o_shell)
253 o_shell = toCHAR(OSSHELL);
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
254 o_tagstack = ElvTrue;
255 o_tagkind = ElvFalse;
256 o_taglibrary = ElvFalse;
257 o_warn = ElvTrue;
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
258 o_window = 12;
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
259 o_wrapscan = ElvTrue;
260 optpreset(o_initialstate,'v', OPT_HIDE | OPT_NODFLT); /* vi */
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
261 o_keytime = 3;
262 o_usertime = 15;
263 optflags(o_exitcode) = OPT_HIDE;
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
264 optpreset(o_security, 'n', OPT_HIDE|OPT_UNSAFE|OPT_NODFLT); /* normal */
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
265 optflags(o_tempsession) = OPT_HIDE;
266 optflags(o_newsession) = OPT_HIDE;
267 optpreset(o_nearscroll, 10, OPT_HIDE);
268 optflags(o_previousfile) = OPT_HIDE|OPT_LOCK;
269 optflags(o_previousfileline) = OPT_HIDE|OPT_LOCK;
270 optflags(o_previouscommand) = OPT_HIDE|OPT_LOCK;
271 optflags(o_previoustag) = OPT_HIDE|OPT_LOCK;
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
272 optflags(o_tagprg) = OPT_HIDE|OPT_UNSAFE;
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
273 o_optimize = ElvTrue;
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
274 optpreset(o_pollfrequency, 20, OPT_HIDE);
275 optflags(o_sentenceend) = OPT_HIDE;
276 optflags(o_sentencequote) = OPT_HIDE;
277 optpreset(o_sentencegap, 2, OPT_HIDE);
278 if (!o_directory)
279 o_directory = toCHAR(getenv("TMP"));
280 #ifdef OSDIRECTORY
281 if (!o_directory)
282 o_directory = toCHAR(OSDIRECTORY);
283 #endif
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
284 o_errorbells = ElvTrue;
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
285 optpreset(o_nonascii, 'm', OPT_HIDE); /* most */
286 optflags(o_digraph) = OPT_HIDE;
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
287 optpreset(o_sync, ElvFalse, OPT_HIDE);
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
288 optflags(o_autoselect) = OPT_HIDE;
289 optflags(o_defaultreadonly) = OPT_HIDE;
290 optflags(o_exrefresh) = OPT_HIDE;
291 optflags(o_verbose) = OPT_HIDE;
292 optflags(o_anyerror) = OPT_HIDE;
293 optflags(o_program) = OPT_HIDE;
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
294 optpreset(o_mesg, ElvTrue, OPT_HIDE);
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
295 optpreset(o_maptrace, 'o', OPT_HIDE); /* off */
296 optpreset(o_maplog, 'o', OPT_HIDE); /* off */
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
297 o_timeout = ElvTrue;
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
298 optpreset(o_matchchar, toCHAR("[]{}()"), OPT_HIDE);
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
299 optpreset(o_show, toCHAR("spell/tag,region"), OPT_HIDE);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
300 o_writeeol = 's'; /* same */
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
301 optpreset(o_binary, ElvFalse, OPT_HIDE);
302 optpreset(o_saveregexp, ElvTrue, OPT_HIDE);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
303 optpreset(o_hardtabs, 8, OPT_HIDE);
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
304 optpreset(o_redraw, ElvFalse, OPT_HIDE);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
305 optpreset(o_true, msgtranslate("True"), OPT_HIDE|OPT_FREE);
306 optpreset(o_false, msgtranslate("False"), OPT_HIDE|OPT_FREE);
307 optpreset(o_animation, 3, OPT_HIDE);
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
308 optpreset(o_completebinary, ElvFalse, OPT_HIDE);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
309 optpreset(o_optionwidth, 24, OPT_HIDE);
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
310 optpreset(o_smarttab, ElvFalse, OPT_HIDE);
311 optpreset(o_smartcase, ElvFalse, OPT_HIDE);
312 optpreset(o_hlsearch, ElvFalse, OPT_HIDE);
313 o_incsearch = ElvFalse;
314 optpreset(o_spelldict, NULL, OPT_HIDE | OPT_UNSAFE);
315 optpreset(o_spellsuffix, NULL, OPT_HIDE);
2fe6e17 @mbert Import Elvis 2.2_1 (written by Steve Kirkendall)
authored
316 optpreset(o_spellautoload, ElvTrue, OPT_HIDE);
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
317 optpreset(o_locale, NULL, OPT_HIDE);
318 optpreset(o_mkexrcfile, NULL, OPT_HIDE);
319 optpreset(o_prefersyntax, 'n', OPT_HIDE); /* never */
320 optpreset(o_eventignore, NULL, OPT_HIDE);
321 optpreset(o_eventerrors, ElvFalse, OPT_HIDE);
322 optpreset(o_tweaksection, ElvTrue, OPT_HIDE);
323 optpreset(o_listchars, toCHAR("eol:$"), OPT_HIDE);
324 #ifdef FEATURE_LISTCHARS
325 (void)dmnlistchars('<', -1L, 0, NULL, NULL);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
326 #endif
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
327 optpreset(o_cleantext, toCHAR("long"), OPT_HIDE);
328 optpreset(o_filenamerules, toCHAR("tilde,dollar,paren,wildcard,special,space"), OPT_HIDE);
2fe6e17 @mbert Import Elvis 2.2_1 (written by Steve Kirkendall)
authored
329 optpreset(o_initializing, ElvTrue, OPT_HIDE|OPT_LOCK);
330 optpreset(o_persistfile, NULL, OPT_HIDE | OPT_UNSAFE);
331 optpreset(o_persist, toCHAR("cursor,change,hours:8,marks,regions,folds,ex:50,search:20,args"), OPT_HIDE);
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
332
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
333 /* Set the "home" option from $HOME */
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
334 envval = getenv("HOME");
335 if (envval)
336 {
337 if (optflags(o_home) & OPT_FREE)
338 safefree(o_home);
339 o_home = toCHAR(envval);
340 }
341 else if (!o_home)
342 {
343 o_home = toCHAR(".");
344 }
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
345 optflags(o_home) |= OPT_HIDE | OPT_UNSAFE;
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
346
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
347 /* Set the "previousdir" option from $OLDPWD */
348 envval = getenv("OLDPWD");
349 if (envval)
350 o_previousdir = toCHAR(envval);
351 else
352 o_previousdir = toCHAR(".");
353 optflags(o_previousdir) |= OPT_HIDE;
354
355 /* Set the "tags" option from $TAGPATH */
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
356 o_tags = toCHAR(getenv("TAGPATH"));
357 if (!o_tags)
358 {
359 o_tags = toCHAR("tags");
360 }
361
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
362 /* Set the "background" option from $ELVISBG */
363 envval = getenv("ELVISBG");
364 if (!envval || (strcmp(envval, "dark") && strcmp(envval, "light")))
365 envval = "dark";
366 optpreset(o_background, *envval, OPT_HIDE|OPT_NODFLT);
367
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
368 /* Generate the default elvispath value. */
369 envval = getenv("ELVISPATH");
370 if (envval)
371 {
372 if (optflags(o_elvispath) & OPT_FREE)
373 safefree(o_elvispath);
374 o_elvispath = toCHAR(envval);
375 }
376 else if (!o_elvispath)
377 {
378 o_elvispath = toCHAR(OSLIBPATH);
379 }
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
380 optflags(o_elvispath) |= OPT_HIDE | OPT_UNSAFE;
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
381
382 /* Generate the default sessionpath value. */
383 envval = getenv("SESSIONPATH");
384 if (envval)
385 {
386 if (optflags(o_sessionpath) & OPT_FREE)
387 safefree(o_sessionpath);
388 o_sessionpath = toCHAR(envval);
389 }
390 else if (!o_sessionpath)
391 {
392 #ifdef OSSESSIONPATH
393 o_sessionpath = toCHAR(OSSESSIONPATH);
394 #else
395 o_sessionpath = toCHAR("~:.");
396 #endif
397 }
398 optflags(o_sessionpath) |= (OPT_HIDE | OPT_LOCK);
399
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
400 #ifdef FEATURE_LPR
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
401 /* initialize the printing options */
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
402 # ifdef OSLPTYPE
403 optpreset(o_lptype, toCHAR(OSLPTYPE), OPT_HIDE);
404 # else
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
405 optpreset(o_lptype, toCHAR("dumb"), OPT_HIDE);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
406 # endif
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
407 optpreset(o_lpcrlf, ElvFalse, OPT_HIDE);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
408 optpreset(o_lpout, toCHAR(OSLPOUT), OPT_HIDE | OPT_UNSAFE);
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
409 optpreset(o_lpcolumns, 80, OPT_HIDE);
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
410 optpreset(o_lpwrap, ElvTrue, OPT_HIDE);
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
411 optpreset(o_lplines, 60, OPT_HIDE);
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
412 optpreset(o_lpconvert, ElvFalse, OPT_HIDE);
413 optpreset(o_lpformfeed, ElvFalse, OPT_HIDE);
414 optpreset(o_lpoptions, NULL, OPT_HIDE);
415 optpreset(o_lpnumber, ElvFalse, OPT_HIDE);
416 optpreset(o_lpheader, ElvTrue, OPT_HIDE);
417 optpreset(o_lpcolor, ElvFalse, OPT_HIDE);
418 optpreset(o_lpcontrast, 50, OPT_HIDE);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
419 #endif /* FEATURE_LPR */
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
420
421 /* inform the options code about these options */
422 optinsert("global", QTY(ogdesc), ogdesc, optglob);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
423 #ifdef FEATURE_LPR
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
424 optinsert("lp", QTY(lpdesc), lpdesc, lpval);
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
425 #endif
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
426
427 #ifndef NO_USERVARS
428 /* initialize user variables */
429 for (i = 0; i < QTY(userdesc); i++)
430 {
431 optflags(optuser[i]) = OPT_HIDE;
432 }
433 optinsert("user", QTY(userdesc), userdesc, optuser);
434 #endif
435 }
436
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
437 #ifdef FEATURE_LISTCHARS
438 /* Store a value for the "listchars" option, and then parse it */
439 static int optislistchars(opt, val, newval)
440 struct optdesc_s *opt;
441 OPTVAL *val;
442 CHAR *newval;
443 {
444 int result;
445
446 /* try to change it as a packed list */
447 result = optispacked(opt, val, newval);
448 if (result <= 0)
449 return result;
450
451 /* it succeeded and was different -- use dmnlistchars to parse it */
452 (void)dmnlistchars('<', -1L, 0L, NULL, NULL);
453
454 /* return 1 to indicate a successful change */
455 return 1;
456 }
457 #endif
cf92e3b @mbert Import Elvis 2.0 (written by Steve Kirkendall)
authored
458
459 /* This function sets the "previousfile" and "previousfileline" options. */
460 void optprevfile(filename, line)
461 CHAR *filename; /* new value for "previousfile" */
462 long line; /* new value for "previousfileline" */
463 {
464 /* if no new filename, then don't clobber the old one */
465 if (!filename)
466 return;
467
468 /* if there was an old previousfile, then free its storage space */
469 if (o_previousfile)
470 safefree(o_previousfile);
471
472 /* store the new filename and line number */
473 o_previousfile = CHARdup(filename);
474 o_previousfileline = line;
475 }
Something went wrong with that request. Please try again.