commit f90477b
ohmu
·
2026-09-23 22:57:45 +0300 MSK
parent d295326
now boolean is yes/no instead of 1/0
3 files changed,
+62,
-29
M
acme.1
+30,
-8
1@@ -69,7 +69,7 @@ and pull in colors and fonts from a theme file:
2 " base settings
3 @include .acmethemes/ghibli
4 shell /bin/rc
5-autoindent 1
6+autoindent yes
7 .fi
8 .PP
9 The following keys are recognized:
10@@ -209,19 +209,31 @@ Where to dump the window layout. Default:
11 .IR /tmp/acme.dump .
12 .TP
13 .B autoindent
14-Boolean. Auto-indent new lines. Default: 1.
15+Boolean
16+.RI ( yes / no ).
17+Auto-indent new lines. Default:
18+.IR yes .
19 .TP
20 .B swpscrlbtns
21-Boolean. Swap scroll buttons 1 and 3. Default: 0.
22+Boolean
23+.RI ( yes / no ).
24+Swap scroll buttons 1 and 3. Default:
25+.IR no .
26 .TP
27 .B clicktofocus
28-Boolean. Click to focus (bartflag). Default: 1.
29+Boolean
30+.RI ( yes / no ).
31+Click to focus (bartflag). Default:
32+.IR no .
33 .TP
34 .B colcount
35 Number of initial columns. Default: 2.
36 .TP
37 .B openarg
38-Boolean. Open files given on the command line. Default: 1.
39+Boolean
40+.RI ( yes / no ).
41+Open files given on the command line. Default:
42+.IR yes .
43 .TP
44 .B winbtnstyle
45 Style of the per-window tag button (the small square at the top left of
46@@ -265,10 +277,20 @@ Default:
47 .IR def .
48 .TP
49 .B showdotfiles
50-Boolean. Show dotfiles in directory windows. Default: 1.
51+Boolean
52+.RI ( yes / no ).
53+Show dotfiles in directory windows. Default:
54+.IR yes .
55 .TP
56 .B newcolnewrow
57-Boolean. Newcol creates a new column (0) or column with row (1). Default: 1.
58+Boolean
59+.RI ( yes / no ).
60+Newcol creates a new column
61+.RI ( no )
62+or a column with a row
63+.RI ( yes ).
64+Default:
65+.IR yes .
66 .SH EXAMPLES
67 A minimal
68 .I .acmerc :
69@@ -287,7 +309,7 @@ A configuration split into a base file and a theme:
70 " ~/.acmerc
71 @include .acmethemes/ghibli
72 shell /bin/rc
73-autoindent 1
74+autoindent yes
75
76 " ~/.acmethemes/ghibli
77 mainfont /tmp/fonts/gallant12x22/16/font
+6,
-6
1@@ -5,10 +5,10 @@
2 dumppath /tmp/.acme.dump
3 shell /bin/rc
4
5-autoindent 1
6-swpscrllbtns 0
7-clicktofocus 0
8+autoindent yes
9+swpscrllbtns no
10+clicktofocus no
11 colcount 1
12-openarg 1
13-showdotfiles 0
14-newcolnewrow 0
15+openarg yes
16+showdotfiles yes
17+newcolnewrow yes
M
parser.c
+26,
-15
1@@ -19,6 +19,9 @@ defconfig(FILE *f)
2 fprintf(f, "mainfont /lib/font/bit/lucsans/euro.8.font\n");
3 fprintf(f, "monofont /lib/font/bit/lucm/unicode.9.font\n");
4 fprintf(f, "dumppath /tmp/acme.dump\n");
5+ fprintf(f, "winbtnstyle def\n");
6+ fprintf(f, "colbtnstyle def\n");
7+ fprintf(f, "scrollstyle def\n");
8 fprintf(f, "pastels tagbg txtbg scrlfg\n");
9 fprintf(f, "\n");
10 fprintf(f, "mix FFFFFF\n");
11@@ -42,16 +45,13 @@ defconfig(FILE *f)
12 fprintf(f, "btn2hl AA0000\n");
13 fprintf(f, "btn3hl 006600\n");
14 fprintf(f, "\n");
15- fprintf(f, "autoindent 1\n");
16- fprintf(f, "swpscrlbtns 0\n");
17- fprintf(f, "clicktofocus 1\n");
18+ fprintf(f, "autoindent yes\n");
19+ fprintf(f, "swpscrlbtns no\n");
20+ fprintf(f, "clicktofocus no\n");
21 fprintf(f, "colcount 2\n");
22- fprintf(f, "openarg 1\n");
23- fprintf(f, "winbtnstyle def\n");
24- fprintf(f, "colbtnstyle def\n");
25- fprintf(f, "scrollstyle def\n");
26- fprintf(f, "showdotfiles 1\n");
27- fprintf(f, "newcolnewrow 1\n");
28+ fprintf(f, "openarg yes\n");
29+ fprintf(f, "showdotfiles yes\n");
30+ fprintf(f, "newcolnewrow yes\n");
31 }
32
33 char
34@@ -120,6 +120,17 @@ getintvalue(FILE *f, char *key, int def)
35 return result;
36 }
37
38+int
39+getboolean(char *key, int def)
40+{
41+ if(strcmp(key, "yes") == 0)
42+ return 1;
43+ else if(strcmp(key, "no") == 0)
44+ return 0;
45+
46+ return def;
47+}
48+
49 void
50 initconfig(char *custom_config)
51 {
52@@ -197,13 +208,13 @@ initconfig(char *custom_config)
53 fontnames[0] = strdup(mainfont);
54 fontnames[1] = strdup(monofont);
55
56- globalautoindent = getintvalue(f, "autoindent", 1);
57- swapscrollbuttons = getintvalue(f, "swpscrlbtns", 0);
58- bartflag = getintvalue(f, "clicktofocus", 1);
59+ globalautoindent = getboolean(parsekeyvalue(f, "autoindent", "yes"), 1);
60+ swapscrollbuttons = getboolean(parsekeyvalue(f, "swpscrlbtns", "no"), 0);
61+ bartflag = getboolean(parsekeyvalue(f, "clicktofocus", "no"), 0);
62 ncol = getintvalue(f, "colcount", 2);
63- openarg = getintvalue(f, "openarg", 1);
64- showdotfiles = getintvalue(f, "showdotfiles", 1);
65- ncolnrow = getintvalue(f, "newcolnewrow", 1);
66+ openarg = getboolean(parsekeyvalue(f, "openarg", "yes"), 1);
67+ showdotfiles = getboolean(parsekeyvalue(f, "showdotfiles", "yes"), 1);
68+ ncolnrow = getboolean(parsekeyvalue(f, "newcolnewrow", "yes"), 1);
69
70 fclose(f);
71 }