whois.c (202280) | whois.c (202281) |
---|---|
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 --- 30 unchanged lines hidden (view full) --- 39 40#if 0 41#ifndef lint 42static char sccsid[] = "@(#)whois.c 8.1 (Berkeley) 6/6/93"; 43#endif /* not lint */ 44#endif 45 46#include <sys/cdefs.h> | 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 --- 30 unchanged lines hidden (view full) --- 39 40#if 0 41#ifndef lint 42static char sccsid[] = "@(#)whois.c 8.1 (Berkeley) 6/6/93"; 43#endif /* not lint */ 44#endif 45 46#include <sys/cdefs.h> |
47__FBSDID("$FreeBSD: head/usr.bin/whois/whois.c 202280 2010-01-14 10:40:54Z edwin $"); | 47__FBSDID("$FreeBSD: head/usr.bin/whois/whois.c 202281 2010-01-14 10:56:54Z edwin $"); |
48 49#include <sys/types.h> 50#include <sys/socket.h> 51#include <netinet/in.h> 52#include <arpa/inet.h> 53#include <ctype.h> 54#include <err.h> 55#include <netdb.h> --- 154 unchanged lines hidden (view full) --- 210 * be queried, or a NULL if the correct server couldn't be determined. The 211 * caller must remember to free(3) the allocated memory. 212 */ 213static char * 214choose_server(char *domain) 215{ 216 char *pos, *retval; 217 | 48 49#include <sys/types.h> 50#include <sys/socket.h> 51#include <netinet/in.h> 52#include <arpa/inet.h> 53#include <ctype.h> 54#include <err.h> 55#include <netdb.h> --- 154 unchanged lines hidden (view full) --- 210 * be queried, or a NULL if the correct server couldn't be determined. The 211 * caller must remember to free(3) the allocated memory. 212 */ 213static char * 214choose_server(char *domain) 215{ 216 char *pos, *retval; 217 |
218 if (strchr(domain, ':')) { 219 s_asprintf(&retval, "%s", ANICHOST); 220 return (retval); 221 } |
|
218 for (pos = strchr(domain, '\0'); pos > domain && *--pos == '.';) 219 *pos = '\0'; 220 if (*domain == '\0') 221 errx(EX_USAGE, "can't search for a null string"); 222 if (strlen(domain) > sizeof("-NORID")-1 && 223 strcasecmp(domain + strlen(domain) - sizeof("-NORID") + 1, 224 "-NORID") == 0) { 225 s_asprintf(&retval, "%s", NORIDHOST); --- 141 unchanged lines hidden --- | 222 for (pos = strchr(domain, '\0'); pos > domain && *--pos == '.';) 223 *pos = '\0'; 224 if (*domain == '\0') 225 errx(EX_USAGE, "can't search for a null string"); 226 if (strlen(domain) > sizeof("-NORID")-1 && 227 strcasecmp(domain + strlen(domain) - sizeof("-NORID") + 1, 228 "-NORID") == 0) { 229 s_asprintf(&retval, "%s", NORIDHOST); --- 141 unchanged lines hidden --- |