Proposed changes to support user-defined fonts in various utilities. Notes: Sun Jan 2 02:25:58 EST 2011 geoff This is what bind(1) is for. Reference: /n/sources/patch/sorry/font-updates Date: Sat Jan 1 05:03:35 CET 2011 Signed-off-by: sstallion@gmail.com Reviewed-by: geoff --- /sys/src/cmd/ip/gping.c Sat Jan 1 05:01:12 2011 +++ /sys/src/cmd/ip/gping.c Sat Jan 1 05:01:11 2011 @@ -116,6 +116,7 @@ Graph *graph; Machine mach[NMACH]; Font *mediumfont; +char *mediumfontname; int pids[NPROC]; int npid; int parity; /* toggled to avoid patterns in textured background */ @@ -190,7 +191,7 @@ void colinit(void) { - mediumfont = openfont(display, "/lib/font/bit/pelm/latin1.8.font"); + mediumfont = openfont(display, mediumfontname); if(mediumfont == nil) mediumfont = font; @@ -992,6 +993,11 @@ f = flags; pinginterval = 5000; /* 5 seconds */ ARGBEGIN{ + case 'f': + mediumfontname = ARGF(); + if(mediumfontname == nil) + usage(); + break; case 'i': p = ARGF(); if(p == nil) @@ -1028,6 +1034,11 @@ for(i=0; iheight+2; --- /sys/src/cmd/stats.c Sat Jan 1 05:01:18 2011 +++ /sys/src/cmd/stats.c Sat Jan 1 05:01:17 2011 @@ -76,8 +76,7 @@ uvlong netetherifstats[2]; uvlong temp[10]; - /* big enough to hold /dev/sysstat even with many processors */ - char buf[8*1024]; + char buf[1024]; char *bufp; char *ebufp; }; @@ -193,6 +192,7 @@ Graph *graph; Machine *mach; Font *mediumfont; +char *mediumfontname; char *mysysname; char argchars[] = "8bceEfiImlnpstwz"; int pids[NPROC]; @@ -265,7 +265,7 @@ void colinit(void) { - mediumfont = openfont(display, "/lib/font/bit/pelm/latin1.8.font"); + mediumfont = openfont(display, mediumfontname); if(mediumfont == nil) mediumfont = font; @@ -994,7 +994,7 @@ void usage(void) { - fprint(2, "usage: stats [-O] [-S scale] [-LY] [-%s] [machine...]\n", argchars); + fprint(2, "usage: stats [-F mediumfont] [-O] [-S scale] [-LY] [-%s] [machine...]\n", argchars); exits("usage"); } @@ -1303,6 +1303,11 @@ nargs = 0; ARGBEGIN{ + case 'F': + mediumfontname = ARGF(); + if(mediumfontname == nil) + usage(); + break; case 'T': secs = atof(EARGF(usage())); if(secs > 0) @@ -1327,6 +1332,11 @@ usage(); args[nargs++] = ARGC(); }ARGEND + + if(mediumfontname == nil) + mediumfontname = getenv("mediumfont"); + if(mediumfontname == nil) + mediumfontname = "/lib/font/bit/pelm/latin1.8.font"; if(argc == 0){ mach = emalloc(nmach*sizeof(Machine)); --- /sys/man/8/ping Sat Jan 1 05:01:20 2011 +++ /sys/man/8/ping Sat Jan 1 05:01:19 2011 @@ -22,6 +22,9 @@ .PP .B ip/gping [ +.B -f +.I mediumfont +] [ .B -r ] [ .B -l @@ -125,6 +128,12 @@ specified. .PP The options are: +.TP +.B f +sets the font to +.I mediumfont, +default +.I $mediumfont. .TP .B r display round trip time in seconds. --- /sys/man/1/trace Sat Jan 1 05:01:21 2011 +++ /sys/man/1/trace Sat Jan 1 05:01:20 2011 @@ -4,6 +4,14 @@ .SH SYNOPSIS .B trace [ +.B -f +.I tinyfont +] +[ +.B -F +.I mediumfont +] +[ .B -d .I file ] @@ -42,6 +50,14 @@ and the kernel providing it have the same byte order. .PP The options are: +.TP +.B -f +set tiny font for display; default to +.I $tinyfont. +.TP +.B -F +set medium font for display; default to +.I $mediumfont. .TP .B -d specify an alternate trace event file --- /sys/man/8/stats Sat Jan 1 05:01:23 2011 +++ /sys/man/8/stats Sat Jan 1 05:01:22 2011 @@ -110,6 +110,10 @@ All graphs are affected; there is no mechanism to affect only one graph. .TP +.BI -F " mediumfont +Sets the font for the displays; default to +.I $mediumfont. +.TP .BI -T " sleepsecs Set the number of seconds between samples to .I sleepsecs --- /sys/man/1/faces Sat Jan 1 05:01:24 2011 +++ /sys/man/1/faces Sat Jan 1 05:01:23 2011 @@ -4,6 +4,12 @@ .SH SYNOPSIS .B faces [ +.B -f +.I tinyfont +] [ +.B -F +.I mediumfont +] [ .B -ih ] [ .B -m @@ -60,6 +66,18 @@ .PP If arrows are visible, clicking on them will scroll the display. Middle-clicking on the arrows scrolls to the end. +.PP +The +.B -f +and +.B -F +options set the fonts used by +.I faces. +These default to +.I $tinyfont +and +.I $mediumfont +respectively. .PP Starting .B faces