Control: tags 969113 + patch

Hi there!

The main difference between the upstream and Debian versions is the
"-ispell-dictionary, -D" option. The attached patch implements this
option in the upstream release (1.1).


Best Regards,
mt
Description: Add option "--ispell-dictionary, -D" to spell
Author: Kaare Hviid <u...@id.cbs.dk>
Author: Marcos Talau <ta...@debian.org>
Forwarded: no
Last-Update: 2023-01-08

Index: spell/spell.c
===================================================================
--- spell.orig/spell.c
+++ spell/spell.c
@@ -110,6 +110,7 @@ const struct option long_options[] =
   {"dictionary", required_argument, NULL, 'd'},
   {"help", no_argument, NULL, 'h'},
   {"ispell", required_argument, NULL, 'i'},
+  {"ispell-dictionary", required_argument, NULL, 'D'},
   {"ispell-version", no_argument, NULL, 'I'},
   {"number", no_argument, NULL, 'n'},
   {"print-file-name", no_argument, NULL, 'o'},
@@ -129,6 +130,9 @@ char *ispell_prog = NULL;
 /* Dictionary to use.  Just use the default if NULL.  */
 char *dictionary = NULL;
 
+/* Ispell dictionary to use (--ispell-dictionary, -D). */
+char *ispell_dict = NULL;
+
 /* Display Ispell's version (--ispell-version, -I). */
 int show_ispell_version = 0;
 
@@ -167,8 +171,8 @@ main (int argc, char **argv)
   /* Option processing loop.  */
   while (1)
     {
-      opt = getopt_long (argc, argv, "IVbdhilnosvx", long_options,
-                        (int *) 0);
+      opt = getopt_long (argc, argv, "IVbd:D:hi:lnos:vx", long_options,
+                        (int *) 0);
 
       if (opt == EOF)
        break;
@@ -190,6 +194,12 @@ main (int argc, char **argv)
          else
            error (0, 0, "option argument not given");
          break;
+       case 'D':
+         if (optarg != NULL)
+           ispell_dict = xstrdup (optarg);
+         else
+           error (0, 0, "option argument not given");
+         break;
        case 'h':
          show_help = 1;
          break;
@@ -245,6 +255,7 @@ main (int argc, char **argv)
             "  -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"
+             "  -D, --ispell-dictionary=DICT\tUse DICTIONARY 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"
@@ -649,6 +660,12 @@ run_ispell_in_child (pipe_t * the_pipe)
           execlp ("aspell", "aspell", "-a", "-p", dictionary, NULL) < 0)
        error (EXIT_FAILURE, errno, "error executing ispell/aspell");
 
+  if (ispell_dict != NULL)
+    if (execlp (ispell_prog, "ispell", "-a", "-d", ispell_dict, NULL) < 0)
+      if (errno != ENOENT  ||
+          execlp ("aspell", "aspell", "-a", "-d", ispell_dict, NULL) < 0)
+       error (EXIT_FAILURE, errno, "error executing ispell/aspell");
+
   if (british)
     if (execlp (ispell_prog, "ispell", "-a", "-d", "british", NULL) < 0)
       if (errno != ENOENT  ||
Index: spell/spell.texi
===================================================================
--- spell.orig/spell.texi
+++ spell/spell.texi
@@ -113,6 +113,10 @@ this dictionary was installed with Ispel
 @itemx -d @var{file}
 Use the named dictionary.
 
+@item --ispell-dictionary=@var{dictionary}
+@itemx -D @var{dictionary}
+Use the named Ispell dictionary.
+
 @item --help
 @itemx -h
 Print an informative help message describing the options and then exit.

Attachment: signature.asc
Description: PGP signature

Reply via email to