FreeBSD Bugzilla – Attachment 15094 Details for
Bug 28082
[patch] src/usr.bin/whois clean-up
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.22 KB, created by
mike
on 2001-06-11 21:10:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
mike
Created:
2001-06-11 21:10:01 UTC
Size:
3.22 KB
patch
obsolete
>Index: whois/Makefile >=================================================================== >RCS file: /home/ncvs/src/usr.bin/whois/Makefile,v >retrieving revision 1.3 >diff -u -r1.3 Makefile >--- whois/Makefile 1999/11/17 19:11:51 1.3 >+++ whois/Makefile 2001/06/05 05:06:59 >@@ -2,8 +2,8 @@ > # $FreeBSD: src/usr.bin/whois/Makefile,v 1.3 1999/11/17 19:11:51 ache Exp $ > > PROG= whois >+WARNS?= 2 > >-CFLAGS+=-Wall > .if defined(SOCKS) > CFLAGS+=-DSOCKS > CFLAGS+=-Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dlisten=Rlisten \ >Index: whois/whois.c >=================================================================== >RCS file: /home/ncvs/src/usr.bin/whois/whois.c,v >retrieving revision 1.18 >diff -u -r1.18 whois.c >--- whois/whois.c 2001/06/01 13:43:20 1.18 >+++ whois/whois.c 2001/06/05 05:07:00 >@@ -75,17 +75,15 @@ > #define WHOIS_INIC_FALLBACK 0x02 > #define WHOIS_QUICK 0x04 > >-static void usage __P((void)); >-static void whois __P((char *, struct addrinfo *, int)); >+static void usage(void); >+static void whois(char *, struct addrinfo *, int); > > int >-main(argc, argv) >- int argc; >- char **argv; >+main(int argc, char *argv[]) > { > int ch, i, j, error; > int use_qnichost, flags; >- char *host; >+ const char *host; > char *qnichost; > struct addrinfo hints, *res; > >@@ -157,10 +155,6 @@ > } > while (argc--) { > if (use_qnichost) { >- if (qnichost) { >- free(qnichost); >- qnichost = NULL; >- } > for (i = j = 0; (*argv)[i]; i++) { > if ((*argv)[i] == '.') { > j = i; >@@ -168,17 +162,16 @@ > } > if (j != 0) { > if (isdigit(*(*argv + j + 1))) { >- (void) asprintf(&qnichost, "%s", >- ANICHOST); >+ qnichost = strdup(ANICHOST); >+ if (qnichost == NULL) { >+ err(1, "strdup"); >+ } > } else { >- qnichost = (char *) calloc(i - j >- + 1 + strlen(QNICHOST_TAIL), >- sizeof(char)); >- if (!qnichost) { >- err(1, "calloc"); >+ (void)asprintf(&qnichost, "%s%s", >+ *argv + j + 1, QNICHOST_TAIL); >+ if (qnichost == NULL) { >+ err(1, "asprintf"); > } >- strcpy(qnichost, *argv + j + 1); >- strcat(qnichost, QNICHOST_TAIL); > } > > memset(&hints, 0, sizeof(hints)); >@@ -186,10 +179,10 @@ > hints.ai_family = AF_UNSPEC; > hints.ai_socktype = SOCK_STREAM; > error = getaddrinfo(qnichost, "whois", >- &hints, &res); >+ &hints, &res); > if (error != 0) > errx(EX_NOHOST, "%s: %s", qnichost, >- gai_strerror(error)); >+ gai_strerror(error)); > } > } > if (!qnichost) { >@@ -203,6 +196,8 @@ > gai_strerror(error)); > } > >+ free(qnichost); >+ qnichost = NULL; > whois(*argv++, res, flags); > freeaddrinfo(res); > } >@@ -210,10 +205,7 @@ > } > > static void >-whois(name, res, flags) >- char *name; >- struct addrinfo *res; >- int flags; >+whois(char *name, struct addrinfo *res, int flags) > { > FILE *sfi, *sfo; > char *buf, *p, *nhost; >@@ -277,7 +269,10 @@ > /* Do second lookup as needed */ > if (nomatch && !nhost) { > (void)printf("Looking up %s at %s.\n\n", name, INICHOST); >- nhost = INICHOST; >+ nhost = strdup(INICHOST); >+ if (nhost == NULL) { >+ err(1, "strdup"); >+ } > } > if (nhost) { > struct addrinfo hints, *res2; >@@ -301,7 +296,7 @@ > } > > static void >-usage() >+usage(void) > { > (void)fprintf(stderr, > "usage: whois [-adgimpQrR6] [-h hostname] name ...\n");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 28082
: 15094