3 --- connserv.c.orig Tue Jul 7 00:31:16 1998
4 +++ connserv.c Fri Dec 24 00:25:24 1999
8 struct protoent *proto;
11 +#ifdef SKK_CONF /* use skk.conf */
15 + char *confhost = NULL;
18 + if ((conffp = fopen(SKK_CONF, "r")) != NULL) {
21 + while (fgets(line, sizeof line, conffp) != NULL) {
22 + if ((p = strchr(line, '#')) != NULL)
24 + if ((p = strtok(line, ": \t\n")) == NULL)
26 + if ((data = strtok((char *) NULL, " \t\n")) == NULL)
28 + if (!strcmp(p, "skkserv_host")) {
29 + strcpy(hostbuf, data);
31 + } else if (!strcmp(p, "skkserv_port")) {
32 + confport = atoi(data);
38 serv = getservbyname(SKK_SERVICENAME,"tcp");
39 fillzero((char*)&hostaddr,sizeof(struct sockaddr_in));
42 hostname = SKKServerHost;
43 else if ((hostname = getenv("SKKSERVER")) == NULL) {
45 + if ((hostname = confhost) == NULL)
47 #ifdef SKK_SERVER_HOST
48 hostname = SKK_SERVER_HOST;
53 - if ('0' <= *hostname && *hostname <= '9') {
54 - if (sscanf(hostname,"%d.%d.%d.%d",&a1,&a2,&a3,&a4) != 4) {
57 - a1 = (a1<<24)|(a2<<16)|(a3<<8)|a4;
58 - hostaddr.sin_addr.s_addr = htonl(a1);
61 + if ((hostaddr.sin_addr.s_addr = inet_addr(hostname)) == INADDR_NONE) {
62 if ((entry = gethostbyname(hostname)) == NULL) {
65 bincopy(entry->h_addr, &hostaddr.sin_addr, entry->h_length);
67 hostaddr.sin_family = AF_INET;
68 - hostaddr.sin_port = serv ? serv->s_port : htons(SKK_PORT_NUMBER);
71 + confport ? htons(confport) :
73 + serv ? serv->s_port : htons(SKK_PORT_NUMBER);
74 if (connect(sock,(struct sockaddr *)&hostaddr,sizeof(struct sockaddr_in)) < 0) {