From ab1d154e3006704f4a33b1d73b0435540299b9ba Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Fri, 14 Nov 2003 16:48:57 +0000 Subject: XFree86 4.3.0.1 --- fslsfonts.c | 66 +++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 26 deletions(-) (limited to 'fslsfonts.c') diff --git a/fslsfonts.c b/fslsfonts.c index f7a927f..2ca2baf 100644 --- a/fslsfonts.c +++ b/fslsfonts.c @@ -43,10 +43,12 @@ in this Software without prior written authorization from The Open Group. * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ +/* $XFree86: xc/programs/fslsfonts/fslsfonts.c,v 3.8 2001/12/14 20:00:45 dawes Exp $ */ -#include "FSlib.h" +#include #include #include +#include #ifndef N_START #define N_START 1000 /* Maximum # of fonts to start with */ @@ -79,8 +81,17 @@ FSServer *svr; char *program_name; - -usage() +static void usage ( void ); +static void get_list ( char *pattern ); +static int compare ( const void *f1, const void *f2 ); +static void show_fonts ( void ); +static void print_font_header ( void ); +static void show_font_header ( FontList *list ); +static void copy_number ( char **pp1, char **pp2, int n1, int n2 ); +static void show_font_props ( FontList *list ); + +static void +usage(void) { fprintf(stderr, "usage: %s [-options] [-fn pattern]\n", program_name); fprintf(stderr, "where options include:\n"); @@ -107,9 +118,8 @@ usage() exit(1); } -main(argc, argv) - int argc; - char **argv; +int +main(int argc, char *argv[]) { int argcnt = 0, i; @@ -126,6 +136,10 @@ main(argc, argv) } if ((svr = FSOpenServer(servername)) == NULL) { + if (FSServerName(servername) == NULL) { + fprintf(stderr, "%s: no font server defined\n", program_name); + exit(0); + } fprintf(stderr, "%s: unable to open server \"%s\"\n", program_name, FSServerName(servername)); exit(0); @@ -195,8 +209,8 @@ next: ; exit(0); } -get_list(pattern) - char *pattern; +static void +get_list(char *pattern) { int available = nnames + 1, i; @@ -261,19 +275,19 @@ get_list(pattern) } } -compare(f1, f2) - FontList *f1, - *f2; +static int +compare(const void *f1, const void *f2) { - char *p1 = f1->name, - *p2 = f2->name; + char *p1 = ((FontList *)f1)->name, + *p2 = ((FontList *)f2)->name; while (*p1 && *p2 && *p1 == *p2) p1++, p2++; return (*p1 - *p2); } -show_fonts() +static void +show_fonts(void) { int i; @@ -358,7 +372,8 @@ single_column: printf("%s\n", font_list[i].name); } -print_font_header() +static void +print_font_header(void) { printf("DIR "); printf("MIN "); @@ -371,8 +386,8 @@ print_font_header() printf("\n"); } -show_font_header(list) - FontList *list; +static void +show_font_header(FontList *list) { char *string; FSXFontInfoHeader *pfh; @@ -439,13 +454,12 @@ show_font_header(list) } } +#ifndef max #define max(a, b) ((a) > (b) ? (a) : (b)) +#endif -copy_number(pp1, pp2, n1, n2) - char **pp1, - **pp2; - int n1, - n2; +static void +copy_number(char **pp1, char **pp2, int n1, int n2) { char *p1 = *pp1; char *p2 = *pp2; @@ -462,8 +476,8 @@ copy_number(pp1, pp2, n1, n2) *pp2 = p2; } -show_font_props(list) - FontList *list; +static void +show_font_props(FontList *list) { int i; char buf[1000]; @@ -484,10 +498,10 @@ show_font_props(list) printf("%s\n", buf); break; case PropTypeUnsigned: - printf("%d\n", (unsigned long) po->value.position); + printf("%lu\n", (unsigned long) po->value.position); break; case PropTypeSigned: - printf("%d\n", (long) po->value.position); + printf("%lu\n", (long) po->value.position); break; default: fprintf(stderr, "bogus property\n"); -- cgit v1.2.3