]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/comp_scan.c
ncurses 6.2 - patch 20210904
[ncurses.git] / ncurses / tinfo / comp_scan.c
index 40d7f6a8bc0dc59cd49014cd8dd90d10d2ec5917..b5ee44830a2a074f918f7874f9d5030d5c256f33 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -50,7 +51,7 @@
 #include <ctype.h>
 #include <tic.h>
 
-MODULE_ID("$Id: comp_scan.c,v 1.106 2017/04/22 11:41:12 tom Exp $")
+MODULE_ID("$Id: comp_scan.c,v 1.110 2021/09/04 10:54:35 tom Exp $")
 
 /*
  * Maximum length of string capability we'll accept before raising an error.
@@ -168,6 +169,8 @@ next_char(void)
        if (result != 0) {
            FreeAndNull(result);
            FreeAndNull(pushname);
+           bufptr = 0;
+           bufstart = 0;
            allocated = 0;
        }
        /*
@@ -222,6 +225,8 @@ next_char(void)
                }
                if ((bufptr = bufstart) != 0) {
                    used = strlen(bufptr);
+                   if (used == 0)
+                       return (EOF);
                    while (iswhite(*bufptr)) {
                        if (*bufptr == '\t') {
                            _nc_curr_col = (_nc_curr_col | 7) + 1;
@@ -551,7 +556,7 @@ _nc_get_token(bool silent)
                 * Grrr...what we ought to do here is barf, complaining that
                 * the entry is malformed.  But because a couple of name fields
                 * in the 8.2 termcap file end with |\, we just have to assume
-                * it's termcap syntax.
+                * it is termcap syntax.
                 */
                _nc_syntax = SYN_TERMCAP;
                separator = ':';