WARNSify, fix .Nm usage, getopt returns -1 not EOF
This commit is contained in:
parent
0471adfdaa
commit
d175d28880
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: touch.1,v 1.11 1997/10/17 08:11:56 enami Exp $
|
||||
.\" $NetBSD: touch.1,v 1.12 1997/10/20 00:49:53 lukem Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -43,14 +43,14 @@
|
||||
.Nm touch
|
||||
.Nd change file access and modification times
|
||||
.Sh SYNOPSIS
|
||||
.Nm touch
|
||||
.Nm
|
||||
.Op Fl acfhm
|
||||
.Op Fl r Ar file
|
||||
.Op Fl t Ar [[CC]YY]MMDDhhmm[.SS]
|
||||
.Ar file ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm touch
|
||||
.Nm
|
||||
utility sets the modification and access times of files to the
|
||||
current time of day.
|
||||
If the file doesn't exist, it is created with default permissions.
|
||||
@ -65,7 +65,7 @@ flag is also specified.
|
||||
.It Fl c
|
||||
Do not create the file if it does not exist.
|
||||
The
|
||||
.Nm touch
|
||||
.Nm
|
||||
utility does not treat this as an error.
|
||||
No error messages are displayed and the exit value is not affected.
|
||||
.It Fl f
|
||||
@ -132,13 +132,13 @@ letter pair is not specified, the value defaults to 0.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Nm touch
|
||||
.Nm
|
||||
utility exits 0 on success, and >0 if an error occurs.
|
||||
.Sh SEE ALSO
|
||||
.Xr utimes 2
|
||||
.Sh COMPATIBILITY
|
||||
The obsolescent form of
|
||||
.Nm touch ,
|
||||
.Nm "" ,
|
||||
where a time format is specified as the first argument, is supported.
|
||||
When no
|
||||
.Fl r
|
||||
@ -164,13 +164,13 @@ letter pair is in the range 69 to 99, the year is set to 1969 to 1999,
|
||||
otherwise, the year is set in the 21st century.
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm touch
|
||||
.Nm
|
||||
utility is expected to be a superset of the
|
||||
.St -p1003.2
|
||||
specification.
|
||||
.Sh HISTORY
|
||||
A
|
||||
.Nm touch
|
||||
.Nm
|
||||
utility appeared in
|
||||
.At v7 .
|
||||
.Sh BUGS
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: touch.c,v 1.14 1997/10/19 14:38:04 mycroft Exp $ */
|
||||
/* $NetBSD: touch.c,v 1.15 1997/10/20 00:49:54 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993
|
||||
@ -33,17 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
__COPYRIGHT("@(#) Copyright (c) 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)touch.c 8.2 (Berkeley) 4/28/95";
|
||||
#endif
|
||||
static char rcsid[] = "$NetBSD: touch.c,v 1.14 1997/10/19 14:38:04 mycroft Exp $";
|
||||
__RCSID("$NetBSD: touch.c,v 1.15 1997/10/20 00:49:54 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -60,6 +60,7 @@ static char rcsid[] = "$NetBSD: touch.c,v 1.14 1997/10/19 14:38:04 mycroft Exp $
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main __P((int, char **));
|
||||
int rw __P((char *, struct stat *, int));
|
||||
void stime_arg1 __P((char *, struct timeval *));
|
||||
void stime_arg2 __P((char *, int, struct timeval *));
|
||||
@ -84,7 +85,7 @@ main(argc, argv)
|
||||
if (gettimeofday(&tv[0], NULL))
|
||||
err(1, "gettimeofday");
|
||||
|
||||
while ((ch = getopt(argc, argv, "acfhmr:t:")) != EOF)
|
||||
while ((ch = getopt(argc, argv, "acfhmr:t:")) != -1)
|
||||
switch(ch) {
|
||||
case 'a':
|
||||
aflag = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user