summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1995-05-02 01:27:45 +0000
committerTheodore Tso <tytso@mit.edu>1995-05-02 01:27:45 +0000
commit258d64ceda6411d8c9fd623359816d2f7cadbd52 (patch)
treea51984a047de231559a08f40026c610827041040 /src/tests
parentc7efcd53fa9aefb83d09dbb76c323e6a8d59f074 (diff)
downloadkrb5-258d64ceda6411d8c9fd623359816d2f7cadbd52.tar.gz
krb5-258d64ceda6411d8c9fd623359816d2f7cadbd52.tar.xz
krb5-258d64ceda6411d8c9fd623359816d2f7cadbd52.zip
Add --quiet option which only prints the fully qualified domain name.
This will allow this routine to be used in the deja gnu tests to determine the FQDN of the local host. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5679 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/resolve/ChangeLog7
-rw-r--r--src/tests/resolve/resolve.c32
2 files changed, 32 insertions, 7 deletions
diff --git a/src/tests/resolve/ChangeLog b/src/tests/resolve/ChangeLog
index 425562260..30893bd8e 100644
--- a/src/tests/resolve/ChangeLog
+++ b/src/tests/resolve/ChangeLog
@@ -1,3 +1,10 @@
+Mon May 1 20:00:18 1995 Theodore Y. Ts'o (tytso@dcl)
+
+ * resolve.c (main): Add --quiet option which only prints the fully
+ qualified domain name. This will allow this routine to be
+ used in the deja gnu tests to determine the FQDN of the
+ local host.
+
Tue Apr 25 22:16:38 1995 Mark Eichin <eichin@cygnus.com>
* resolve.c (main): copy the address sent back by gethostbyname
diff --git a/src/tests/resolve/resolve.c b/src/tests/resolve/resolve.c
index 71a7bc44f..af292e051 100644
--- a/src/tests/resolve/resolve.c
+++ b/src/tests/resolve/resolve.c
@@ -68,10 +68,21 @@ main(argc, argv)
char *ptr;
char addrcopy[4];
struct hostent *host;
+ int quiet = 0;
int err;
- if(argc > 1) {
- strncpy(myname, argv[1], MAXHOSTNAMELEN);
+ argc--; argv++;
+ while (argc) {
+ if ((strcmp(*argv, "--quiet") == 0) ||
+ (strcmp(*argv, "-q") == 0)) {
+ quiet++;
+ } else
+ break;
+ argc--; argv++;
+ }
+
+ if (argc > 1) {
+ strncpy(myname, *argv, MAXHOSTNAMELEN);
} else {
if(gethostname(myname, MAXHOSTNAMELEN)) {
perror("gethostname failure");
@@ -82,7 +93,8 @@ main(argc, argv)
myname[MAXHOSTNAMELEN] = '\0'; /* for safety */
/* Look up the address... */
- printf("Hostname: %s\n", myname);
+ if (!quiet)
+ printf("Hostname: %s\n", myname);
/* Set the hosts db to close each time - effectively rewinding file */
@@ -95,8 +107,9 @@ main(argc, argv)
ptr = host->h_addr_list[0];
#define UC(a) (((int)a)&0xff)
- printf("Host address: %d.%d.%d.%d\n",
- UC(ptr[0]), UC(ptr[1]), UC(ptr[2]), UC(ptr[3]));
+ if (!quiet)
+ printf("Host address: %d.%d.%d.%d\n",
+ UC(ptr[0]), UC(ptr[1]), UC(ptr[2]), UC(ptr[3]));
memcpy(addrcopy, ptr, 4);
@@ -106,14 +119,19 @@ main(argc, argv)
exit(2);
}
- printf("FQDN: %s\n", host->h_name);
+ if (quiet)
+ printf("%s\n", host->h_name);
+ else
+ printf("FQDN: %s\n", host->h_name);
if(strchr(host->h_name, '.') == NULL) {
fprintf(stderr, "\nResolve library did not return a fully qualified domain name\n");
fprintf(stderr, "You may have to reconfigure the kerberos distribution to select a\ndifferent set of libraries using --with-netlib[=libs]\n");
exit(3);
}
- printf("Resolve library appears to have passed the test\n");
+
+ if (!quiet)
+ printf("Resolve library appears to have passed the test\n");
/* All ok */
exit(0);