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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
*** man/man.c.orig Tue May 30 14:02:00 1995
--- man/man.c Sun Dec 8 03:33:04 1996
***************
*** 12,17 ****
--- 12,19 ----
* Department of Chemical Engineering
* The University of Texas at Austin
* Austin, Texas 78712
+ *
+ * (LOCALE enhancement by kumano@strl.nhk.or.jp, 1996)
*/
#define MAN_MAIN
***************
*** 22,27 ****
--- 24,32 ----
#include <string.h>
#include <sys/file.h>
#include <signal.h>
+ #ifdef LOCALE
+ # include <locale.h>
+ #endif
#include "config.h"
#include "gripes.h"
#include "version.h"
***************
*** 112,117 ****
--- 117,126 ----
uid_t egid;
#endif
+ #ifdef LOCALE
+ static char current_locale[20];
+ #endif
+
int
main (argc, argv)
int argc;
***************
*** 129,134 ****
--- 138,148 ----
void do_whatis ();
int man ();
+ #ifdef LOCALE
+ (void)setlocale(LC_CTYPE, "");
+ strcpy(current_locale, setlocale(LC_CTYPE, NULL));
+ #endif
+
prognam = mkprogname (argv[0]);
man_getopt (argc, argv);
***************
*** 261,288 ****
--- 275,345 ----
}
char **
+ #ifdef LOCALE
+ add_dir_to_mpath_list (mp, p, locale)
+ #else
add_dir_to_mpath_list (mp, p)
+ #endif
char **mp;
char *p;
+ #ifdef LOCALE
+ int locale;
+ #endif
{
int status;
+ char *pp;
+
+ #ifdef LOCALE
+ if (locale)
+ {
+ char buf[FILENAME_MAX];
+
+ strcpy (buf, p);
+ strcat (buf, "/");
+ strcat (buf, current_locale);
+
+ pp = buf;
+ }
+ else
+ {
+ pp = p;
+ }
+ status = is_directory (pp);
+ #else
status = is_directory (p);
+ #endif
if (status < 0 && debug)
{
+ #ifdef LOCALE
+ fprintf (stderr, "Warning: couldn't stat file %s!\n", pp);
+ #else
fprintf (stderr, "Warning: couldn't stat file %s!\n", p);
+ #endif
}
else if (status == 0 && debug)
{
+ #ifdef LOCALE
+ fprintf (stderr, "Warning: %s isn't a directory!\n", pp);
+ #else
fprintf (stderr, "Warning: %s isn't a directory!\n", p);
+ #endif
}
else if (status == 1)
{
if (debug)
+ #ifdef LOCALE
+ fprintf (stderr, "adding %s to manpathlist\n", pp);
+ #else
fprintf (stderr, "adding %s to manpathlist\n", p);
+ #endif
+ #ifdef LOCALE
+ *mp++ = strdup (pp);
+ #else
*mp++ = strdup (p);
+ #endif
}
return mp;
}
***************
*** 299,304 ****
--- 356,364 ----
register char *p;
register char *end;
register char **mp;
+ #ifdef LOCALE
+ register int locale;
+ #endif
extern char *optarg;
extern int getopt ();
extern void downcase ();
***************
*** 409,414 ****
--- 469,478 ----
* Expand the manpath into a list for easier handling.
*/
mp = manpathlist;
+ #ifdef LOCALE
+ for (locale = 1; locale >= 0; locale--)
+ {
+ #endif
for (p = manp; ; p = end+1)
{
if ((end = strchr (p, ':')) != NULL)
***************
*** 427,446 ****
--- 491,525 ----
strcat (buf, "/");
strcat (buf, alt_system_name);
+ # ifdef LOCALE
+ mp = add_dir_to_mpath_list (mp, buf, locale);
+ # else
mp = add_dir_to_mpath_list (mp, buf);
+ # endif
}
else
{
+ # ifdef LOCALE
+ mp = add_dir_to_mpath_list (mp, p, locale);
+ # else
mp = add_dir_to_mpath_list (mp, p);
+ # endif
}
#else
+ # ifdef LOCALE
+ mp = add_dir_to_mpath_list (mp, p, locale);
+ # else
mp = add_dir_to_mpath_list (mp, p);
+ # endif
#endif
if (end == NULL)
break;
*end = ':';
}
+ #ifdef LOCALE
+ }
+ #endif
*mp = NULL;
}
*** man/Makefile.orig Wed Dec 4 11:11:09 1996
--- man/Makefile Sun Dec 8 03:26:31 1996
***************
*** 9,14 ****
--- 9,15 ----
.else
LDADD= -L${.CURDIR}/../lib/ -lman
.endif
+ LDADD+= -lxpg4
.if exists(${.CURDIR}/obj)
MAN1= ${.CURDIR}/obj/jman.1
***************
*** 19,24 ****
--- 20,26 ----
DPADD+= ${MAN1}
CFLAGS+= -I${.CURDIR}/../lib -DSTDC_HEADERS -DPOSIX -DHAS_TROFF
CFLAGS+= -DDO_COMPRESS -DALT_SYSTEMS -DSETREUID -DCATMODE=0664
+ CFLAGS+= -DLOCALE
CLEANFILES+= ${MAN1}
${MAN1}: ${.CURDIR}/man.man
|