aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-11-26 23:31:37 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-11-26 23:31:37 +0200
commit79a1d947b38a60a2145f9b69e087004cd3b123d4 (patch)
tree09c3fc1d9b0f7ca2c870921e502ba1fa1f9bbe88 /src
parent03c385e51d8c0cdfb81abaec2be7111b41a9bc3a (diff)
downloadgrecs-79a1d947b38a60a2145f9b69e087004cd3b123d4.tar.gz
grecs-79a1d947b38a60a2145f9b69e087004cd3b123d4.tar.bz2
Minor fix in wordsplit parser.
* src/wordsplit.c (scan_word): Ignore trailing whitespace. * src/grecs-lex.l: Remove duplicate inclusion of config.h
Diffstat (limited to 'src')
-rw-r--r--src/grecs-lex.l4
-rw-r--r--src/wordsplit.c6
2 files changed, 4 insertions, 6 deletions
diff --git a/src/grecs-lex.l b/src/grecs-lex.l
index 02fea45..66c1014 100644
--- a/src/grecs-lex.l
+++ b/src/grecs-lex.l
@@ -21,10 +21,6 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
#include <grecs.h>
#include <grecs-gram.h>
#include <unistd.h>
diff --git a/src/wordsplit.c b/src/wordsplit.c
index 5469503..f51a845 100644
--- a/src/wordsplit.c
+++ b/src/wordsplit.c
@@ -22,6 +22,7 @@
#include <c-ctype.h>
#include <errno.h>
#include <unistd.h>
+#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <wordsplit.h>
@@ -196,8 +197,9 @@ scan_word (struct wordsplit *wsp, size_t *pstart, size_t *pend)
if (wsp->ws_flags & WRDSF_WS)
{
/* Skip initial whitespace */
- while (i < len && isws (command[i]))
- i++;
+ while (isws (command[i]))
+ if (++i == len)
+ return WRDSE_EOF;
}
start = i;

Return to:

Send suggestions and report system problems to the System administrator.