File: elm-parser.tcl

package info (click to toggle)
dotfile 1%3A2.4-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,472 kB
  • ctags: 523
  • sloc: tcl: 14,072; sh: 918; makefile: 177; lisp: 18; ansic: 7
file content (820 lines) | stat: -rwxr-xr-x 31,965 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
### Copyright (C) 1996 Rasmus Ingemann Hansen
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation; either version 2 of the License, or
### (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

proc bool {onoff} {
	if {[string tolower $onoff] == "on"} {
		return 1
	} else {
		return 0
	}
}

proc elmparser {filename list} {
  ### ~/.elm/elmrc ###
	set elmfile [open ~/.elm/elmrc]
	while {![eof $elmfile]} {
		gets $elmfile line
		if [regexp {^\#} $line || regexp {^\n} $line] {
			gets $elmfile line
		}

		### mask out EXPR: ^( )*EXPR( )*=( )*(.)*$
   	        if [regexp -nocase {^[ ]*editor[ ]*=[ ]*(.*)$} $line all file(editor)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*easyeditor[ ]*=[ ]*(.*)$} $line all file(easyeditor)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*visualeditor[ ]*=[ ]*(.*)$} $line all file(visualeditor)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*alteditor[ ]*=[ ]*(.*)$} $line all file(alteditor)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*escape[ ]*=[ ]*(.*)$} $line all file(escape)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*autocopy[ ]*=[ ]*(.*)$} $line all file(autocopy)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*prefix[ ]*=[ ]*(.*)$} $line all file(prefix)] {
			continue
		}
  	        if [regexp -nocase {^[ ]*attribution[ ]*=[ ]*(.*)$} $line all file(attribution)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*sigdashes[ ]*=[ ]*(.*)$} $line all file(sigdashes)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*localsignature[ ]*=[ ]*(.*)$} $line all file(localsignature)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*remotesignature[ ]*=[ ]*(.*)$} $line all file(remotesignature)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*signature[ ]*=[ ]*(.*)$} $line all file(signature)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*textencoding[ ]*=[ ]*(.*)$} $line all file(textencoding)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*precedences[ ]*=[ ]*(.*)$} $line all file(precedences)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*noheader[ ]*=[ ]*(.*)$} $line all file(noheader)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*pager[ ]*=[ ]*(.*)$} $line all file(pager)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*builtinlines[ ]*=[ ]*(.*)$} $line all file(builtinlines)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*promptafter[ ]*=[ ]*(.*)$} $line all file(promptafter)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*weed[ ]*=[ ]*(.*)$} $line all file(weed)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*weedout[ ]*=[ ]*(.*)$} $line all file(weedout)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*titles[ ]*=[ ]*(.*)$} $line all file(titles)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*displaycharset[ ]*=[ ]*(.*)$} $line all file(displaycharset)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*charset[ ]*=[ ]*(.*)$} $line all file(charset)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*compatcharsets[ ]*=[ ]*(.*)$} $line all file(compatcharsets)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*menu[ ]*=[ ]*(.*)$} $line all file(menu)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*userlevel[ ]*=[ ]*(.*)$} $line all file(userlevel)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*arrow[ ]*=[ ]*(.*)$} $line all file(arrow)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*sortby[ ]*=[ ]*(.*)$} $line all file(sortby)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*movepage[ ]*=[ ]*(.*)$} $line all file(movepage)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*keypad[ ]*=[ ]*(.*)$} $line all file(keypad)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*softkeys[ ]*=[ ]*(.*)$} $line all file(softkeys)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*pointnew[ ]*=[ ]*(.*)$} $line all file(pointnew)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*resolve[ ]*=[ ]*(.*)$} $line all file(resolve)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*readmsginc[ ]*=[ ]*(.*)$} $line all file(readmsginc)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*timeout[ ]*=[ ]*(.*)$} $line all file(timeout)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*names[ ]*=[ ]*(.*)$} $line all file(names)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*metoo[ ]*=[ ]*(.*)$} $line all file(metoo)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*aliassortby[ ]*=[ ]*(.*)$} $line all file(aliassortby)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*alwayskeep[ ]*=[ ]*(.*)$} $line all file(alwayskeep)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*alwaysdelete[ ]*=[ ]*(.*)$} $line all file(alwaysdelete)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*alwaysstore[ ]*=[ ]*(.*)$} $line all file(alwaysstore)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*copy[ ]*=[ ]*(.*)$} $line all file(copy)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*forcename[ ]*=[ ]*(.*)$} $line all file(forcename)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*keepempty[ ]*=[ ]*(.*)$} $line all file(keepempty)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*savename[ ]*=[ ]*(.*)$} $line all file(savename)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*receivedmail[ ]*=[ ]*(.*)$} $line all file(receivedmail)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*sentmail[ ]*=[ ]*(.*)$} $line all file(sentmail)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*maildir[ ]*=[ ]*(.*)$} $line all file(maildir)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*tmpdir[ ]*=[ ]*(.*)$} $line all file(tmpdir)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*confirmappend[ ]*=[ ]*(.*)$} $line all file(confirmappend)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*confirmfiles[ ]*=[ ]*(.*)$} $line all file(confirmfiles)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*confirmcreate[ ]*=[ ]*(.*)$} $line all file(confirmcreate)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*confirmfolders[ ]*=[ ]*(.*)$} $line all file(confirmfolders)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*sleepmsg[ ]*=[ ]*(.*)$} $line all file(sleepmsg)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*ask[ ]*=[ ]*(.*)$} $line all file(ask)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*askcc[ ]*=[ ]*(.*)$} $line all file(askcc)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*forms[ ]*=[ ]*(.*)$} $line all file(forms)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*usetite[ ]*=[ ]*(.*)$} $line all file(usetite)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*bounceback[ ]*=[ ]*(.*)$} $line all file(bounceback)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*calendar[ ]*=[ ]*(.*)$} $line all file(calendar)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*shell[ ]*=[ ]*(.*)$} $line all file(shell)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*print[ ]*=[ ]*(.*)$} $line all file(print)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*fullname[ ]*=[ ]*(.*)$} $line all file(fullname)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*alternatives[ ]*=[ ]*(.*)$} $line all file(alternatives)] {
			continue
		}
   	        if [regexp -nocase {^[ ]*configoptions[ ]*=[ ]*(.*)$} $line all file(configoptions)] {
			continue
		}
	}
	close $elmfile


  ### argument "filename" ###
	set File [open $filename w]
	### "editor" page ###
	puts $File "PAGE editor"
	if {[info exist file(editor)]} {
	    if {[string tolower $file(editor)] == "none"} {
		puts $File "RADIO editorRadio1 \"Use builtin = simulate Berkeley Mail\""
		puts $File "ENTRY editorDir1 \"emacs\""
		puts $File "COMMAND com_editorDir1 \"emacs\""
	    } else {
		puts $File "RADIO editorRadio1 \"Use editor of your own choice\""
		puts $File "ENTRY editorDir1 \"$file(editor)\""
		puts $File "COMMAND com_editorDir1 \"$file(editor)\""
	    }
	} else {
	    puts $File "RADIO editorRadio1 \"Use editor of your own choice\""
	    puts $File "ENTRY editorDir1 \"emacs\"
	    puts $File "COMMAND com_editorDir1 \"emacs\"
	}
	if {[info exist file(easyeditor)]} {
	    puts $File "ENTRY editorDir5 \"$file(easyeditor)\""
	    puts $File "COMMAND com_editorDir5 \"$file(easyeditor)\""
	} else {
	    puts $File "ENTRY editorDir5 \"emacs\""
	    puts $File "COMMAND com_editorDir5 \"emacs\""
	}
	if {[info exist file(visualeditor)]} {
	    puts $File "ENTRY editorDir6 \"$file(visualeditor)\""
	    puts $File "COMMAND com_editorDir6 \"$file(visualeditor)\""
	} else {
	    puts $File "ENTRY editorDir6 \"vi\""
	    puts $File "COMMAND com_editorDir6 \"vi\""
	}
	if {[info exist file(alteditor)]} {
	    puts $File "ENTRY editorDir7 \"$file(alteditor)\""
	    puts $File "COMMAND com_editorDir7 \"$file(alteditor)\""
	} else {
	    puts $File "ENTRY editorDir7 \"emacs\""
	    puts $File "COMMAND com_editorDir7 \"emacs\""
	}
	if {[info exist file(escape)]} {
	    puts $File "ENTRY editorEntry6 \"$file(escape)\""
	} else {
	    puts $File "ENTRY editorEntry6 \"~\""
	}

	### "quoting" page ###
	puts $File "PAGE quoting"
	if {[info exist file(autocopy)]} {
	    puts $File "CHECKBOX formatCheckBox17 [bool $file(autocopy)]"
	} else {
	    puts $File "CHECKBOX formatCheckBox17 0"
	}
	if {[info exist file(prefix)]} {
	    puts $File "CHECKBOX formatCheckBox1 1"
	    puts $File "ENTRY editorOptionsEntry11 \"$file(prefix)\""
	} else {
	    puts $File "CHECKBOX formatCheckBox1 0"
	    puts $File "ENTRY editorOptionsEntry11 \">_\""
	}
	if {[info exist file(attribution)]} {
	    puts $File "CHECKBOX quotingCheckBox1 1"
	    puts $File "ENTRY quotingEntry1 \"$file(attribution)\""
	} else {
	    puts $File "CHECKBOX quotingCheckBox1 1"
	    puts $File "ENTRY quotingEntry1 \"Quoting %s:\""
	}

	### "signature" page ###
	puts $File "PAGE signature"
	if {[info exist file(sigdashes)]} {
	    puts $File "CHECKBOX signatureCheckBox1 [bool $file(sigdashes)]"
	} else {
	    puts $File "CHECKBOX signatureCheckBox1 1"
	}
	if {[info exist file(signature)] || [info exist file(localsignature)] || [info exist file(remotesignature)]} {
            puts $File "CHECKBOX editorOptionsCheckBox33 1"
        } else {
            puts $File "CHECKBOX editorOptionsCheckBox33 0"
	}
	if {[info exist file(signature)]} {
            puts $File "CHECKBOX editorOptionsCheckBox22 1"
            set temp3 file(signature)
	    puts $File "ENTRY editorOptionsDir2 \"$file(signature)\""
	    puts $File "COMMAND com_editorOptionsDir2 \"$file(signature)\""
        } else {
            puts $File "CHECKBOX editorOptionsCheckBox22 0"
            set temp3 file(signature)
	    puts $File "ENTRY editorOptionsDir2 \"\""
	    puts $File "COMMAND com_editorOptionsDir2 \"\""
        }
	if {[info exist file(localsignature)] || [info exist file(localsignature)]} {
            puts $File "CHECKBOX editorOptionsCheckBox22 0"
        }
	if {[info exist file(localsignature)]} {
            puts $File "ENTRY editorOptionsDir3 \"$file(localsignature)\""
            puts $File "COMMAND com_editorOptionsDir3 \"$file(localsignature)\""
        } else {
            puts $File "ENTRY editorOptionsDir3 \"\""
            puts $File "COMMAND com_editorOptionsDir3 \"\""
        }
	if {[info exist file(remotesignature)]} {
            puts $File "ENTRY editorOptionsDir4 \"$file(remotesignature)\""
            puts $File "COMMAND com_editorOptionsDir4 \"$file(remotesignature)\""
        } else {
            puts $File "ENTRY editorOptionsDir4 \"\""
            puts $File "COMMAND com_editorOptionsDir4 \"\""
        }

	### "textencoding" page ###
	puts $File "PAGE textencoding"
	if {[info exist file(textencoding)]} {
 	    if {[string tolower $file(textencoding)]=="7bit"} {
	        puts $File "RADIO textencodeRadio1 \"7bit\""
	    } elseif {[string tolower $file(textencoding)]=="8bit"} {
	        puts $File "RADIO textencodeRadio1 \"8bit\""
	    } elseif {[string tolower $file(textencoding)]=="base64"} {
	        puts $File "RADIO textencodeRadio1 \"base64\""
	    } elseif {[string tolower $file(textencoding)]=="quoted-printable"} {
	        puts $File "RADIO textencodeRadio1 \"quoted-printable\""
            }
	} else {
             puts $File "RADIO textencodeRadio1 \"8bit\""
        }

	### "editingheaders" page ###
	puts $File "PAGE editingheaders"
	if {[info exist file(precedences)]} {
	    puts $File "CHECKBOX headerCheckBox1 1"
	    puts $File "ENTRY editorOptionsEntry11 \"$file(precedences)\""
	} else {
	    puts $File "CHECKBOX headerCheckBox1 0"
	    puts $File "ENTRY editorOptionsEntry11 \"\""
        }
	if {[info exist file(noheader)]} {
	    if {[bool $file(noheader)]==0} {
		puts $File "CHECKBOX editorOptionsCheckBox29 1"
	    } else {
		puts $File "CHECKBOX editorOptionsCheckBox29 0"
	    }
	} else {
	    puts $File "CHECKBOX editorOptionsCheckBox29 0"
	}

	### "viewer" page ###
	puts $File "PAGE viewer"
	if {[info exist file(pager)]} {
	    if {[string tolower $file(pager)]=="builtin" || [string tolower $file(pager)]=="builtin+"} {
                puts $File "RADIO editorOptionsRadio2 \"Builtin (recommended)\""
            } else {
                puts $File "RADIO editorOptionsRadio2 \"Use another editor for viewing\""
            }
	    if {[string tolower $file(pager)]=="builtin"} {
                puts $File "RADIO viewerRadio1 \"Builtin\""
            } elseif {[string tolower $file(pager)]=="builtin+"} {
                puts $File "RADIO viewerRadio1 \"Builtin+ (recommended)\""
            } else {
                puts $File "ENTRY editorOptionsDir1 \"$file(pager)\""
                puts $File "COMMAND com_editorOptionsDir1 \"$file(pager)\""
            }
	} else {
                puts $File "RADIO viewerRadio1 \"Builtin+ (recommended)\""
                puts $File "ENTRY editorOptionsDir1 \"emacs\""
                puts $File "COMMAND com_editorOptionsDir1 \"emacs\""
        }
        puts $File "CHECKBOX viewerCheckBox1 0"
        puts $File "ENTRY editorOptionsTextBox1 \"\""
	if {[info exist file(promptafter)]} {
	    puts $File "CHECKBOX viewerCheckBox3 [bool $file(promptafter)]"
        } else {
	    puts $File "CHECKBOX viewerCheckBox3 1"
        }
	if {[info exist file(builtinlines)]} {
	    if {$file(builtinlines)==0} {
	        puts $File "CHECKBOX viewerCheckBox2 0"
	        puts $File "INT viewerInt1 0"
            } else {
	        puts $File "CHECKBOX viewerCheckBox2 1"
	        puts $File "INT viewerInt1 \"$file(builtinlines)\""
            }
        } else {
	    puts $File "CHECKBOX viewerCheckBox2 1"
	    puts $File "INT viewerInt1 -3"
        }

	### "viewingheaders" page ###
	puts $File "PAGE viewingheaders"
	if {[info exist file(weed)]} {
            puts $File "CHECKBOX actionMenuCheckBox00 [bool $file(weed)]"
        } else {
            puts $File "CHECKBOX actionMenuCheckBox00 1"
        }
	if {[info exist file(weedout)]} {
            puts $File "TEXTBOX  actionMenuEntry00 {$file(weedout)}"
        } else {
            puts $File "TEXTBOX  actionMenuEntry00 {\">From\" \"Path:\" \"Sent:\" \"Sender:\" \"In-Reply-To:\" \"References:\" \"Newsgroups:\" \"Received:\" \"Aparently-To\" \"Message-Id:\" \"Content-Type:\" \"X-Status\" \"From:\" \"Mailer:\" \"*end-of-user-headers*\"}"
        }
	if {[info exist file(titles)]} {
            puts $File "CHECKBOX headersCheckBox12 [bool $file(titles)]"
        } else {
            puts $File "CHECKBOX headersCheckBox12 1"
        }

	### "viewingcharset" page ###
	puts $File "PAGE viewingcharset"
	if {[info exist file(displaycharset)]} {
            puts $File "ENTRY formatEntry0 \"$file(displaycharset)\""
        } else {
            puts $File "ENTRY formatEntry0 \"ISO-8859-1\""
        }
	if {[info exist file(charset)]} {
            puts $File "ENTRY formatEntry1 \"$file(charset)\""
        } else {
            puts $File "ENTRY formatEntry1 \"ISO-8859-1\""
        }
	if {[info exist file(compatcharsets)]} {
            puts $File "ENTRY formatEntry2 \"$file(compatcharsets)\""
        } else {
            puts $File "ENTRY formatEntry2 \"ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-7 ISO-8859-8 ISO-8859-9\""
        }

	### "layout" page ###
	puts $File "PAGE layout"
	if {[info exist file(menu)]} {
            puts $File "CHECKBOX actionMenuCheckBox1 [bool $file(menu)]"
        } else {
            puts $File "CHECKBOX actionMenuCheckBox1 1"
        }
	if {[info exist file(userlevel)]} {
            if {$file(userlevel)==0} {
                puts $File "RADIO actionMenuRadio1 \"Beginner level\""
            } elseif {$file(userlevel)==1} {
                puts $File "RADIO actionMenuRadio1 \"Intermediate level\""
            } else {
                puts $File "RADIO actionMenuRadio1 \"Expert level\""
            }
        } else {
            puts $File "RADIO actionMenuRadio1 \"Intermediate level\""
        }
	if {[info exist file(arrow)]} {
            if {[bool $file(arrow)] == 1} {
                puts $File "MENU actionMenuMenu1 \"arrow '->'\""
            } else {
                puts $File "MENU actionMenuMenu1 \"highlighted bar\""
            }
        } else {
            puts $File "MENU actionMenuMenu1 \"highlighted bar\""
        }
    ###### sortby = Reverse-Status ######
	set sortby_illegal_option 0
        if {[info exist file(sortby)]} {
            set str [string tolower $file(sortby)]
            regexp {^(reverse-)?(.*)$} $str all prefix txt
            switch $txt {
                sent {puts $File "MENU actionMenuMenu2 \"Date Mail sent\""}
                received {puts $File "MENU actionMenuMenu2 \"Date mail received\""}
                from {puts $File "MENU actionMenuMenu2 \"Message sender\""}
                lines {puts $File "MENU actionMenuMenu2 \"Lines in sender\""}
                subject {puts $File "MENU actionMenuMenu2 \"Message subject\""}
                status {puts $File "MENU actionMenuMenu2 \"Message status\""}
                mailbox {puts $File "MENU actionMenuMenu2 \"Mailbox order\""}
                default {puts $File "MENU actionMenuMenu2 \"Date Mail sent\""
		         set sortby_illegal_option 1}
            }
	    if {$sortby_illegal_option != 1} {
		if {$prefix == "reverse-"} {
		    puts $File "MENU actionMenuMenu3 \"top\""
		} else {
		    puts $File "MENU actionMenuMenu3 \"bottom\""
		}
            }
        } else {
                puts $File "MENU actionMenuMenu2 \"Date Mail sent\""
                puts $File "MENU actionMenuMenu3 \"top\""
	}

	### "navigation" page ###
	puts $File "PAGE navigation"
	if {[info exist file(movepage)]} {
            puts $File "CHECKBOX actionMenuCheckBox44 [bool $file(movepage)]"
        } else {
            puts $File "CHECKBOX actionMenuCheckBox44 0"
        }
	if {[info exist file(keypad)]} {
            if {[bool $file(keypad)]==0} {
                puts $File "CHECKBOX actionMenuCheckBox3 0"
                puts $File "CHECKBOX actionMenuCheckBox33 0"
            } else { 
                puts $File "CHECKBOX actionMenuCheckBox3 1"
                puts $File "CHECKBOX actionMenuCheckBox33 1"
            } 
        } else {
            puts $File "CHECKBOX actionMenuCheckBox3 0"
            puts $File "CHECKBOX actionMenuCheckBox33 0"
        }
	if {[info exist file(softkeys)]} {
            if {[bool $file(softkeys)]==0} {
                puts $File "CHECKBOX actionMenuCheckBox4 0"
            } else { 
                puts $File "CHECKBOX actionMenuCheckBox4 1"
                puts $File "CHECKBOX actionMenuCheckBox33 1"
            } 
        } else {
            puts $File "CHECKBOX actionMenuCheckBox4 0"
        }

	### "behavior" page ###
	puts $File "PAGE behavior"
	if {[info exist file(pointnew)]} {
            puts $File "CHECKBOX actionMenuCheckBox2 [bool $file(pointnew)]"
        } else {
            puts $File "CHECKBOX actionMenuCheckBox2 1"
        }
	if {[info exist file(resolve)]} {
            puts $File "CHECKBOX actionMenuCheckBox23 [bool $file(resolve)]"
        } else {
            puts $File "CHECKBOX actionMenuCheckBox23 1"
        }
	if {[info exist file(readmsginc)]} {
            puts $File "INT actionMenuInt1 $file(readmsginc)"
        } else {
            puts $File "INT actionMenuInt1 10"
        }
	if {[info exist file(timeout)]} {
            puts $File "INT actionMenuInt2 $file(timeout)"
        } else {
            puts $File "INT actionMenuInt2 300"
        }

	### "optionmenu" page ###
	puts $File "PAGE optionmenu"
        puts $File "EXTENTRY optionMenuEntry"
        set str "^cdefsopyv_am_un"
	set configoptions_empty 0
	set configoptions_ok 0
	if {[info exist file(configoptions)]} {
            if {$file(configoptions) != ""} {
                 set str $file(configoptions)
            }
        }
	# none option given or not legal option: 'configoptions=^cdefsopyv_am_un'
        while {[string length $str] != 0} {
                 set ch [string index $str 0]
                 switch $ch {
                     _ {puts $File "\{COMBOBOX optionMenuComboBox \"-- Blank line --\"\}"
		        set configoptions_ok 1}
                     a {puts $File "\{COMBOBOX optionMenuComboBox \"\[a] Arrow cursor\"\}"
		        set configoptions_ok 1}
                     b {puts $File "\{COMBOBOX optionMenuComboBox \"\[b] Border on copy\"\}"
		        set configoptions_ok 1}
                     d {puts $File "\{COMBOBOX optionMenuComboBox \"\[d] Display mail using\"\}"
		        set configoptions_ok 1}
                     e {puts $File "\{COMBOBOX optionMenuComboBox \"\[e] Primary editor\"\}"
		        set configoptions_ok 1}
                     f {puts $File "\{COMBOBOX optionMenuComboBox \"\[f] Folder directory\"\}"
		        set configoptions_ok 1}
                     h {puts $File "\{COMBOBOX optionMenuComboBox \"\[h] Hold sent message\"\}"
		        set configoptions_ok 1}
                     j {puts $File "\{COMBOBOX optionMenuComboBox \"\[j] Reply editor\"\}"
		        set configoptions_ok 1}
                     k {puts $File "\{COMBOBOX optionMenuComboBox \"\[k] Pause after pager\"\}"
		        set configoptions_ok 1}
                     l {puts $File "\{COMBOBOX optionMenuComboBox \"\[l] Alias sorting\"\}"
		        set configoptions_ok 1}
                     m {puts $File "\{COMBOBOX optionMenuComboBox \"\[m] Menu display\"\}"
		        set configoptions_ok 1}
                     n {puts $File "\{COMBOBOX optionMenuComboBox \"\[n] Names only\"\}"
		        set configoptions_ok 1}
                     o {puts $File "\{COMBOBOX optionMenuComboBox \"\[o] Outboard mail saved\"\}"
		        set configoptions_ok 1}
                     p {puts $File "\{COMBOBOX optionMenuComboBox \"\[p] Print mail using\"\}"
		        set configoptions_ok 1}
                     r {puts $File "\{COMBOBOX optionMenuComboBox \"\[r] Reply copies msg\"\}"
		        set configoptions_ok 1}
                     s {puts $File "\{COMBOBOX optionMenuComboBox \"\[s] Sorting criteria\"\}"
		        set configoptions_ok 1}
                     t {puts $File "\{COMBOBOX optionMenuComboBox \"\[t] Text editor (e)\"\}"
		        set configoptions_ok 1}
                     u {puts $File "\{COMBOBOX optionMenuComboBox \"\[u] User level\"\}"
		        set configoptions_ok 1}
                     v {puts $File "\{COMBOBOX optionMenuComboBox \"\[v] Visual editor\"\}"
		        set configoptions_ok 1}
                     y {puts $File "\{COMBOBOX optionMenuComboBox \"\[y] Your full name\"\}"
		        set configoptions_ok 1}
                     w {puts $File "\{COMBOBOX optionMenuComboBox \"\[w] Want Cc: prompt\"\}"
		        set configoptions_ok 1}
                     z {puts $File "\{COMBOBOX optionMenuComboBox \"\[z] Signature dashes\"\}"
		        set configoptions_ok 1}
		     default {set configoptions_empty 1}
              }
              set str [string range $str 1 end]
        }
	if {($configoptions_empty==1) && ($configoptions_ok==0)} {
		puts $File "\{ \}"
	}

	### "aliasmenu" page ###
	puts $File "PAGE aliasmenu"
	if {[info exist file(names)]} {
            puts $File "CHECKBOX aliasCheckBox2 [bool $file(names)]"
        } else {
            puts $File "CHECKBOX aliasCheckBox2 1"
        }
	if {[info exist file(metoo)]} {
            puts $File "CHECKBOX aliasCheckBox1 [bool $file(metoo)]"
        } else {
            puts $File "CHECKBOX aliasCheckBox1 0"
        }
    ###### aliassortby = Reverse-Name ######
        if {[info exist file(aliassortby)]} {
            set str [string tolower $file(aliassortby)]
            regexp {^(reverse-)?(.*)$} $str all prefix txt
            switch $txt {
                names {puts $File "MENU aliasMenu2 \"User-name\""}
                alias {puts $File "MENU aliasMenu2 \"Alias-name\""}
                text {puts $File "MENU aliasMenu2 \{\"aliases.text\"\}"}
            }
            if {$prefix == "reverse-"} {
                puts $File "MENU aliasMenu3 \"top\""
            } else {
                puts $File "MENU aliasMenu3 \"bottom\""
            }                
        }

	### "folderdecision" page ###
	puts $File "PAGE folderdecision"
	if {[info exist file(alwayskeep)]} {
            puts $File "CHECKBOX folderCheckBox2 [bool $file(alwayskeep)]"
        } else {
            puts $File "CHECKBOX folderCheckBox2 1"
        }
	if {[info exist file(alwaysdelete)]} {
            puts $File "CHECKBOX folderCheckBox1 [bool $file(alwaysdelete)]"
        } else {
            puts $File "CHECKBOX folderCheckBox1 0"
        }
	if {[info exist file(alwaysstore)]} {
            puts $File "CHECKBOX folderCheckBox3 [bool $file(alwaysstore)]"
        } else {
            puts $File "CHECKBOX folderCheckBox3 0"
        }
	if {[info exist file(copy)]} {
            puts $File "CHECKBOX folderCheckBox8 [bool $file(copy)]"
        } else {
            puts $File "CHECKBOX folderCheckBox8 0"
        }
	if {[info exist file(forcename)]} {
            puts $File "CHECKBOX folderCheckBox9 [bool $file(forcename)]"
        } else {
            puts $File "CHECKBOX folderCheckBox9 1"
        }
	if {[info exist file(keepempty)]} {
            puts $File "CHECKBOX folderCheckBox10 [bool $file(keepempty)]"
        } else {
            puts $File "CHECKBOX folderCheckBox10 0"
        }
	if {[info exist file(savename)]} {
            puts $File "CHECKBOX folderCheckBox11 [bool $file(savename)]"
        } else {
            puts $File "CHECKBOX folderCheckBox11 0"
        }

	### "foldercommunication" page ###
	puts $File "PAGE foldercommunication"
	if {[info exist file(receivedmail)]} {
            puts $File "ENTRY editorOptionsDir1 \"$file(receivedmail)\""
            puts $File "COMMAND com_editorOptionsDir1 \"$file(receivedmail)\""
        } else {
            puts $File "ENTRY editorOptionsDir1 \"=received\""
            puts $File "COMMAND com_editorOptionsDir1 \"=received\""
        }
	if {[info exist file(sentmail)]} {
            puts $File "ENTRY editorOptionsDir2 \"$file(sentmail)\""
            puts $File "COMMAND com_editorOptionsDir2 \"$file(sentmail)\""
        } else {
            puts $File "ENTRY editorOptionsDir2 \"=sent\""
            puts $File "COMMAND com_editorOptionsDir2 \"=sent\""
        }
	if {[info exist file(maildir)]} {
            puts $File "ENTRY editorOptionsDir3 \"$file(maildir)\""
            puts $File "COMMAND com_editorOptionsDir3 \"$file(maildir)\""
        } else {
            puts $File "ENTRY editorOptionsDir3 \"~/Mail\""
            puts $File "COMMAND com_editorOptionsDir3 \"~/Mail\""
        }
	if {[info exist file(tmpdir)]} {
            puts $File "ENTRY editorOptionsDir4 \"$file(tmpdir)\""
            puts $File "COMMAND com_editorOptionsDir4 \"$file(tmpdir)\""
        } else {
            puts $File "ENTRY editorOptionsDir4 \"/tmp/\""
            puts $File "COMMAND com_editorOptionsDir4 \"/tmp/\""
        }
	if {[info exist file(confirmappend)]} {
            puts $File "CHECKBOX folderCheckBox4 [bool $file(confirmappend)]"
        } else {
            puts $File "CHECKBOX folderCheckBox4 0"
        }
	if {[info exist file(confirmfiles)]} {
            puts $File "CHECKBOX folderCheckBox5 [bool $file(confirmfiles)]"
        } else {
            puts $File "CHECKBOX folderCheckBox5 0"
        }
	if {[info exist file(confirmcreate)]} {
            puts $File "CHECKBOX folderCheckBox6 [bool $file(confirmcreate)]"
        } else {
            puts $File "CHECKBOX folderCheckBox6 0"
        }
	if {[info exist file(confirmfolders)]} {
            puts $File "CHECKBOX folderCheckBox7 [bool $file(confirmfolders)]"
        } else {
            puts $File "CHECKBOX folderCheckBox7 0"
        }


	### "generel" page ###
	puts $File "page generel"
	if {[info exist file(sleepmsg)]} {
            puts $File "INT generelInt01 \"$file(sleepmsg)\""
        } else {
            puts $File "INT generelInt01 2"
        }
	if {[info exist file(ask)]} {
            puts $File "CHECKBOX generelCheckBox1 [bool $file(ask)]"
        } else {
            puts $File "CHECKBOX generelCheckBox1 0"
        }
	if {[info exist file(askcc)]} {
            puts $File "CHECKBOX generelCheckBox00 [bool $file(askcc)]"
        } else {
            puts $File "CHECKBOX generelCheckBox00 1"
        }
	if {[info exist file(forms)]} {
            puts $File "CHECKBOX generelCheckBox2 [bool $file(forms)]"
        } else {
            puts $File "CHECKBOX generelCheckBox2 0"
        }
	if {[info exist file(usetite)]} {
            puts $File "CHECKBOX generelCheckBox02 [bool $file(usetite)]"
        } else {
            puts $File "CHECKBOX generelCheckBox02 0"
        }
	if {[info exist file(bounceback)]} {
	    if {($file(bounceback)=="") || ($file(bounceback)=="0")} { 
		puts $File "CHECKBOX generelCheckBox3 0"
		puts $File "ENTRY generelEntry1 \"\""
	    } else {
		puts $File "CHECKBOX generelCheckBox3 1"
		puts $File "ENTRY generelEntry1 $file(bounceback)"
	    }
	} else {
	    puts $File "CHECKBOX generelCheckBox3 0"
	    puts $File "ENTRY generelEntry1 \"\""
	}
	if {[info exist file(calendar)]} {
            puts $File "ENTRY generelDir1 \"$file(calendar)\""
            puts $File "COMMAND com_generelDir1 \"$file(calendar)\""
        } else {
            puts $File "ENTRY generelDir1 \"~/\""
            puts $File "COMMAND com_generelDir1 \"~/\""
        }
	if {[info exist file(shell)]} {
            puts $File "ENTRY editorOptionsDir1 \"$file(shell)\""
            puts $File "COMMAND com_editorOptionsDir1 \"$file(shell)\""
        } else {
            puts $File "ENTRY editorOptionsDir1 \"bash\""
            puts $File "COMMAND com_editorOptionsDir1 \"bash\""
        }
	if {[info exist file(print)]} {
            puts $File "ENTRY printer \"$file(print)\""
        } else {
            puts $File "ENTRY printer \"lpr\""
        }
	if {[info exist file(fullname)]} {
            puts $File "ENTRY generelEE \"$file(fullname)\""
        } else {
            puts $File "ENTRY generelEE \"\""
        }
	if {[info exist file(alternatives)]} {
            puts $File "CHECKBOX actionMenuCheckBox007 1"
            puts $File "ENTRY actionMenuEntry007 \"$file(alternatives)\""
        } else {
            puts $File "CHECKBOX actionMenuCheckBox007 0"
            puts $File "ENTRY actionMenuEntry007 \"\""
        }

	close $File
}