/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
+#include <roken.h>
-/* missing type from C language */
-
-#include <errno.h>
-#ifdef AFS_AIX32_ENV
-#include <signal.h>
-#undef _NONSTD_TYPES
-#endif
-#include <stdio.h>
#include <afs/afs_args.h>
-#include <sys/param.h>
-#ifdef AFS_SUN5_ENV
-#include <fcntl.h>
-#endif
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <sys/time.h>
#define VIRTUE
#define VICE
-#include <sys/ioctl.h>
#include <afs/vice.h>
#undef VIRTUE
#undef VICE
-#include <sys/ioctl.h>
-#include <netdb.h>
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
#include <afs/venus.h>
+#include <afs/sys_prototypes.h>
+#include <afs/afsutil.h>
+#include <afs/afs_consts.h>
/* ************************************************************* */
short preserveMountPoints = 0;
short forceOverwrite = 0;
-int pageSize;
short setacl = 1;
short oldAcl = 0;
char file1[MAXPATHLEN], file2[MAXPATHLEN];
-#define MAXSIZE 2048
-static char space[MAXSIZE];
+static char space[AFS_PIOCTL_MAXSIZE];
struct OldAcl {
int nplus;
{
#ifdef AFS_AIX32_ENV
/*
- * The following signal action for AIX is necessary so that in case of a
- * crash (i.e. core is generated) we can include the user's data section
+ * The following signal action for AIX is necessary so that in case of a
+ * crash (i.e. core is generated) we can include the user's data section
* in the core dump. Unfortunately, by default, only a partial core is
* generated which, in many cases, isn't too useful.
*/
nsa.sa_flags = SA_FULLDUMP;
sigaction(SIGSEGV, &nsa, NULL);
#endif
-#if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV)
- pageSize = getpagesize();
-#endif
ScanArgs(argc, argv);
/* now read each line of the CopyList */
while (argc > 0 && *argv[0] == '-') {
char *cp = *argv;
+ if (strlen(cp) > 2) {
+ goto badoption;
+ }
+
switch (*++cp) {
case 'v':
verbose = 1;
break;
default:
- fprintf(stderr, "Unknown option: '%c'\n", *cp);
+ cp--;
+
+ badoption:
+ fprintf(stderr, "Unknown option: '%s'\n", cp);
fprintf(stderr, USAGE);
exit(1);
}
if (verbose) {
printf(" Copy file %s to %s (%u Bytes)\n", file1, file2,
- s1.st_size);
+ (unsigned int) s1.st_size);
fflush(stdout);
}
if (s1.st_size != s2.st_size) {
fprintf(stderr,
"WARNING: New file %s is %u bytes long; should be %u\n",
- file2, s2.st_size, s1.st_size);
+ file2, (unsigned int) s2.st_size,
+ (unsigned int) s1.st_size);
}
}
char f1[MAXPATHLEN], f2[MAXPATHLEN];
char *p1, *p2;
struct dirent *d;
+ struct timeval tv[2];
if (verbose) {
printf("Level %d: Directory %s to %s\n", level, file1, file2);
printf("Not setting acls\n");
}
}
+
+ /* preserve access and modification times: ("-x" disables) */
+ if (preserveDate) {
+ tv[0].tv_sec = s1.st_atime;
+ tv[0].tv_usec = 0;
+ tv[1].tv_sec = s1.st_mtime;
+ tv[1].tv_usec = 0;
+ utimes(file2, tv);
+ }
}
return rcode;
blob->in = last_component;
blob->in_size = strlen(last_component) + 1;
- blob->out_size = MAXSIZE;
+ blob->out_size = AFS_PIOCTL_MAXSIZE;
blob->out = space;
- memset(space, 0, MAXSIZE);
+ memset(space, 0, AFS_PIOCTL_MAXSIZE);
code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, blob, 0);
*/
}
}
- return 4;
}