Looks fine.
On 30 December 2013 11:58, Sami Kerola <[email protected]> wrote: > * src/hello.c: remove --next-generation print out format > * man/hello.x: remove --next-generation related BUG item > * Makefile.am: remove --next-generation test > * doc/hello.texi: remove --next-generation documentation > * tests/multiline-box-1: removal > * tests/last-1: remove use of -n option > > Karl Berry proposed the removal. > --- > Makefile.am | 1 - > doc/hello.texi | 11 +------ > man/hello.x | 4 --- > src/hello.c | 87 > ++------------------------------------------------- > tests/last-1 | 6 ++-- > tests/multiline-box-1 | 41 ------------------------ > 6 files changed, 5 insertions(+), 145 deletions(-) > delete mode 100755 tests/multiline-box-1 > > diff --git a/Makefile.am b/Makefile.am > index f60d4d0..aafb2b8 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -55,7 +55,6 @@ TESTS = \ > tests/greeting-2 \ > tests/hello-1 \ > tests/last-1 \ > - tests/multiline-box-1 \ > tests/traditional-1 > > EXTRA_DIST += $(TESTS) > diff --git a/doc/hello.texi b/doc/hello.texi > index 04c93d6..8743d29 100644 > --- a/doc/hello.texi > +++ b/doc/hello.texi > @@ -248,15 +248,6 @@ what the program does, as well as the synopsis of how > to run the > program. Any environment variables which affect execution should also > be mentioned (Hello doesn't have any). > > -@item --next-generation > -@itemx -n > -@opindex --next-generation > -@opindex -n > -Output the greeting, but possibly including box-drawing > -characters or other fancy stuff, especially in translated locales. > -(If you would like to volunteer to translate messages for GNU packages, > -please see @url{http://translationproject.org}.) > - > @item --traditional > @itemx -t > @opindex --traditional > @@ -274,7 +265,7 @@ standard output and then exit successfully. > > @end table > > -If more than one of the greeting options (@option{-g}, @option{-n}, > +If more than one of the greeting options (@option{-g}, > @option{-t}, and their long-named equivalents) is specified, whichever > comes last takes precedence. > > diff --git a/man/hello.x b/man/hello.x > index a1ec478..9344236 100644 > --- a/man/hello.x > +++ b/man/hello.x > @@ -1,6 +1,2 @@ > [NAME] > hello - friendly greeting program > -[BUGS] > -When --next-generation is combined with --greeting=TEXT, where the TEXT > -contains tabs and the terminal tab width is not 8 characters, the > -right-hand side of the frame can be incorrectly drawn. > diff --git a/src/hello.c b/src/hello.c > index 9c27234..fe85539 100644 > --- a/src/hello.c > +++ b/src/hello.c > @@ -24,24 +24,14 @@ > static const struct option longopts[] = { > {"greeting", required_argument, NULL, 'g'}, > {"help", no_argument, NULL, 'h'}, > - {"next-generation", no_argument, NULL, 'n'}, > {"traditional", no_argument, NULL, 't'}, > {"version", no_argument, NULL, 'v'}, > {NULL, 0, NULL, 0} > }; > > -/* Different types of greetings; only one per invocation. */ > -typedef enum > -{ > - greet_traditional, > - greet_new > -} greeting_type; > - > /* Forward declarations. */ > static void print_help (void); > static void print_version (void); > -static void print_box (wchar_t * mb_greeting); > -static void print_frame (const size_t len); > > int > main (int argc, char *argv[]) > @@ -51,7 +41,6 @@ main (int argc, char *argv[]) > const char *greeting_msg; > wchar_t *mb_greeting; > size_t len; > - greeting_type g = greet_traditional; > > set_program_name (argv[0]); > > @@ -73,7 +62,7 @@ main (int argc, char *argv[]) > This is implemented in the Gnulib module "closeout". */ > atexit (close_stdout); > > - while ((optc = getopt_long (argc, argv, "g:hntv", longopts, NULL)) != > -1) > + while ((optc = getopt_long (argc, argv, "g:htv", longopts, NULL)) != -1) > switch (optc) > { > /* --help and --version exit immediately, per GNU coding > standards. */ > @@ -88,11 +77,7 @@ main (int argc, char *argv[]) > print_help (); > exit (EXIT_SUCCESS); > break; > - case 'n': > - g = greet_new; > - break; > case 't': > - g = greet_traditional; > greeting_msg = _("hello, world"); > break; > default: > @@ -121,80 +106,13 @@ main (int argc, char *argv[]) > mbsrtowcs(mb_greeting, &greeting_msg, len + 1, NULL); > > /* Print greeting message and exit. */ > - if (g != greet_new) > - wprintf (L"%ls\n", mb_greeting); > - else > - print_box(mb_greeting); > + wprintf (L"%ls\n", mb_greeting); > free(mb_greeting); > > exit (EXIT_SUCCESS); > } > > > -/* New format message in box. */ > - > -void > -print_box (wchar_t * greeting) > -{ > - wchar_t *ignored; > - size_t longest_line = 0; > - > - struct parts > - { > - wchar_t *str; > - size_t len; > - struct parts *next; > - }; > - struct parts *first, *p; > - > - first = xmalloc (sizeof (struct parts)); > - first->next = NULL; > - p = first; > - > - p->str = wcstok (greeting, L"\n", &ignored); > - p->len = wcslen (p->str); > - while (p->str != NULL) > - { > - size_t i, len_tabs = 0; > - for (i = 0; *(p->str + i) != '\0'; i++) > - { > - if (*(p->str + i) == '\t') > - len_tabs += 8 - (len_tabs + 2) % 8; > - else > - len_tabs++; > - } > - p->len = len_tabs - i; > - if (longest_line < len_tabs) > - longest_line = len_tabs; > - p->next = xmalloc (sizeof (struct parts)); > - p = p->next; > - p->str = wcstok (NULL, L"\n", &ignored); > - } > - > - print_frame (longest_line); > - for (p = first; p->str != NULL; p = p->next) > - { > - wprintf (L"| %-*ls |\n", longest_line - p->len, p->str); > - free (p); > - } > - print_frame (longest_line); > - free (p); > -} > - > - > -/* Print new format upper and lower frame. */ > - > -void > -print_frame (const size_t len) > -{ > - size_t i; > - fputws (L"+-", stdout); > - for (i = 0; i < len; i++) > - putwchar (L'-'); > - fputws (L"-+\n", stdout); > -} > - > - > /* Print help info. This long message is split into > several pieces to help translators be able to align different > blocks and identify the various pieces. */ > @@ -224,7 +142,6 @@ Print a friendly, customizable greeting.\n"), stdout); > no-wrap */ > fputs (_("\ > -t, --traditional use traditional greeting\n\ > - -n, --next-generation use next-generation greeting\n\ > -g, --greeting=TEXT use TEXT as the greeting message\n"), stdout); > > printf ("\n"); > diff --git a/tests/last-1 b/tests/last-1 > index 0390ca4..70d2b23 100755 > --- a/tests/last-1 > +++ b/tests/last-1 > @@ -21,14 +21,12 @@ export LANGUAGE LC_ALL LC_MESSAGES LANG > > tmpfiles="last-test1.ok" > cat <<EOF > last-test1.ok > -+----------+ > -| my hello | > -+----------+ > +my hello > EOF > > tmpfiles="$tmpfiles last-test1.out" > : ${HELLO=hello} > -${HELLO} -t -n -g 'my hello' | tr -d '\r' \ > +${HELLO} -t -g 'my hello' | tr -d '\r' \ > | tr -d '\r' >last-test1.out > > : ${DIFF=diff} > diff --git a/tests/multiline-box-1 b/tests/multiline-box-1 > deleted file mode 100755 > index 960fe99..0000000 > --- a/tests/multiline-box-1 > +++ /dev/null > @@ -1,41 +0,0 @@ > -#! /bin/sh > -# Test that last greeting option specified is what counts. > -# > -# Copyright 2013 Free Software Foundation, Inc. > -# > -# Copying and distribution of this file, with or without modification, > -# are permitted in any medium without royalty provided the copyright > -# notice and this notice are preserved. > -# This script takes one argument. > - > -trap 'rm -fr $tmpfiles' 1 2 3 15 > - > -# We force the C locale here, since we are checking normal output, > -# which will be translated. > - > -LANGUAGE= > -LC_ALL=C > -LC_MESSAGES= > -LANG= > -export LANGUAGE LC_ALL LC_MESSAGES LANG > - > -tmpfiles="multiline-box-test1.ok" > -cat <<EOF > multiline-box-test1.ok > -+----------+ > -| abcd | > -| 1 23 | > -+----------+ > -EOF > - > -tmpfiles="$tmpfiles multiline-box-test1.out" > -: ${HELLO=hello} > -${HELLO} -n -g "$(printf abcd\\n1\\t23\\n)" | tr -d '\r' \ > -| tr -d '\r' >multiline-box-test1.out > - > -: ${DIFF=diff} > -${DIFF} multiline-box-test1.ok multiline-box-test1.out > -result=$? > - > -rm -fr $tmpfiles > - > -exit $result > -- > 1.8.5.2 > > > -- http://rrt.sc3d.org
