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
|
$NetBSD: patch-ag,v 1.5 2005/09/28 18:22:11 rillig Exp $
- Don't abuse an int as a pointer (optarg).
- Consistently provide lowercase and MixedCase options.
--- server/setup.c.orig Mon Mar 23 11:48:02 1998
+++ server/setup.c Wed Sep 28 20:06:34 2005
@@ -139,10 +139,13 @@ u_char *src, *dst;
-static u_char *get_str(p, dst)
+static u_char *get_str(p, pv_dst)
u_char *p;
-char **dst;
+void *pv_dst;
{
+ char **dst;
+
+ dst = pv_dst;
if (!*dst) {
*dst = malloc(strlen((char *)p) + 1);
if (!*dst) RcError("no more memory");
@@ -151,21 +154,26 @@ char **dst;
while (*p++) ;
return p;
}
-static u_char *get_int(p, dst)
+static u_char *get_int(p, pv_dst)
u_char *p;
-int *dst;
+void *pv_dst;
{
register char *fmt;
+ int *dst;
+ dst = pv_dst;
fmt = (*p == '0') ? "%o" : "%d";
if (sscanf((char *)p, fmt, dst) != 1) RcError("bad integer");
while (*p++) ;
return p;
}
-static u_char *get_flag(p, dst)
+static u_char *get_flag(p, pv_dst)
u_char *p;
-int *dst;
+void *pv_dst;
{
+ int *dst;
+
+ dst = pv_dst;
if (sscanf((char *)p, "%d", dst) == 1)
;
else if (!cmpstr("on", p))
@@ -219,33 +227,56 @@ StrList **dst;
struct optlist {
char *optname;
u_char *(*optfunc)();
- int optarg;
+ void *optarg;
} option[] = {
- "DebugOut", get_str, (int)&debug_file,
- "DebugLevel", get_int, (int)&debug_level,
- "ForkFlag", get_flag, (int)&fork_flag,
+/*
+ * Add option flag.
+ * Because They are lacked in here. See document.
+ * Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
+ */
+ "DebugOut", get_str, &debug_file,
+ "debugout", get_str, &debug_file,
+ "DebugLevel", get_int, &debug_level,
+ "debuglevel", get_int, &debug_level,
+ "ForkFlag", get_flag, &fork_flag,
+ "forkflag", get_flag, &fork_flag,
- "PortName", get_str, (int)&port_name,
+ "PortName", get_str, &port_name,
+ "portname", get_str, &port_name,
#ifdef TLI
- "PortNumber", get_str, (int)&port_number,
- "ProtoName", get_str, (int)&proto_name,
+ "PortNumber", get_str, &port_number,
+ "portnumber", get_str, &port_number,
+ "ProtoName", get_str, &proto_name,
+ "protoname", get_str, &proto_name,
#else
- "PortNumber", get_int, (int)&port_number,
+ "PortNumber", get_int, &port_number,
+ "portnumber", get_int, &port_number,
#endif
- "SocketName", get_str, (int)&socket_name,
+ "SocketName", get_str, &socket_name,
+ "socketname", get_str, &socket_name,
#ifdef LOCK_FILE
- "LockFile", get_str, (int)&lock_file;
+ "LockFile", get_str, &lock_file;
+ "lockfile", get_str, &lock_file;
#endif
- "maxclient", get_int, (int)&max_client,
- "dictdir", get_str, (int)&dict_dir,
- "readdict", get_list, (int)&read_dict,
- "opendict", get_list, (int)&open_dict,
- "errorout", get_str, (int)&error_file,
- "logout", get_str, (int)&log_file,
- "dirmode", get_int, (int)&dir_mode,
- "filemode", get_int, (int)&file_mode,
- "allowuser", get_list, (int)&allow_user,
+ "MaxClient", get_int, &max_client,
+ "maxclient", get_int, &max_client,
+ "DictDir", get_str, &dict_dir,
+ "dictdir", get_str, &dict_dir,
+ "ReadDict", get_list, &read_dict,
+ "readdict", get_list, &read_dict,
+ "OpenDict", get_list, &open_dict,
+ "opendict", get_list, &open_dict,
+ "ErrorOut", get_str, &error_file,
+ "errorout", get_str, &error_file,
+ "LogOut", get_str, &log_file,
+ "logout", get_str, &log_file,
+ "DirMode", get_int, &dir_mode,
+ "dirmode", get_int, &dir_mode,
+ "FileMode", get_int, &file_mode,
+ "filemode", get_int, &file_mode,
+ "AllowUser", get_list, &allow_user,
+ "allowuser", get_list, &allow_user,
0, 0, 0
};
|