Bugfix: conversion of an empty string to a date or hour object
[AXE.git] / src / datelex.c
index d61cc67..ac8e492 100644 (file)
@@ -1,7 +1,18 @@
 /*$Log: datelex.c,v $
-/*Revision 1.1  2002-07-25 08:01:26  arjen
-/*First checkin, AXE release 0.2
+/*Revision 1.2  2002-09-28 06:58:45  arjen
+/*Bugfix: conversion of an empty string to a date or hour object
+/*now makes the values of such an object 0 (null) instead of giving
+/*a segmentation fault.
+/*The class UTC combines the date and hour classes. The most basic
+/*functions of the UTC class are now implemented.
+/*These include constructors and conversion to and from String objects.
+/*New functions: date::proper(), hour::proper() and UTC::proper().
+/*Return true if the object holds a proper clock time and/or calendar
+/*date; false if at least one value is out of range.
 /*
+ *Revision 1.1  2002/07/25 08:01:26  arjen
+ *First checkin, AXE release 0.2
+ *
  * Revision 1.1  84/09/01  15:01:14  wales
  * Initial revision
  * 
@@ -47,7 +58,7 @@
 /* AJB, Aug 28 1999:  Added month names in Dutch  */
 
 #ifdef RCSIDENT
-static char rcsident[] = "$Header: /cvsroot/lib/AXE/src/datelex.c,v 1.1 2002-07-25 08:01:26 arjen Exp $";
+static char rcsident[] = "$Header: /cvsroot/lib/AXE/src/datelex.c,v 1.2 2002-09-28 06:58:45 arjen Exp $";
 #endif /* RCSIDENT */
 
 #include <stdio.h>
@@ -223,9 +234,12 @@ yylex ()
     c = buffer; d = yyinbuf;
 
     /* Skip over blanks, tabs, commas, and parentheses. */
-    do { *c = *d++; }
-       while (*c == ' ' || *c == '\t' || *c == ','
-              || *c == '(' || *c == ')');
+    do
+    {
+       *c = *d++;
+    }
+    while (*c != '\0' && (*c == ' ' || *c == '\t' || *c == ','
+                      || *c == '(' || *c == ')'));
 
     /* A zero (null) byte signals the end of the input. */
     if (*c == 0)