summaryrefslogtreecommitdiff
path: root/fslsfonts.c
diff options
context:
space:
mode:
Diffstat (limited to 'fslsfonts.c')
-rw-r--r--fslsfonts.c66
1 files changed, 40 insertions, 26 deletions
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 <X11/fonts/FSlib.h>
#include <stdio.h>
#include <X11/Xos.h>
+#include <stdlib.h>
#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");