1 /*
2  *   $Id: font_lis.c,v 1.2 1992/10/02 01:02:32 craigs Exp $
3  *
4  *   This code was written by Craig Southeren whilst under contract
5  *   to Computer Sciences of Australia, Systems Engineering Division.
6  *   It has been kindly released by CSA into the public domain.
7  *
8  *   Neither CSA or me guarantee that this source code is fit for anything,
9  *   so use it at your peril. I don't even work for CSA any more, so
10  *   don't bother them about it. If you have any suggestions or comments
11  *   (or money, cheques, free trips =8^) !!!!! ) please contact me
12  *   care of geoffw@extro.ucc.oz.au
13  */
14 
15 #include "machdep.h"
16 #include "defs.h"
17 
18 #include "font_lis.h"
19 #include "main.h"
20 
21 /********************************
22   defines
23  ********************************/
24 
25 struct font_name_struct {
26   char 			  * name;
27   struct font_name_struct * next;
28 };
29 
30 struct font_name_struct * font_list = NULL;
31 
32 /********************************
33  enumerate_fonts
34  ********************************/
35 
enumerate_fonts(stream)36 void enumerate_fonts (stream)
37 
38 FILE *stream;
39 
40 {
41   struct font_name_struct * p;
42 
43   for (p = font_list;p != NULL; p = p->next)
44     fprintf (stream, "%s ", p->name);
45 }
46 
47 /********************************
48  add_font_to_list
49  ********************************/
50 
add_font_to_list(fontname)51 void add_font_to_list (fontname)
52 
53 char *fontname;
54 
55 {
56   struct font_name_struct * p;
57 
58   /* make sure there is no font with this name */
59   for (p = font_list;p != NULL; p = p->next)
60     if (strcmp (fontname, p->name) == 0)
61       return;
62 
63   /* insert new font record at the start of the list */
64   p = (struct font_name_struct *)malloc (sizeof (struct font_name_struct));
65   p->name = STRDUP (fontname);
66   p->next = font_list;
67   font_list = p;
68 }
69