File: z01_ispell-dctrl.dpatch

package info (click to toggle)
ispell 3.1.20.0-4.4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,684 kB
  • ctags: 966
  • sloc: ansic: 8,374; makefile: 2,023; yacc: 1,711; lisp: 1,613; sh: 1,053; objc: 385; csh: 215; python: 112
file content (119 lines) | stat: -rw-r--r-- 3,918 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
From: Matt Zimmerman <mdz@debian.org>
Subject: Bug#119782: ispell: Debian control file mode
To: Debian Bug Tracking System <submit@bugs.debian.org>
Date: Thu, 15 Nov 2001 22:32:25 -0500
Reply-To: Matt Zimmerman <mdz@debian.org>, 119782@bugs.debian.org
Resent-From: Matt Zimmerman <mdz@debian.org>

I recently undertook a project to spell-check Debian package descriptions,
and along the way I found it useful to teach ispell about the Debian control
file format.  This makes it possible to check the descriptions of Packages,
available, status, debian/control and similar files.

diff -ru orig/ispell-3.1.20/defmt.c ispell-3.1.20/defmt.c
--- orig/ispell-3.1.20/defmt.c	Thu Nov 15 22:26:37 2001
+++ ispell-3.1.20/defmt.c	Thu Nov 15 22:31:21 2001
@@ -170,6 +170,9 @@
 
 static int save_math_mode;
 static char save_LaTeX_Mode;
+static int dctrl_new_line = 1;
+static char dctrl_field_name[128] = "";
+static int dctrl_check_this_field = 0;
 
 static char *skiptag(buf, tagend, taglen)	/* Skip past specific tag */
     char *	buf;
@@ -194,6 +197,36 @@
     char *	bufp;
     {
 
+      if (dctrlflag && dctrl_new_line)
+        {
+          if (dctrl_new_line)
+            {
+              int i;
+              dctrl_new_line = 0;
+              
+              if (!isspace(*bufp)) {
+              
+                for( i = 0 ;
+                     *bufp != ':' && i < sizeof(dctrl_field_name) - 1 ;
+                     ++i, ++bufp )
+                  dctrl_field_name[i] = *bufp;
+              
+                dctrl_field_name[++i] = '\0';
+                ++bufp;
+              
+                if (!strncmp(dctrl_field_name, "Description", 7))
+                  dctrl_check_this_field = 1;
+                else
+                  dctrl_check_this_field = 0;
+
+              }
+              if (!dctrl_check_this_field)
+                /* Skip to next line */
+                while (*bufp++ != '\0')
+                  ;
+            }
+        }
+
     while (*bufp
       &&  ((!isstringch (bufp, 0)  &&  !iswordch (chartoichar (*bufp)))
 	||  isboundarych (chartoichar (*bufp))
@@ -422,6 +455,7 @@
 	    LaTeX_Mode = save_LaTeX_Mode;
 	    TeX_comment = 0;
 	    }
+        dctrl_new_line = 1;
 	}
     return bufp;
     }
diff -ru orig/ispell-3.1.20/ispell.c ispell-3.1.20/ispell.c
--- orig/ispell-3.1.20/ispell.c	Thu Nov 15 22:26:37 2001
+++ ispell-3.1.20/ispell.c	Mon Nov  5 14:53:40 2001
@@ -308,7 +308,7 @@
 	 *	ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789
 	 *	^^^^       ^^^ ^  ^^ ^^
 	 *	abcdefghijklmnopqrstuvwxyz
-	 *	^^^^^^ ^   ^^^ ^  ^^ ^^^
+	 *	^^^^^^^^   ^^^ ^  ^^ ^^^
 	 *
 	 * -h flag used by Gerry Tierney for html-mode
 	 */
@@ -721,6 +721,11 @@
 		else
 		    minword = atoi (*argv + 2);
 		break;
+            case 'g':
+              if (arglen > 2)
+                usage();
+              dctrlflag = 1;
+              break;
 	    default:
 		usage ();
 	    }
diff -ru orig/ispell-3.1.20/ispell.h ispell-3.1.20/ispell.h
--- orig/ispell-3.1.20/ispell.h	Thu Nov 15 22:26:37 2001
+++ ispell-3.1.20/ispell.h	Mon Nov  5 14:50:49 2001
@@ -646,6 +646,7 @@
 INIT (int insidehtml, 0);		/* Flag to indicate that the current html 
 								 *	tag has spanned more than one line */	
 /* End of Gerry's Interference */
+INIT (int dctrlflag, 0);            /* NZ indicates Debian control file mode */
 #ifdef HTSPECIAL		/* decode "&#;" for HTML-ISO characters */
 #ifdef NO8BIT
 #error HTSPECIAL requires NO8BIT to be undefined !

--- ispell.1X~   Mon Nov  5 14:50:56 2001
+++ ispell.1X    Thu Nov 15 22:28:10 2001
@@ -302,6 +302,9 @@
 The input file is in nroff/troff format.
 .IP \fB\-h\fR
 The input file is in html format.  (This works well for XML and SGML format, too.)
+.IP \fB\-g\fR
+The input file is in Debian control file format.  Ispell will ignore
+everything outside the Description(s).
 .IP \fB\-b\fR
 Create a backup file by appending ".bak"
 to the name of the input file.