mirror of
https://git.savannah.gnu.org/git/inetutils.git
synced 2026-01-12 00:19:39 +08:00
Add new tool dnsdomainname.
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
||||
2012-03-12 Simon Josefsson <simon@josefsson.org>
|
||||
|
||||
* NEWS: Mention new dnsdomainname tool.
|
||||
* configure.ac: Add tool dnsdomainname.
|
||||
* doc/inetutils.texi: Document dnsdomainname.
|
||||
* man/Makefile.am: Build dnsdomainname.1.
|
||||
* man/dnsdomainname.h2m: New file.
|
||||
* src/.gitignore: Ignore dnsdomainname.
|
||||
* src/Makefile.am (bin_PROGRAMS): Add $(dnsdomainname_BUILD).
|
||||
(dnsdomainname_SOURCES): New variable.
|
||||
(EXTRA_PROGRAMS): Add dnsdomainname.
|
||||
* src/dnsdomainname.c: New file.
|
||||
* tests/dnsdomainname.sh: New file.
|
||||
|
||||
2012-03-10 Mats Erik Andersson <gnu@gisladisker.se>
|
||||
|
||||
* whois/tld_serv_list (.cz, .fo, .gl, .gs, .hk, .ie, .il, .in, .is)
|
||||
|
||||
3
NEWS
3
NEWS
@@ -4,6 +4,9 @@ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
See the end of this file for license conditions.
|
||||
|
||||
Please send inetutils bug reports to <bug-inetutils@gnu.org>.
|
||||
|
||||
* New tool 'dnsdomainname'.
|
||||
|
||||
|
||||
January 6, 2012
|
||||
Version 1.9.1:
|
||||
|
||||
@@ -104,6 +104,7 @@ IU_ENABLE_SERVER(tftpd)
|
||||
IU_ENABLE_SERVER(uucpd)
|
||||
|
||||
IU_ENABLE_CLIENT(ftp)
|
||||
IU_ENABLE_CLIENT(dnsdomainname)
|
||||
IU_ENABLE_CLIENT(hostname)
|
||||
IU_ENABLE_CLIENT(ping)
|
||||
IU_ENABLE_CLIENT(ping6)
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* ftp: (inetutils)ftp invocation. FTP client.
|
||||
* ftpd: (inetutils)ftpd invocation. FTP Daemon.
|
||||
* hostname: (inetutils)hostname invocation. Show or set system host name.
|
||||
* dnsdomainname: (inetutils)dnsdomainname invocation. Show DNS domain name.
|
||||
* inetd: (inetutils)inetd invocation. Interner super-server.
|
||||
* logger: (inetutils)logger invocation. Send messages to the system log.
|
||||
* ping: (inetutils)ping invocation. Packets to network hosts.
|
||||
@@ -99,6 +100,7 @@ Documentation License''.
|
||||
Diagnostic programs
|
||||
|
||||
* hostname invocation:: Show or set system host name.
|
||||
* dnsdomainname invocation:: Show DNS domain name.
|
||||
* logger invocation:: Send messages to system log.
|
||||
* ping invocation:: Packets to network hosts.
|
||||
* traceroute invocation:: Trace the route to a host.
|
||||
@@ -281,6 +283,19 @@ Get short host name.
|
||||
Get NIS/YP domain name.
|
||||
@end table
|
||||
|
||||
@node dnsdomainname invocation
|
||||
@chapter @command{dnsdomainname}: Show DNS domain name
|
||||
@cindex dnsdomainname
|
||||
|
||||
@command{dnsdomainname} is a program to show the domain part of the
|
||||
system's fully qualified domain name. For example, if the FQDN of the
|
||||
system is @code{name.example.org} the command will show
|
||||
@code{example.org}.
|
||||
|
||||
@example
|
||||
dnsdomainname [@var{option}@dots{}]
|
||||
@end example
|
||||
|
||||
@node logger invocation
|
||||
@chapter @command{logger}: Send messages to system log
|
||||
@cindex logger
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see `http://www.gnu.org/licenses/'.
|
||||
|
||||
all = hostname.1 ifconfig.1 inetd.8 ftp.1 ftpd.8 logger.1 ping.1 \
|
||||
ping6.1 rcp.1 rexec.1 rexecd.8 rlogin.1 rlogind.8 rsh.1 rshd.8 \
|
||||
syslogd.8 talk.1 talkd.8 telnet.1 telnetd.8 tftp.1 tftpd.8 \
|
||||
traceroute.1 uucpd.8 whois.1
|
||||
all = hostname.1 dnsdomainname.1 ifconfig.1 inetd.8 ftp.1 ftpd.8 \
|
||||
logger.1 ping.1 ping6.1 rcp.1 rexec.1 rexecd.8 rlogin.1 \
|
||||
rlogind.8 rsh.1 rshd.8 syslogd.8 talk.1 talkd.8 telnet.1 \
|
||||
telnetd.8 tftp.1 tftpd.8 traceroute.1 uucpd.8 whois.1
|
||||
|
||||
dist_man_MANS =
|
||||
|
||||
@@ -27,6 +27,10 @@ if ENABLE_hostname
|
||||
dist_man_MANS += hostname.1
|
||||
endif
|
||||
|
||||
if ENABLE_dnsdomainname
|
||||
dist_man_MANS += dnsdomainname.1
|
||||
endif
|
||||
|
||||
if ENABLE_ifconfig
|
||||
dist_man_MANS += ifconfig.1
|
||||
endif
|
||||
@@ -133,6 +137,8 @@ ftpd.8: ftpd.h2m $(top_srcdir)/ftpd/ftpd.c $(top_srcdir)/configure.ac
|
||||
|
||||
hostname.1: hostname.h2m $(top_srcdir)/src/hostname.c $(top_srcdir)/configure.ac
|
||||
|
||||
dnsdomainname.1: dnsdomainname.h2m $(top_srcdir)/src/dnsdomainname.c $(top_srcdir)/configure.ac
|
||||
|
||||
ifconfig.1: ifconfig.h2m $(top_srcdir)/ifconfig/options.c $(top_srcdir)/configure.ac
|
||||
|
||||
inetd.8: inetd.h2m $(top_srcdir)/src/inetd.c $(top_srcdir)/configure.ac
|
||||
@@ -186,6 +192,7 @@ whois.1: whois.h2m $(top_srcdir)/whois/whois.c $(top_srcdir)/configure.ac
|
||||
mapped_name = `echo ../$(TOOL)/$(TOOL) \
|
||||
| sed s,../ping6/ping6,../ping/ping6,\
|
||||
| sed s,../hostname/hostname,../src/hostname,\
|
||||
| sed s,../dnsdomainname/dnsdomainname,../src/dnsdomainname,\
|
||||
| sed s,../inetd/inetd,../src/inetd,\
|
||||
| sed s,../logger/logger,../src/logger,\
|
||||
| sed s,../rcp/rcp,../src/rcp,\
|
||||
|
||||
2
man/dnsdomainname.h2m
Normal file
2
man/dnsdomainname.h2m
Normal file
@@ -0,0 +1,2 @@
|
||||
[NAME]
|
||||
dnsdomainname \- show DNS domain name
|
||||
1
src/.gitignore
vendored
1
src/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
dnsdomainname
|
||||
hostname
|
||||
inetd
|
||||
logger
|
||||
|
||||
@@ -32,6 +32,10 @@ bin_PROGRAMS += $(hostname_BUILD)
|
||||
hostname_SOURCES = hostname.c
|
||||
EXTRA_PROGRAMS += hostname
|
||||
|
||||
bin_PROGRAMS += $(dnsdomainname_BUILD)
|
||||
dnsdomainname_SOURCES = dnsdomainname.c
|
||||
EXTRA_PROGRAMS += dnsdomainname
|
||||
|
||||
bin_PROGRAMS += $(logger_BUILD)
|
||||
logger_SOURCES = logger.c logprio.h
|
||||
EXTRA_PROGRAMS += logger
|
||||
|
||||
82
src/dnsdomainname.c
Normal file
82
src/dnsdomainname.c
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Inetutils.
|
||||
|
||||
GNU Inetutils is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at
|
||||
your option) any later version.
|
||||
|
||||
GNU Inetutils is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see `http://www.gnu.org/licenses/'. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <argp.h>
|
||||
#include <error.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "libinetutils.h"
|
||||
#include "progname.h"
|
||||
#include "xgethostname.h"
|
||||
|
||||
const char doc[] =
|
||||
"Show domain part of the system's fully qualified domain name.";
|
||||
const char *program_authors[] = {
|
||||
"Simon Josefsson",
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct argp argp = { NULL, NULL, NULL, doc };
|
||||
|
||||
void
|
||||
dnsdomainname (void)
|
||||
{
|
||||
char *host_name;
|
||||
struct addrinfo hints, *res;
|
||||
const char *dn;
|
||||
int rc;
|
||||
|
||||
host_name = xgethostname ();
|
||||
if (!host_name)
|
||||
error (EXIT_FAILURE, errno, "cannot determine host name");
|
||||
|
||||
memset (&hints, 0, sizeof (struct addrinfo));
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
|
||||
rc = getaddrinfo (host_name, NULL, &hints, &res);
|
||||
if (rc != 0)
|
||||
error (EXIT_FAILURE, 0, "%s", gai_strerror (rc));
|
||||
|
||||
dn = strchr (res->ai_canonname, '.');
|
||||
if (dn == NULL)
|
||||
error (EXIT_FAILURE, 0, "cannot qualify host name: %s", host_name);
|
||||
dn++;
|
||||
|
||||
puts (dn);
|
||||
|
||||
free (host_name);
|
||||
freeaddrinfo (res);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
set_program_name (argv[0]);
|
||||
|
||||
iu_argp_init ("dnsdomainname", program_authors);
|
||||
argp_parse (&argp, argc, argv, 0, NULL, NULL);
|
||||
|
||||
dnsdomainname ();
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
@@ -64,6 +64,10 @@ if ENABLE_hostname
|
||||
dist_check_SCRIPTS += hostname.sh
|
||||
endif
|
||||
|
||||
if ENABLE_dnsdomainname
|
||||
dist_check_SCRIPTS += dnsdomainname.sh
|
||||
endif
|
||||
|
||||
TESTS = $(check_PROGRAMS) $(dist_check_SCRIPTS)
|
||||
|
||||
TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT)
|
||||
|
||||
50
tests/dnsdomainname.sh
Executable file
50
tests/dnsdomainname.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Inetutils.
|
||||
#
|
||||
# GNU Inetutils is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or (at
|
||||
# your option) any later version.
|
||||
#
|
||||
# GNU Inetutils is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see `http://www.gnu.org/licenses/'.
|
||||
|
||||
set -e
|
||||
|
||||
DNSDOMAINNAME=${DNSDOMAINNAME:-../src/dnsdomainname$EXEEXT}
|
||||
|
||||
if ! test -x $DNSDOMAINNAME; then
|
||||
echo "No executable $DNSDOMAINNAME available. Skipping test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
$DNSDOMAINNAME > /dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
echo "invoking $DNSDOMAINNAME failed with error code $rc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$DNSDOMAINNAME --version > /dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
echo "invoking $DNSDOMAINNAME --version failed with error code $rc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$DNSDOMAINNAME --help > /dev/null
|
||||
rc=$?
|
||||
if test $rc -ne 0; then
|
||||
echo "invoking $DNSDOMAINNAME --help failed with error code $rc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user