X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fcomp_scan.c;h=87929d20aeb9e58efb882d2df9ace4a5829f91cf;hp=40d7f6a8bc0dc59cd49014cd8dd90d10d2ec5917;hb=312665d3aaaf5d8e3ba34d80fdd650abf758272a;hpb=a8e3f06ac309504143cd56ac9ec55889bfdf4914;ds=inline diff --git a/ncurses/tinfo/comp_scan.c b/ncurses/tinfo/comp_scan.c index 40d7f6a8..87929d20 100644 --- a/ncurses/tinfo/comp_scan.c +++ b/ncurses/tinfo/comp_scan.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * Copyright 2020 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 #include -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.109 2020/02/02 23:34:34 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;