/etc/netstart -> /etc/rc.network
Add usage() and use __progname. Change usage string to match man page.
This commit is contained in:
parent
0e6f6af18d
commit
e2b60e721d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26402
@ -30,7 +30,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" From: @(#)hostname.1 8.1 (Berkeley) 5/31/93
|
.\" From: @(#)hostname.1 8.1 (Berkeley) 5/31/93
|
||||||
.\" $Id$
|
.\" $Id: domainname.1,v 1.4 1997/02/22 14:03:00 peter Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd September 18, 1994
|
.Dd September 18, 1994
|
||||||
.Dt DOMAINNAME 1
|
.Dt DOMAINNAME 1
|
||||||
@ -46,7 +46,7 @@
|
|||||||
prints the name of the current YP/NIS domain. The super-user can
|
prints the name of the current YP/NIS domain. The super-user can
|
||||||
set the domain name by supplying an argument; this is usually done in the
|
set the domain name by supplying an argument; this is usually done in the
|
||||||
network initialization script
|
network initialization script
|
||||||
.Pa /etc/netstart ,
|
.Pa /etc/rc.network ,
|
||||||
normally run at boot
|
normally run at boot
|
||||||
time.
|
time.
|
||||||
.Sh NOTA BENE
|
.Sh NOTA BENE
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: domainname.c,v 1.8 1997/02/22 14:03:01 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
@ -51,14 +51,28 @@ static char const sccsid[] = "From: @(#)hostname.c 8.1 (Berkeley) 5/31/93";
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern char *__progname;
|
||||||
|
|
||||||
|
void usage __P((void));
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc,argv)
|
main(argc,argv)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
{
|
{
|
||||||
|
int ch;
|
||||||
char domainname[MAXHOSTNAMELEN];
|
char domainname[MAXHOSTNAMELEN];
|
||||||
|
|
||||||
argc--, argv++;
|
while ((ch = getopt(argc, argv, "")) != -1)
|
||||||
|
switch (ch) {
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
|
||||||
|
if (argc > 1)
|
||||||
|
usage();
|
||||||
|
|
||||||
if (*argv) {
|
if (*argv) {
|
||||||
if (setdomainname(*argv, strlen(*argv)))
|
if (setdomainname(*argv, strlen(*argv)))
|
||||||
@ -70,3 +84,10 @@ main(argc,argv)
|
|||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
(void)fprintf(stderr, "usage: %s [ypdomain]\n", __progname);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user