]> granicus.if.org Git - nethack/commitdiff
merge two sets of patches to makedefs.c,qtext.h
authornhmall <mjnh@persona.ca>
Sun, 24 May 2015 14:27:03 +0000 (10:27 -0400)
committernhmall <mjnh@persona.ca>
Sun, 24 May 2015 14:27:03 +0000 (10:27 -0400)
 Changes to be committed:
modified:   include/qtext.h
modified:   util/makedefs.c

include/qtext.h
util/makedefs.c

index ccfbb1407593dbfa059ec7946f5c10edfdc66e4b..ac65fc6b313fef27dcc0eb12d66b4577cb4fa155 100644 (file)
@@ -49,6 +49,7 @@ struct        qthdr {
 #define TEXT_TRUNC     "Text record truncated at line %d\n"
 #define OUT_OF_HEADERS "Too many message types (line %d)\nAdjust N_HDR in qtext.h and recompile.\n"
 #define OUT_OF_MESSAGES "Too many messages in class (line %d)\nAdjust N_MSG in qtext.h and recompile.\n"
+#define QLINE_TOO_LONG "Line %d too long; truncated\n"
 
 
 #else  /***** !MAKEDEFS *****/
index 92ee31db978f7fb535dffb3252a58eaadf9c21cf..773b87ac0310fc002fbb26838d11a930cfb6dd73 100644 (file)
@@ -2423,6 +2423,14 @@ do_questtxt()
         SpinCursor(3);
 
         qt_line++;
+        if (!index(in_line, '\n')) {
+            /* no newline; line is longer than QTEXT_IN_SIZ-1 */
+            int c;
+
+            Fprintf(stderr, QLINE_TOO_LONG, qt_line);
+            /* discard the rest of the current input line */
+            do { c = fgetc(ifp); } while (c != '\n' && c != EOF);
+        }
         if (qt_control(line))
             do_qt_control(line);
         else if (qt_comment(line))