whois.c (1591) | whois.c (15359) |
---|---|
1/* 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 49 unchanged lines hidden (view full) --- 58 register FILE *sfi, *sfo; 59 register int ch; 60 struct sockaddr_in sin; 61 struct hostent *hp; 62 struct servent *sp; 63 int s; 64 char *host; 65 | 1/* 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 49 unchanged lines hidden (view full) --- 58 register FILE *sfi, *sfo; 59 register int ch; 60 struct sockaddr_in sin; 61 struct hostent *hp; 62 struct servent *sp; 63 int s; 64 char *host; 65 |
66#ifdef SOCKS 67 SOCKSinit(argv[0]); 68#endif 69 |
|
66 host = NICHOST; 67 while ((ch = getopt(argc, argv, "h:")) != EOF) 68 switch((char)ch) { 69 case 'h': 70 host = optarg; 71 break; 72 case '?': 73 default: --- 14 unchanged lines hidden (view full) --- 88 host = hp->h_name; 89 s = socket(hp->h_addrtype, SOCK_STREAM, 0); 90 if (s < 0) { 91 perror("whois: socket"); 92 exit(1); 93 } 94 bzero((caddr_t)&sin, sizeof (sin)); 95 sin.sin_family = hp->h_addrtype; | 70 host = NICHOST; 71 while ((ch = getopt(argc, argv, "h:")) != EOF) 72 switch((char)ch) { 73 case 'h': 74 host = optarg; 75 break; 76 case '?': 77 default: --- 14 unchanged lines hidden (view full) --- 92 host = hp->h_name; 93 s = socket(hp->h_addrtype, SOCK_STREAM, 0); 94 if (s < 0) { 95 perror("whois: socket"); 96 exit(1); 97 } 98 bzero((caddr_t)&sin, sizeof (sin)); 99 sin.sin_family = hp->h_addrtype; |
96 if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { 97 perror("whois: bind"); 98 exit(1); 99 } | |
100 bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); 101 sp = getservbyname("whois", "tcp"); 102 if (sp == NULL) { 103 (void)fprintf(stderr, "whois: whois/tcp: unknown service\n"); 104 exit(1); 105 } 106 sin.sin_port = sp->s_port; 107 if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { --- 24 unchanged lines hidden --- | 100 bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); 101 sp = getservbyname("whois", "tcp"); 102 if (sp == NULL) { 103 (void)fprintf(stderr, "whois: whois/tcp: unknown service\n"); 104 exit(1); 105 } 106 sin.sin_port = sp->s_port; 107 if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { --- 24 unchanged lines hidden --- |