From eabea97226515d709064e07485caeb41d413ca44 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 29 Jun 2002 21:08:13 +0000 Subject: [PATCH] Update. 2002-06-29 Ulrich Drepper * catgets/gencat.c (read_input_file): Handle more than one slash at end of line correctly [PR libc/3926]. Based on a patch by Steven Kim . * catgets/sample.SJIS: Add test case for above bug. * catgets/test-gencat.c: Adjust test code. * catgets/test-gencat.sh: Adjust expected results. * elf/do-rel.h (elf_dynamic_do_rel): Avoid overflow in computation to skip relative relocations. Patch by Geoff Keating . --- ChangeLog | 14 ++++++++++++++ catgets/gencat.c | 20 +++++++++++++++++--- catgets/sample.SJIS | 2 ++ catgets/test-gencat.c | 2 ++ catgets/test-gencat.sh | 8 +++++--- manual/time.texi | 8 ++++++-- 6 files changed, 46 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ad57b6036..98b2695340 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2002-06-29 Ulrich Drepper + + * catgets/gencat.c (read_input_file): Handle more than one slash + at end of line correctly [PR libc/3926]. + Based on a patch by Steven Kim . + + * catgets/sample.SJIS: Add test case for above bug. + * catgets/test-gencat.c: Adjust test code. + * catgets/test-gencat.sh: Adjust expected results. + + * elf/do-rel.h (elf_dynamic_do_rel): Avoid overflow in computation + to skip relative relocations. + Patch by Geoff Keating . + 2002-05-26 Bruno Haible * iconv/loop.c (STANDARD_FROM_LOOP_ERR_HANDLER): New macro. diff --git a/catgets/gencat.c b/catgets/gencat.c index 2b6a11fb78..01db830702 100644 --- a/catgets/gencat.c +++ b/catgets/gencat.c @@ -325,15 +325,29 @@ read_input_file (struct catalog *current, const char *fname) ++line_number; /* It the line continued? */ + continued = 0; if (buf[act_len - 1] == '\n') { --act_len; - continued = buf[act_len - 1] == '\\'; + + /* There might be more than one backslash at the end of + the line. Only if there is an odd number of them is + the line continued. */ + if (buf[act_len - 1] == '\\') + { + int temp_act_len = act_len; + + do + { + --temp_act_len; + continued = !continued; + } + while (temp_act_len > 0 && buf[temp_act_len - 1] == '\\'); + } + if (continued) --act_len; } - else - continued = 0; /* Append to currently selected line. */ obstack_grow (¤t->mem_pool, buf, act_len); diff --git a/catgets/sample.SJIS b/catgets/sample.SJIS index 80156e0d2c..d0ac0baa55 100644 --- a/catgets/sample.SJIS +++ b/catgets/sample.SJIS @@ -8,5 +8,7 @@ $set 1 3 sample3:予定表: 4 sample4:TEST\tTAB: 5 sample5:機能\t十種類: +6 double slash\\ +7 "another line" $set Another FOO "message foo" diff --git a/catgets/test-gencat.c b/catgets/test-gencat.c index cb026fdc60..eaa9b895f6 100644 --- a/catgets/test-gencat.c +++ b/catgets/test-gencat.c @@ -23,6 +23,8 @@ main (void) printf ("%s\n", catgets(catalog, 1, 3, "sample 3")); printf ("%s\n", catgets(catalog, 1, 4, "sample 4")); printf ("%s\n", catgets(catalog, 1, 5, "sample 5")); + printf ("%s\n", catgets(catalog, 1, 6, "sample 6")); + printf ("%s\n", catgets(catalog, 1, 7, "sample 7")); catclose (catalog); return 0; diff --git a/catgets/test-gencat.sh b/catgets/test-gencat.sh index 3e9356a5ef..7b88994f34 100755 --- a/catgets/test-gencat.sh +++ b/catgets/test-gencat.sh @@ -1,6 +1,6 @@ #! /bin/sh # Test escape character handling in gencat. -# Copyright (C) 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. # This file is part of the GNU C Library. # @@ -36,12 +36,14 @@ sample2: sample3:予定表: sample4:TEST TAB: sample5:機能 十種類: +double slash\ +another line EOF res=$? cat <