/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef lint
#pragma ident "%Z%%M% %I% %E% SMI"
#endif
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <errno.h>
#include <unistd.h>
int status;
#ifdef S5EMUL
#endif /* S5EMUL */
static char usage[] =
#ifdef S5EMUL
"[-amc] [mmddhhmm[yy]]";
#else /*!S5EMUL*/
"[-amcf]";
int force = 0;
int nowrite;
#endif /*!S5EMUL*/
char *prog;
#ifdef S5EMUL
char *cbp;
#endif /* S5EMUL */
#ifdef S5EMUL
struct tm *
gtime()
{
long nt;
}
}
return (&newtime);
}
gpair()
{
int c, d;
char *cp;
if (*cp == 0)
return (-1);
if (c<0 || c>100)
return (-1);
if (*cp == 0)
return (-1);
return (-1);
return (c+d);
}
#endif /*S5EMUL*/
int
{
int c;
#ifdef S5EMUL
int days_in_month;
#endif /* S5EMUL */
extern char *optarg;
extern int optind;
extern int opterr;
opterr = 0; /* disable getopt() error msgs */
switch (optc) {
case 'm':
mflg++;
aflg--;
break;
case 'a':
aflg++;
mflg--;
break;
case 'c':
cflg++;
break;
#ifndef S5EMUL
case 'f':
force++; /* SysV version ignores -f */
break;
#endif /*!S5EMUL*/
case '?':
errflg++;
}
exit(2);
}
status = 0;
#ifdef S5EMUL
#endif /*S5EMUL*/
else
nflg++; /* no -a, -m, or date seen */
#ifdef S5EMUL
} else { /* SysV version sets arbitrary date */
prog);
exit(2);
}
prog);
exit(2);
}
}
#endif /*S5EMUL*/
status++;
}
return (status);
}
int
char *filename;
{
int fd;
/*
* if stat failed for reasons other than ENOENT,
* the file should not be created, since this
* can clobber the contents of an existing file
* (for example, a large file that results in overflow).
*/
return (-1);
} else if (cflg) {
return (-1);
}
return (-1);
}
else {
return (-1);
}
}
if (nflg)
return (0);
}
if (mflg <= 0)
if (aflg <= 0)
#ifndef S5EMUL
/*
* Since utime() allows the owner to change file times without
* regard to access permission, enforce BSD semantics here
* (cannot touch if read-only and not -f).
*/
"%s: cannot touch %s: no write permission\n",
return (-1);
}
#endif /*!S5EMUL*/
/*
* If utime() failed to set the Present, it
* could be a BSD server that is complaining.
*/
}
return (-1);
}
return (0);
}
int
char *filename;
{
int rwstatus;
"%s: %s: only owner may touch special files on this filesystem\n",
return (-1);
}
#ifndef S5EMUL
return (-1);
}
return (-1);
}
return (rwstatus);
} else
#endif /*!S5EMUL*/
}
int
char *filename;
{
int fd;
char first;
if (size) {
goto error;
goto closeerror;
goto closeerror;
goto closeerror;
} else {
goto error;
}
goto error;
return (0);
return (-1);
}
#ifdef S5EMUL
isnumber(s)
char *s;
{
char c;
while (c = *s++)
if (!isdigit(c))
return (0);
return (1);
}
#endif /* S5EMUL */
/*
* nanoseconds are rounded off to microseconds by flooring.
*/
static void
{
}