summaryrefslogtreecommitdiff
path: root/lang/focal/patches/patch-focal3_c
blob: 86118cbee81da10269c08ec3af5703de57f2352a (plain)
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
$NetBSD: patch-focal3_c,v 1.1 2012/05/31 23:37:57 dholland Exp $

- don't use implicit int
- use ctype.h functions correctly
- fix accidental use of bitwise or in logical comparison
- return characters 0..255 from getnb() to avoid incorrect calls to
ctype.h functions elsewhere

--- focal3.c~	1995-04-17 13:03:47.000000000 +0000
+++ focal3.c
@@ -29,9 +29,9 @@ FILE *fp;
  */
 void getlno(lnop, c)
 register struct lno *lnop;
-register c;
+register int c;
 {
-	register gn, ln;
+	register int gn, ln;
 	static char badlno[] = "Bad line or group number";
 
 	if (c < 0)
@@ -42,7 +42,7 @@ register c;
 		return;
 	}
 	if (c=='A' || c=='a') {
-		while (isalpha(*ctp))
+		while (isalpha((unsigned char)*ctp))
 			++ctp;
 		lnop->ln_type = LN_ALL;
 		return;
@@ -64,7 +64,7 @@ register c;
 		lnop->ln_type = LN_GRP;
 		return;
 	}
-	if (ln<1 | ln>99)
+	if (ln<1 || ln>99)
 		diag(badlno);
 	lnop->ln_gno = gn;
 	lnop->ln_lno = ln;
@@ -78,9 +78,9 @@ register c;
  * Return the number read.
  */
 int getnum(c)
-register c;
+register int c;
 {
-	register n;
+	register int n;
 
 	n = 0;
 	while (isdigit(c)) {
@@ -152,11 +152,11 @@ char *s;
  */
 int getnb()
 {
-	register c;
+	register int c;
 
 	while ((c = *ctp++)==' ' || c=='\t')
 		;
-	return (c);
+	return ((int)(unsigned char)c);
 }
 /*
  * drand48