Package: spell
Version: 1.0-12
Severity: minor

This does not work:

        echo hello >dummy; echo hello >dummy2; spell -d dummy dummy2

it yields:

        spell: option argument not given

This is because of a now forgotten change in getopt_long().

Also, the '-d/--dictionary' option is misleading, since it does not
refer to an actual dictionary, but a wordlist.  I propose a '-D'
option to specify an ispell dictionary, while not touching '-d', as I
don't want to break backwards compatibility.  (And in some true spell
implementations, '-d' is also used for specifying a wordlist.)

I believe I sent you this proposed patch quite some time ago, but I
never submitted it to the BTS...

diff -Naur spell-1.0/debian/spell.1 spell-1.0.fixed/debian/spell.1
--- spell-1.0/debian/spell.1    2005-02-28 15:02:15.000000000 +0100
+++ spell-1.0.fixed/debian/spell.1      2003-12-04 11:50:30.000000000 +0100
@@ -42,6 +42,9 @@
 .B \-i, \-\-ispell=PROGRAM
 Calls PROGRAM as Ispell.
 .TP
+.B \-D, \-\-ispell-dictionary=DICTIONARY
+Use the named DICTIONARY to look up words.
+.TP
 .B \-l, \-\-all-chains
 Ignored; for compatibility.
 .TP
diff -Naur spell-1.0/spell.c spell-1.0.fixed/spell.c
--- spell-1.0/spell.c   1996-04-10 06:41:09.000000000 +0200
+++ spell-1.0.fixed/spell.c     2003-12-04 11:41:28.000000000 +0100
@@ -116,6 +116,7 @@
   {"ispell", required_argument, NULL, 'i'},
   {"ispell-version", no_argument, NULL, 'I'},
   {"number", no_argument, NULL, 'n'},
+  {"ispell-dictionary", required_argument, NULL, 'D'},
   {"print-file-name", no_argument, NULL, 'o'},
   {"print-stems", no_argument, NULL, 'x'},
   {"stop-list", required_argument, NULL, 's'},
@@ -130,9 +131,12 @@
 /* Ispell's location.  */
 char *ispell_prog = NULL;
 
-/* Dictionary to use.  Just use the default if NULL.  */
+/* Personal dictionary to use.  Just use the default if NULL.  */
 char *dictionary = NULL;
 
+/* Ispell dictionary to use via ispell's -d argument */
+char *idict = NULL;
+
 /* Display Ispell's version (--ispell-version, -I). */
 int show_ispell_version = 0;
 
