English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Diff of /branches/common-nfo/tools/nfotiser/parser.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3469 by tg, Thu Aug 9 15:12:02 2007 UTC revision 3470 by tg, Thu Aug 9 16:04:11 2007 UTC
# Line 104  nfo_parse(int fd, const struct parser_ke Line 104  nfo_parse(int fd, const struct parser_ke
104          struct stat sb;          struct stat sb;
105          char *entry_multi;          char *entry_multi;
106          unsigned entry_iter;          unsigned entry_iter;
107            enum parser_kwtype entry_type;
108    
109          res = xmalloc(sizeof (struct parser_result));          res = xmalloc(sizeof (struct parser_result));
110          CIRCLEQ_INIT(res);          CIRCLEQ_INIT(res);
# Line 217  nfo_parse(int fd, const struct parser_ke Line 218  nfo_parse(int fd, const struct parser_ke
218                  char *np;                  char *np;
219    
220                  /* exact match? */                  /* exact match? */
221                  if (!strcasecmp(cp, kwp->kwprefix))                  if (!strcasecmp(cp, kwp->kwprefix)) {
222                          /* yepp */ break;                          /* yep */
223                            entry_type = KWT_NORMAL;
224                            break;
225                    }
226                  /* prefix match allowed? */                  /* prefix match allowed? */
227                  if (kwp->kwtype == KWT_NORMAL)                  if (kwp->kwtype == KWT_NORMAL)
228                          /* nope */ continue;                          /* nope */ continue;
# Line 229  nfo_parse(int fd, const struct parser_ke Line 233  nfo_parse(int fd, const struct parser_ke
233                          /* same */ continue;                          /* same */ continue;
234                  /* okay, we got a prefix match, get args */                  /* okay, we got a prefix match, get args */
235                  np = cp + n + 1;                  np = cp + n + 1;
236                    entry_type = kwp->kwtype;
237                  if (kwp->kwtype == KWT_ITERATED ||                  if (kwp->kwtype == KWT_ITERATED ||
238                      (kwp->kwtype == KWT_MULTITOP &&                      (kwp->kwtype == KWT_MULTITOP &&
239                       (*np >= '0' && *np <= '9')) ||                       (*np >= '0' && *np <= '9')) ||
# Line 249  nfo_parse(int fd, const struct parser_ke Line 254  nfo_parse(int fd, const struct parser_ke
254                          *zp++ = '\0';                          *zp++ = '\0';
255                          entry_iter = (unsigned)strtoul(np, NULL, 0);                          entry_iter = (unsigned)strtoul(np, NULL, 0);
256                          np = zp;                          np = zp;
257                            if (kwp->kwtype == KWT_MULTITOP)
258                                    entry_type = KWT_MULTITER;
259                  }                  }
260                    if (kwp->kwtype == KWT_MULTITOP)
261                            entry_type = KWT_MULTI;
262                  if (kwp->kwtype == KWT_MULTI ||                  if (kwp->kwtype == KWT_MULTI ||
263                      kwp->kwtype == KWT_MULTITOP ||                      kwp->kwtype == KWT_MULTITOP ||
264                      kwp->kwtype == KWT_MULTITER)                      kwp->kwtype == KWT_MULTITER)
# Line 262  nfo_parse(int fd, const struct parser_ke Line 271  nfo_parse(int fd, const struct parser_ke
271          entry = xmalloc(sizeof (struct parser_res));          entry = xmalloc(sizeof (struct parser_res));
272          bzero(entry, sizeof (struct parser_res));          bzero(entry, sizeof (struct parser_res));
273          entry->keyword = kwp->kwnum;          entry->keyword = kwp->kwnum;
274            entry->itype = entry_type;
275          entry->kw_multi = entry_multi;          entry->kw_multi = entry_multi;
276          entry->kw_iter = entry_iter;          entry->kw_iter = entry_iter;
277          entry->value = str_save(tp);          entry->value = str_save(tp);

Legend:
Removed from v.3469  
changed lines
  Added in v.3470

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20