summaryrefslogtreecommitdiff
path: root/lang/focal/patches/patch-focal2_c
blob: 18cb3308a544cf7337ef3abc089797b02ac7c999 (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
$NetBSD: patch-focal2_c,v 1.1 2012/05/31 23:42:01 dholland Exp $

- use ctype.h functions correctly
- avoid symbol name conflict with getline()
- the name in struct dirent is null-terminated, don't try to bound it

--- focal2.c.orig	1995-04-17 13:03:46.000000000 +0000
+++ focal2.c
@@ -49,7 +49,7 @@ void library()
 	c = getnb();
 	if (c!='c' && c!='s' && c!='l' && c!='d')
 		diag("Bad library command");
-	while (isalpha(*ctp))
+	while (isalpha((unsigned char)*ctp))
 		++ctp;
 	while ((d = *ctp)==' ' || d=='\t')
 		++ctp;
@@ -71,7 +71,7 @@ void library()
 		}
 		line = NULL;
 		sctp = ctp;
-		while (getline(abuf, fp) != 0) {
+		while (get_line(abuf, fp) != 0) {
 			ctp = abuf;
 			if ((c=getnb()) != 0) {
 				if (isdigit(c) == 0)
@@ -138,7 +138,7 @@ void library()
 			    ||  strcmp(de->d_name, ".") == 0
 			    ||  strcmp(de->d_name, "..") == 0)
 				continue;
-			printf("%.*s\n", de->d_reclen, de->d_name);
+			printf("%s\n", de->d_name);
 		}
 		closedir(dp);
 #else