shithub: riscv

Download patch

ref: 229e8a5de102f835de1596d8adb377b6bf74b463
parent: 205f12720ed76a86a1eb01f756ef9a7099943fb4
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Fri Dec 9 17:19:13 EST 2011

acme: use $font if set, default to vga font

--- a/sys/src/cmd/acme/acme.c
+++ b/sys/src/cmd/acme/acme.c
@@ -35,11 +35,7 @@
 };
 Rune	snarfrune[NSnarf+1];
 
-char		*fontnames[2] =
-{
-	"/lib/font/bit/lucidasans/euro.8.font",
-	"/lib/font/bit/lucm/unicode.9.font"
-};
+char		*fontnames[2];
 
 Command *command;
 
@@ -105,6 +101,16 @@
 		exits("usage");
 	}ARGEND
 
+	if(fontnames[0] == nil)
+		fontnames[0] = getenv("font");
+	if(fontnames[0] == nil)
+		fontnames[0] = "/lib/font/bit/vga/vga.font";
+	if(access(fontnames[0], 0) < 0){
+		fprint(2, "acme: can't access %s: %r\n", fontnames[0]);
+		exits("font open");
+	}
+	if(fontnames[1] == nil)
+		fontnames[1] = fontnames[0];
 	fontnames[0] = estrdup(fontnames[0]);
 	fontnames[1] = estrdup(fontnames[1]);