1994-05-27 12:33:43 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2001-12-11 23:38:24 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
#ifndef lint
|
2001-05-26 22:39:33 +00:00
|
|
|
static const char copyright[] =
|
1994-05-27 12:33:43 +00:00
|
|
|
"@(#) Copyright (c) 1993\n\
|
|
|
|
The Regents of the University of California. All rights reserved.\n";
|
2001-12-11 23:38:24 +00:00
|
|
|
#endif
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
#ifndef lint
|
2001-05-26 22:39:33 +00:00
|
|
|
static const char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93";
|
|
|
|
#endif
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
2012-06-10 14:26:51 +00:00
|
|
|
#include <ctype.h>
|
1994-05-27 12:33:43 +00:00
|
|
|
#include <err.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
2007-04-10 07:22:30 +00:00
|
|
|
#include <libgen.h>
|
1994-05-27 12:33:43 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2015-01-24 13:50:13 +00:00
|
|
|
static void stime_arg1(const char *, struct timespec *);
|
|
|
|
static void stime_arg2(const char *, int, struct timespec *);
|
|
|
|
static void stime_darg(const char *, struct timespec *);
|
|
|
|
static void stime_file(const char *, struct timespec *);
|
2013-04-23 13:03:14 +00:00
|
|
|
static int timeoffset(const char *);
|
2013-04-23 13:03:17 +00:00
|
|
|
static void usage(const char *);
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
int
|
2002-09-04 23:29:10 +00:00
|
|
|
main(int argc, char *argv[])
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
struct stat sb;
|
2015-01-24 13:50:13 +00:00
|
|
|
struct timespec ts[2];
|
|
|
|
int atflag;
|
2012-02-04 13:37:31 +00:00
|
|
|
int Aflag, aflag, cflag, mflag, ch, fd, len, rval, timeset;
|
1994-05-27 12:33:43 +00:00
|
|
|
char *p;
|
2007-04-09 02:19:37 +00:00
|
|
|
char *myname;
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2007-04-10 07:22:30 +00:00
|
|
|
myname = basename(argv[0]);
|
2012-02-04 13:37:31 +00:00
|
|
|
Aflag = aflag = cflag = mflag = timeset = 0;
|
2015-01-24 13:50:13 +00:00
|
|
|
atflag = 0;
|
2015-02-15 21:28:00 +00:00
|
|
|
ts[0].tv_sec = ts[1].tv_sec = 0;
|
|
|
|
ts[0].tv_nsec = ts[1].tv_nsec = UTIME_NOW;
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2012-06-10 14:26:51 +00:00
|
|
|
while ((ch = getopt(argc, argv, "A:acd:fhmr:t:")) != -1)
|
1994-05-27 12:33:43 +00:00
|
|
|
switch(ch) {
|
2007-04-09 02:19:37 +00:00
|
|
|
case 'A':
|
|
|
|
Aflag = timeoffset(optarg);
|
|
|
|
break;
|
1994-05-27 12:33:43 +00:00
|
|
|
case 'a':
|
|
|
|
aflag = 1;
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
cflag = 1;
|
|
|
|
break;
|
2012-06-10 14:26:51 +00:00
|
|
|
case 'd':
|
|
|
|
timeset = 1;
|
2015-01-24 13:50:13 +00:00
|
|
|
stime_darg(optarg, ts);
|
2012-06-10 14:26:51 +00:00
|
|
|
break;
|
1994-05-27 12:33:43 +00:00
|
|
|
case 'f':
|
2012-02-04 13:37:31 +00:00
|
|
|
/* No-op for compatibility. */
|
1994-05-27 12:33:43 +00:00
|
|
|
break;
|
2001-09-22 18:45:03 +00:00
|
|
|
case 'h':
|
|
|
|
cflag = 1;
|
2015-01-24 13:50:13 +00:00
|
|
|
atflag = AT_SYMLINK_NOFOLLOW;
|
2001-09-22 18:45:03 +00:00
|
|
|
break;
|
1994-05-27 12:33:43 +00:00
|
|
|
case 'm':
|
|
|
|
mflag = 1;
|
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
timeset = 1;
|
2015-01-24 13:50:13 +00:00
|
|
|
stime_file(optarg, ts);
|
1994-05-27 12:33:43 +00:00
|
|
|
break;
|
|
|
|
case 't':
|
|
|
|
timeset = 1;
|
2015-01-24 13:50:13 +00:00
|
|
|
stime_arg1(optarg, ts);
|
1994-05-27 12:33:43 +00:00
|
|
|
break;
|
|
|
|
default:
|
2007-04-09 02:19:37 +00:00
|
|
|
usage(myname);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
argc -= optind;
|
|
|
|
argv += optind;
|
|
|
|
|
2007-04-10 07:22:30 +00:00
|
|
|
if (aflag == 0 && mflag == 0)
|
1994-05-27 12:33:43 +00:00
|
|
|
aflag = mflag = 1;
|
|
|
|
|
2007-04-10 07:22:30 +00:00
|
|
|
if (timeset) {
|
|
|
|
if (Aflag) {
|
|
|
|
/*
|
|
|
|
* We're setting the time to an offset from a specified
|
|
|
|
* time. God knows why, but it means that we can set
|
|
|
|
* that time once and for all here.
|
|
|
|
*/
|
|
|
|
if (aflag)
|
2015-01-24 13:50:13 +00:00
|
|
|
ts[0].tv_sec += Aflag;
|
2007-04-10 07:22:30 +00:00
|
|
|
if (mflag)
|
2015-01-24 13:50:13 +00:00
|
|
|
ts[1].tv_sec += Aflag;
|
2007-04-10 07:22:30 +00:00
|
|
|
Aflag = 0; /* done our job */
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
2007-04-10 07:22:30 +00:00
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* If no -r or -t flag, at least two operands, the first of
|
|
|
|
* which is an 8 or 10 digit number, use the obsolete time
|
|
|
|
* specification, otherwise use the current time.
|
|
|
|
*/
|
|
|
|
if (argc > 1) {
|
|
|
|
strtol(argv[0], &p, 10);
|
|
|
|
len = p - argv[0];
|
|
|
|
if (*p == '\0' && (len == 8 || len == 10)) {
|
|
|
|
timeset = 1;
|
2015-01-24 13:50:13 +00:00
|
|
|
stime_arg2(*argv++, len == 10, ts);
|
2007-04-10 07:22:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Both times default to the same. */
|
2015-01-24 13:50:13 +00:00
|
|
|
ts[1] = ts[0];
|
2007-04-10 07:22:30 +00:00
|
|
|
}
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2015-02-15 21:28:00 +00:00
|
|
|
if (!aflag)
|
|
|
|
ts[0].tv_nsec = UTIME_OMIT;
|
|
|
|
if (!mflag)
|
|
|
|
ts[1].tv_nsec = UTIME_OMIT;
|
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
if (*argv == NULL)
|
2007-04-09 02:19:37 +00:00
|
|
|
usage(myname);
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2007-04-10 07:22:30 +00:00
|
|
|
if (Aflag)
|
|
|
|
cflag = 1;
|
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
for (rval = 0; *argv; ++argv) {
|
|
|
|
/* See if the file exists. */
|
2015-01-24 13:50:13 +00:00
|
|
|
if (fstatat(AT_FDCWD, *argv, &sb, atflag) != 0) {
|
2009-10-16 20:52:45 +00:00
|
|
|
if (errno != ENOENT) {
|
|
|
|
rval = 1;
|
|
|
|
warn("%s", *argv);
|
|
|
|
continue;
|
|
|
|
}
|
1994-05-27 12:33:43 +00:00
|
|
|
if (!cflag) {
|
|
|
|
/* Create the file. */
|
|
|
|
fd = open(*argv,
|
|
|
|
O_WRONLY | O_CREAT, DEFFILEMODE);
|
|
|
|
if (fd == -1 || fstat(fd, &sb) || close(fd)) {
|
|
|
|
rval = 1;
|
|
|
|
warn("%s", *argv);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If using the current time, we're done. */
|
|
|
|
if (!timeset)
|
|
|
|
continue;
|
|
|
|
} else
|
|
|
|
continue;
|
1999-07-04 17:26:16 +00:00
|
|
|
}
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2007-04-10 07:22:30 +00:00
|
|
|
/*
|
|
|
|
* We're adjusting the times based on the file times, not a
|
|
|
|
* specified time (that gets handled above).
|
|
|
|
*/
|
2007-04-09 02:19:37 +00:00
|
|
|
if (Aflag) {
|
2007-04-10 07:22:30 +00:00
|
|
|
if (aflag) {
|
2015-01-24 13:50:13 +00:00
|
|
|
ts[0] = sb.st_atim;
|
|
|
|
ts[0].tv_sec += Aflag;
|
2007-04-10 07:22:30 +00:00
|
|
|
}
|
|
|
|
if (mflag) {
|
2015-01-24 13:50:13 +00:00
|
|
|
ts[1] = sb.st_mtim;
|
|
|
|
ts[1].tv_sec += Aflag;
|
2007-04-10 07:22:30 +00:00
|
|
|
}
|
2007-04-09 02:19:37 +00:00
|
|
|
}
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2015-01-24 13:50:13 +00:00
|
|
|
if (!utimensat(AT_FDCWD, *argv, ts, atflag))
|
1994-05-27 12:33:43 +00:00
|
|
|
continue;
|
|
|
|
|
2012-02-04 13:37:31 +00:00
|
|
|
rval = 1;
|
|
|
|
warn("%s", *argv);
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
exit(rval);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;
|
|
|
|
|
2013-04-23 13:03:14 +00:00
|
|
|
static void
|
2015-01-24 13:50:13 +00:00
|
|
|
stime_arg1(const char *arg, struct timespec *tvp)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
1998-06-29 15:52:49 +00:00
|
|
|
time_t now;
|
1994-05-27 12:33:43 +00:00
|
|
|
struct tm *t;
|
|
|
|
int yearset;
|
|
|
|
char *p;
|
2015-02-15 21:28:00 +00:00
|
|
|
|
|
|
|
now = time(NULL);
|
1998-06-29 15:52:49 +00:00
|
|
|
if ((t = localtime(&now)) == NULL)
|
1994-05-27 12:33:43 +00:00
|
|
|
err(1, "localtime");
|
|
|
|
/* [[CC]YY]MMDDhhmm[.SS] */
|
|
|
|
if ((p = strchr(arg, '.')) == NULL)
|
|
|
|
t->tm_sec = 0; /* Seconds defaults to 0. */
|
|
|
|
else {
|
|
|
|
if (strlen(p + 1) != 2)
|
|
|
|
goto terr;
|
|
|
|
*p++ = '\0';
|
|
|
|
t->tm_sec = ATOI2(p);
|
|
|
|
}
|
1995-05-30 06:41:30 +00:00
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
yearset = 0;
|
|
|
|
switch(strlen(arg)) {
|
|
|
|
case 12: /* CCYYMMDDhhmm */
|
|
|
|
t->tm_year = ATOI2(arg);
|
1995-07-08 16:47:47 +00:00
|
|
|
t->tm_year *= 100;
|
1994-05-27 12:33:43 +00:00
|
|
|
yearset = 1;
|
2002-08-25 13:23:09 +00:00
|
|
|
/* FALLTHROUGH */
|
1994-05-27 12:33:43 +00:00
|
|
|
case 10: /* YYMMDDhhmm */
|
|
|
|
if (yearset) {
|
|
|
|
yearset = ATOI2(arg);
|
|
|
|
t->tm_year += yearset;
|
|
|
|
} else {
|
|
|
|
yearset = ATOI2(arg);
|
|
|
|
if (yearset < 69)
|
|
|
|
t->tm_year = yearset + 2000;
|
|
|
|
else
|
|
|
|
t->tm_year = yearset + 1900;
|
|
|
|
}
|
|
|
|
t->tm_year -= 1900; /* Convert to UNIX time. */
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case 8: /* MMDDhhmm */
|
|
|
|
t->tm_mon = ATOI2(arg);
|
|
|
|
--t->tm_mon; /* Convert from 01-12 to 00-11 */
|
|
|
|
t->tm_mday = ATOI2(arg);
|
|
|
|
t->tm_hour = ATOI2(arg);
|
|
|
|
t->tm_min = ATOI2(arg);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto terr;
|
|
|
|
}
|
|
|
|
|
|
|
|
t->tm_isdst = -1; /* Figure out DST. */
|
|
|
|
tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);
|
|
|
|
if (tvp[0].tv_sec == -1)
|
2013-04-23 13:03:14 +00:00
|
|
|
goto terr;
|
1994-05-27 12:33:43 +00:00
|
|
|
|
2015-01-24 13:50:13 +00:00
|
|
|
tvp[0].tv_nsec = tvp[1].tv_nsec = 0;
|
2013-04-23 13:03:14 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
terr:
|
|
|
|
errx(1, "out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]");
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
2013-04-23 13:03:14 +00:00
|
|
|
static void
|
2015-01-24 13:50:13 +00:00
|
|
|
stime_arg2(const char *arg, int year, struct timespec *tvp)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
1998-06-29 15:52:49 +00:00
|
|
|
time_t now;
|
1994-05-27 12:33:43 +00:00
|
|
|
struct tm *t;
|
2015-02-15 21:28:00 +00:00
|
|
|
|
|
|
|
now = time(NULL);
|
1998-06-29 15:52:49 +00:00
|
|
|
if ((t = localtime(&now)) == NULL)
|
1994-05-27 12:33:43 +00:00
|
|
|
err(1, "localtime");
|
|
|
|
|
|
|
|
t->tm_mon = ATOI2(arg); /* MMDDhhmm[yy] */
|
|
|
|
--t->tm_mon; /* Convert from 01-12 to 00-11 */
|
|
|
|
t->tm_mday = ATOI2(arg);
|
|
|
|
t->tm_hour = ATOI2(arg);
|
|
|
|
t->tm_min = ATOI2(arg);
|
1999-01-05 09:58:02 +00:00
|
|
|
if (year) {
|
1994-05-27 12:33:43 +00:00
|
|
|
t->tm_year = ATOI2(arg);
|
1999-01-05 10:13:54 +00:00
|
|
|
if (t->tm_year < 39) /* support 2000-2038 not 1902-1969 */
|
1999-01-05 09:58:02 +00:00
|
|
|
t->tm_year += 100;
|
|
|
|
}
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
t->tm_isdst = -1; /* Figure out DST. */
|
|
|
|
tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);
|
|
|
|
if (tvp[0].tv_sec == -1)
|
|
|
|
errx(1,
|
|
|
|
"out of range or illegal time specification: MMDDhhmm[yy]");
|
|
|
|
|
2015-01-24 13:50:13 +00:00
|
|
|
tvp[0].tv_nsec = tvp[1].tv_nsec = 0;
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
2013-04-23 13:03:14 +00:00
|
|
|
static void
|
2015-01-24 13:50:13 +00:00
|
|
|
stime_darg(const char *arg, struct timespec *tvp)
|
2012-06-10 14:26:51 +00:00
|
|
|
{
|
|
|
|
struct tm t = { .tm_sec = 0 };
|
|
|
|
const char *fmt, *colon;
|
|
|
|
char *p;
|
|
|
|
int val, isutc = 0;
|
|
|
|
|
2015-01-24 13:50:13 +00:00
|
|
|
tvp[0].tv_nsec = 0;
|
2012-06-10 14:26:51 +00:00
|
|
|
t.tm_isdst = -1;
|
|
|
|
colon = strchr(arg, ':');
|
|
|
|
if (colon == NULL || strchr(colon + 1, ':') == NULL)
|
|
|
|
goto bad;
|
|
|
|
fmt = strchr(arg, 'T') != NULL ? "%Y-%m-%dT%H:%M:%S" :
|
|
|
|
"%Y-%m-%d %H:%M:%S";
|
|
|
|
p = strptime(arg, fmt, &t);
|
|
|
|
if (p == NULL)
|
|
|
|
goto bad;
|
|
|
|
/* POSIX: must have at least one digit after dot */
|
|
|
|
if ((*p == '.' || *p == ',') && isdigit((unsigned char)p[1])) {
|
|
|
|
p++;
|
2015-01-24 13:50:13 +00:00
|
|
|
val = 100000000;
|
2012-06-10 14:26:51 +00:00
|
|
|
while (isdigit((unsigned char)*p)) {
|
2015-01-24 13:50:13 +00:00
|
|
|
tvp[0].tv_nsec += val * (*p - '0');
|
2012-06-10 14:26:51 +00:00
|
|
|
p++;
|
|
|
|
val /= 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (*p == 'Z') {
|
|
|
|
isutc = 1;
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
if (*p != '\0')
|
|
|
|
goto bad;
|
|
|
|
|
|
|
|
tvp[0].tv_sec = isutc ? timegm(&t) : mktime(&t);
|
|
|
|
|
|
|
|
tvp[1] = tvp[0];
|
|
|
|
return;
|
|
|
|
|
|
|
|
bad:
|
|
|
|
errx(1, "out of range or illegal time specification: YYYY-MM-DDThh:mm:SS[.frac][tz]");
|
|
|
|
}
|
|
|
|
|
2007-04-09 02:19:37 +00:00
|
|
|
/* Calculate a time offset in seconds, given an arg of the format [-]HHMMSS. */
|
|
|
|
int
|
2013-04-23 13:03:14 +00:00
|
|
|
timeoffset(const char *arg)
|
2007-04-09 02:19:37 +00:00
|
|
|
{
|
|
|
|
int offset;
|
|
|
|
int isneg;
|
|
|
|
|
|
|
|
offset = 0;
|
|
|
|
isneg = *arg == '-';
|
|
|
|
if (isneg)
|
|
|
|
arg++;
|
|
|
|
switch (strlen(arg)) {
|
|
|
|
default: /* invalid */
|
|
|
|
errx(1, "Invalid offset spec, must be [-][[HH]MM]SS");
|
|
|
|
|
|
|
|
case 6: /* HHMMSS */
|
|
|
|
offset = ATOI2(arg);
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case 4: /* MMSS */
|
|
|
|
offset = offset * 60 + ATOI2(arg);
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case 2: /* SS */
|
|
|
|
offset = offset * 60 + ATOI2(arg);
|
|
|
|
}
|
|
|
|
if (isneg)
|
|
|
|
return (-offset);
|
|
|
|
else
|
|
|
|
return (offset);
|
|
|
|
}
|
|
|
|
|
2013-04-23 13:03:14 +00:00
|
|
|
static void
|
2015-01-24 13:50:13 +00:00
|
|
|
stime_file(const char *fname, struct timespec *tsp)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
struct stat sb;
|
|
|
|
|
|
|
|
if (stat(fname, &sb))
|
|
|
|
err(1, "%s", fname);
|
2015-01-24 13:50:13 +00:00
|
|
|
tsp[0] = sb.st_atim;
|
|
|
|
tsp[1] = sb.st_mtim;
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|
|
|
|
|
2013-04-23 13:03:14 +00:00
|
|
|
static void
|
2013-04-23 13:03:17 +00:00
|
|
|
usage(const char *myname)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2012-06-10 14:26:51 +00:00
|
|
|
fprintf(stderr, "usage: %s [-A [-][[hh]mm]SS] [-achm] [-r file] "
|
|
|
|
"[-t [[CC]YY]MMDDhhmm[.SS]]\n"
|
|
|
|
" [-d YYYY-MM-DDThh:mm:SS[.frac][tz]] "
|
|
|
|
"file ...\n", myname);
|
1994-05-27 12:33:43 +00:00
|
|
|
exit(1);
|
|
|
|
}
|