@@ -171,7 +175,7 @@
   /* Option processing loop.  */
   while (1)
     {
-      opt = getopt_long (argc, argv, "IVbdhilnosvx", long_options,
+      opt = getopt_long (argc, argv, "IVbd:D:hi:lnos:vx", long_options,
                         (int *) 0);
 
       if (opt == EOF)
@@ -192,7 +196,7 @@
          if (optarg != NULL)
            dictionary = xstrdup (optarg);
          else
-           error (0, 0, "option argument not given");
+           error (0, 0, "option argument not given to -d");
          break;
        case 'h':
          show_help = 1;
@@ -201,7 +205,7 @@
          if (optarg != NULL)
            ispell_prog = xstrdup (optarg);
          else
-           error (0, 0, "option argument not given");
+           error (0, 0, "option argument not given to -i");
          break;
        case 'l':
          break;
@@ -211,6 +215,12 @@
        case 'o':
          print_file_names = 1;
          break;
+       case 'D':
+         if (optarg !=NULL)
+           idict = xstrdup (optarg);
+         else
+           error (0, 0, "option argument not given to -D");
+         break;
        case 's':
          break;
        case 'v':
@@ -242,18 +252,19 @@
     {
       printf ("Usage: %s [OPTION]... [FILE]...\n", program_name);
       fputs ("This is GNU Spell, a Unix spell emulator.\n\n"
-            "  -I, --ispell-version\t\tPrint Ispell's version.\n"
-            "  -V, --version\t\t\tPrint the version number.\n"
-            "  -b, --british\t\t\tUse the British dictionary.\n"
-            "  -d, --dictionary=FILE\t\tUse FILE to look up words.\n"
-            "  -h, --help\t\t\tPrint a summary of the options.\n"
-            "  -i, --ispell=PROGRAM\t\tCalls PROGRAM as Ispell.\n"
-            "  -l, --all-chains\t\tIgnored; for compatibility.\n"
-            "  -n, --number\t\t\tPrint line numbers before lines.\n"
-            "  -o, --print-file-name\t\tPrint file names before lines.\n"
-            "  -s, --stop-list=FILE\t\tIgnored; for compatibility.\n"
-            "  -v, --verbose\t\t\tPrint words not literally found.\n"
-            "  -x, --print-stems\t\tIgnored; for compatibility.\n\n"
+            "  -I, --ispell-version\t\t\tPrint Ispell's version.\n"
+            "  -V, --version\t\t\t\tPrint the version number.\n"
+            "  -b, --british\t\t\t\tUse the British dictionary.\n"
+            "  -d, --dictionary=FILE\t\t\tUse FILE to look up words.\n"
+            "  -h, --help\t\t\t\tPrint a summary of the options.\n"
+            "  -i, --ispell=PROGRAM\t\t\tCalls PROGRAM as Ispell.\n"
+            "  -l, --all-chains\t\t\tIgnored; for compatibility.\n"
+            "  -n, --number\t\t\t\tPrint line numbers before lines.\n"
+            "  -o, --print-file-name\t\t\tPrint file names before lines.\n"
+            "  -D, --ispell-dictionary=DICTIONARY\tUse DICTIONARY to look up 
words.\n"
+            "  -s, --stop-list=FILE\t\t\tIgnored; for compatibility.\n"
+            "  -v, --verbose\t\t\t\tPrint words not literally found.\n"
+            "  -x, --print-stems\t\t\tIgnored; for compatibility.\n\n"
             "Please use Info to read more (type `info spell').\n", stderr);
       exit (EXIT_SUCCESS);
     }
@@ -625,6 +636,11 @@
     if (dup2 (the_pipe->cerr, STDERR_FILENO) != STDERR_FILENO)
       error (EXIT_FAILURE, errno, "error duping to stderr");
 
+  if (idict != NULL)
+    if (execl (ispell_prog, "ispell", "-a", "-d", idict, NULL)
+       < 0)
+      error (EXIT_FAILURE, errno, "error executing %s", ispell_prog);
+
   if (dictionary != NULL)
     if (execl (ispell_prog, "ispell", "-a", "-p", dictionary, NULL)
        < 0)
diff -Naur spell-1.0/spell.info spell-1.0.fixed/spell.info
--- spell-1.0/spell.info        2005-02-28 15:02:15.000000000 +0100
+++ spell-1.0.fixed/spell.info  2003-12-04 11:54:53.000000000 +0100
@@ -1,4 +1,4 @@
-This is spell.info, produced by makeinfo version 4.2 from ./spell.texi.
+This is spell.info, produced by makeinfo version 4.6 from ./spell.texi.
 
    This file documents GNU Spell, a clone of Unix `spell'.
 
@@ -38,9 +38,9 @@
 Overview
 ********
 
-   GNU Spell is a spell checking program which prints each misspelled
-word on a line of its own.  It is designed as a clone of the standard
-Unix `spell' program, and implemented as a wrapper for Ispell.  Spell
+GNU Spell is a spell checking program which prints each misspelled word
+on a line of its own.  It is designed as a clone of the standard Unix
+`spell' program, and implemented as a wrapper for Ispell.  Spell
 accepts as its arguments a list of files to read from.  Within that
 list, the magical file name `-' causes Spell to read from standard
 input.  In addition, when called with no file name arguments, Spell
@@ -57,7 +57,7 @@
 Invoking Spell
 **************
 
-   The format for running GNU Spell is:
+The format for running GNU Spell is:
 
      spell [OPTION]... [FILE]...
 
@@ -75,7 +75,7 @@
 
 `--dictionary=FILE'
 `-d FILE'
-     Use the named dictionary.
+     Use the named file as a personal dictionary.
 
 `--help'
 `-h'
@@ -95,6 +95,10 @@
      Print the line number of each misspelled word along with the word
      itself.
 
+`--ispell-dictionary=DICTIONARY'
+`-D DICTIONARY'
+     Use the named Ispell dictionary.
+
 `--print-file-name'
 `-o'
      Print the file name which contained the misspelled words on each
@@ -113,14 +117,15 @@
 `-x'
      Ignored; for compatibility.
 
+
 
 File: spell.info,  Node: Example,  Next: Problems,  Prev: Invoking Spell,  Up: 
Top
 
 Example
 *******
 
-   Using GNU Spell is quite simple.  Here's an example, which you can
-try when in the directory of Spell's source code.
+Using GNU Spell is quite simple.  Here's an example, which you can try
+when in the directory of Spell's source code.
 
      $ spell --print-file-name --number sample
      sample:1: Tihs
@@ -149,7 +154,7 @@
 Problems
 ********
 
-   If you find a bug in GNU Spell, or have any questions, comments, or
+If you find a bug in GNU Spell, or have any questions, comments, or
 suggestions about it, please send electronic mail to
 [EMAIL PROTECTED]'.  When sending bug reports, include the
 version number, which you can find by running `spell --version'.  Also
@@ -184,9 +189,9 @@
 Tag Table:
 Node: Top847
 Node: Overview1221
-Node: Invoking Spell2021
-Node: Example3225
-Node: Problems4027
-Node: Concept Index4680
+Node: Invoking Spell2018
+Node: Example3327
+Node: Problems4126
+Node: Concept Index4776
 
 End Tag Table
diff -Naur spell-1.0/spell.texi spell-1.0.fixed/spell.texi
--- spell-1.0/spell.texi        1996-04-10 06:20:14.000000000 +0200
+++ spell-1.0.fixed/spell.texi  2003-12-04 11:37:12.000000000 +0100
@@ -125,7 +125,7 @@
 
 @item [EMAIL PROTECTED]
 @itemx -d @var{file}
-Use the named dictionary.
+Use the named file as a personal dictionary.
 
 @item --help
 @itemx -h
@@ -144,6 +144,10 @@
 Print the line number of each misspelled word along with the word
 itself.
 
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] -D @var{dictionary}
+Use the named Ispell dictionary.
+
 @item --print-file-name
 @itemx -o
 Print the file name which contained the misspelled words on each line


Reply via email to