Fix free on wrong variable
[maemo-rb.git] / utils / skinupdater / tag_table.c
bloba1a5863de01b25d3bad8836a59607d5f29d88712
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: tag_table.c 26297 2010-05-26 03:53:06Z jdgordon $
10 * Copyright (C) 2010 Robert Bieber
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "tag_table.h"
24 #include <string.h>
26 /* The tag definition table */
27 struct tag_info legal_tags[] =
29 { "ac", "" },
30 { "al", "" },
31 { "aL", "" },
32 { "ar", "" },
33 { "aR", "" },
34 { "ax", "" },
36 { "bl" , "*fIIII" },
37 { "bv", "" },
38 { "bt", "" },
39 { "bs", "" },
40 { "bc", "" },
41 { "bp", "" },
42 { "bu", "" },
45 { "cc", "" },
46 { "cd", "" },
47 { "ce", "" },
48 { "cf", "" },
49 { "cH", "" },
50 { "ck", "" },
51 { "cI", "" },
52 { "cl", "" },
53 { "cm", "" },
54 { "cM", "" },
55 { "cS", "" },
56 { "cy", "" },
57 { "cY", "" },
58 { "cP", "" },
59 { "cp", "" },
60 { "ca", "" },
61 { "cb", "" },
62 { "cu", "" },
63 { "cw", "" },
65 { "fb", "" },
66 { "fc", "" },
67 { "ff", "" },
68 { "fk", "" },
69 { "fm", "" },
70 { "fn", "" },
71 { "fp", "" },
72 { "fs", "" },
73 { "fv", "" },
74 { "d" , "I" },
76 { "Fb", "" },
77 { "Fc", "" },
78 { "Ff", "" },
79 { "Fk", "" },
80 { "Fm", "" },
81 { "Fn", "" },
82 { "Fp", "" },
83 { "Fs", "" },
84 { "Fv", "" },
85 { "D" , "I" },
88 { "ia", "" },
89 { "ic", "" },
90 { "id", "" },
91 { "iA", "" },
92 { "iG", "" },
93 { "ig", "" },
94 { "ik", "" },
95 { "in", "" },
96 { "it", "" },
97 { "iv", "" },
98 { "iy", "" },
99 { "iC", "" },
101 { "Ia", "" },
102 { "Ic", "" },
103 { "Id", "" },
104 { "IA", "" },
105 { "IG", "" },
106 { "Ig", "" },
107 { "Ik", "" },
108 { "In", "" },
109 { "It", "" },
110 { "Iv", "" },
111 { "Iy", "" },
112 { "IC", "" },
114 { "Sp", "" },
115 { "Ss", "" },
117 { "lh", "" },
119 { "mh", "" },
120 { "mr", "" },
121 { "mm", "" },
122 { "mp", "" },
123 { "mv", "|I" },
125 { "pm", "" },
126 { "pf", "" },
127 { "pb" , "*fIIII" },
128 { "pv" , "*fIIII" },
130 { "px", "" },
131 { "pc", "" },
132 { "pr", "" },
133 { "pt", "" },
134 { "pS" , "|I"},
135 { "pE" , "|I"},
136 { "pp", "" },
137 { "pe", "" },
138 { "pn", "" },
139 { "ps", "" },
141 { "rp", "" },
142 { "rr", "" },
143 { "ra", "" },
145 { "rg", "" },
146 { "xf", "" },
148 { "tp", "" },
149 { "tt", "" },
150 { "tm", "" },
151 { "ts", "" },
152 { "ta", "" },
153 { "tb", "" },
154 { "tf", "" },
155 { "Ti", "" },
156 { "Tn", "" },
157 { "Tf", "" },
158 { "Tc", "" },
159 { "tx", "" },
160 { "ty", "" },
161 { "tz", "" },
163 { "s", "" },
164 { "t" , "I" },
166 { "we", "" },
167 { "wd", "" },
168 { "wi", "" },
170 { "xl", "SFIIi" },
171 { "xd", "S" },
172 { "x", "SFII" },
174 { "Fl" , "IF"},
175 { "Cl" , "IISS"},
176 { "C" , "important"},
178 { "Vd" , "S"},
179 { "VI" , "S"},
181 { "Vp" , "ICC"},
182 { "Lt" , ""},
183 { "Li" , ""},
185 { "Vl" , "SIIiii|ii"},
186 { "Vi" , "sIIiii|ii"},
187 { "V" , "IIiii|ii"},
189 { "X" , "f"},
191 { "St" , "S"},
192 { "Sx" , "S"},
193 { "Sr" , ""},
195 { "Tl" , "|I"},
196 { "cs", "" },
197 { "T" , "IIiiI"},
199 { "Rp" , ""},
200 { "Rr" , ""},
201 { "Rf" , ""},
202 { "Re" , ""},
203 { "Rb" , ""},
204 { "Rm" , ""},
205 { "Rs" , ""},
206 { "Rn" , ""},
207 { "Rh" , ""},
208 { "s",""},
210 { "" , ""} /* Keep this here to mark the end of the table */
213 /* A table of legal escapable characters */
214 char legal_escape_characters[] = "%(,);#<|>";
217 * Just does a straight search through the tag table to find one by
218 * the given name
220 char* find_tag(char* name)
223 struct tag_info* current = legal_tags;
226 * Continue searching so long as we have a non-empty name string
227 * and the name of the current element doesn't match the name
228 * we're searching for
231 while(strcmp(current->name, name) && current->name[0] != '\0')
232 current++;
234 if(current->name[0] == '\0')
235 return NULL;
236 else
237 return current->params;
241 /* Searches through the legal escape characters string */
242 int find_escape_character(char lookup)
244 char* current = legal_escape_characters;
245 while(*current != lookup && *current != '\0')
246 current++;
248 if(*current == lookup)
249 return 1;
250 else
251 return 0;