mirror of
https://github.com/rfc1036/whois.git
synced 2026-05-03 06:51:09 +00:00
Support hiding disclaimers until the end of the output
This commit is contained in:
parent
b1299db453
commit
1e1cb543c2
13
whois.c
13
whois.c
@ -614,12 +614,17 @@ int hide_line(int *hiding, const char *const line)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (*hiding == HIDE_DISABLED) {
|
if (*hiding == HIDE_TO_THE_END) {
|
||||||
|
return 1;
|
||||||
|
} else if (*hiding == HIDE_DISABLED) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (*hiding == HIDE_NOT_STARTED) { /* looking for smtng to hide */
|
} else if (*hiding == HIDE_NOT_STARTED) { /* looking for smtng to hide */
|
||||||
for (i = 0; hide_strings[i] != NULL; i += 2) {
|
for (i = 0; hide_strings[i] != NULL; i += 2) {
|
||||||
if (strneq(line, hide_strings[i], strlen(hide_strings[i]))) {
|
if (strneq(line, hide_strings[i], strlen(hide_strings[i]))) {
|
||||||
*hiding = i; /* start hiding */
|
if (hide_strings[i + 1] == NULL)
|
||||||
|
*hiding = HIDE_TO_THE_END; /* all the remaining output */
|
||||||
|
else
|
||||||
|
*hiding = i; /* start hiding */
|
||||||
return 1; /* and hide this line */
|
return 1; /* and hide this line */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -699,7 +704,7 @@ char *do_query(const int sock, const char *query)
|
|||||||
err_sys("fgets");
|
err_sys("fgets");
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
|
|
||||||
if (hide > HIDE_NOT_STARTED)
|
if (hide > HIDE_NOT_STARTED && hide != HIDE_TO_THE_END)
|
||||||
err_quit(_("Catastrophic error: disclaimer text has been changed.\n"
|
err_quit(_("Catastrophic error: disclaimer text has been changed.\n"
|
||||||
"Please upgrade this program.\n"));
|
"Please upgrade this program.\n"));
|
||||||
|
|
||||||
@ -797,7 +802,7 @@ char *query_afilias(const int sock, const char *query)
|
|||||||
err_sys("fgets");
|
err_sys("fgets");
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
|
|
||||||
if (hide > HIDE_NOT_STARTED)
|
if (hide > HIDE_NOT_STARTED && hide != HIDE_TO_THE_END)
|
||||||
err_quit(_("Catastrophic error: disclaimer text has been changed.\n"
|
err_quit(_("Catastrophic error: disclaimer text has been changed.\n"
|
||||||
"Please upgrade this program.\n"));
|
"Please upgrade this program.\n"));
|
||||||
|
|
||||||
|
|||||||
3
whois.h
3
whois.h
@ -5,7 +5,8 @@
|
|||||||
/* Do *NOT* change it if you don't know what you are doing! */
|
/* Do *NOT* change it if you don't know what you are doing! */
|
||||||
#define IDSTRING "Md5.1"
|
#define IDSTRING "Md5.1"
|
||||||
|
|
||||||
#define HIDE_DISABLED -2
|
#define HIDE_TO_THE_END -3
|
||||||
|
#define HIDE_DISABLED -2
|
||||||
#define HIDE_NOT_STARTED -1
|
#define HIDE_NOT_STARTED -1
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user