#include <string.h>
#include <sys/wait.h>
#include <stdlib.h>
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#include <stdio.h>
-struct stat istat, ostat;
+static struct stat istat, ostat;
+static int stripcalled = 0;
extern int errno;
extern int sys_nerr;
#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
extern char *sys_errlist[];
#endif
-#if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DECOSF_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
-extern struct passwd *getpwnam();
-int stripcalled = 0;
-#endif
+
+/* static prototypes */
+char *ErrorString(int aerrno);
+int stripName(char *aname);
+int atoo(register char *astr);
+
#if defined(AFS_HPUX_ENV) && !defined(AFS_HPUX102_ENV)
-utimes(file,tvp)
-char *file;
-struct timeval tvp[2];
+int utimes(char *file, struct timeval tvp[2])
{
struct utimbuf times;
}
#endif
-static char *strrpbrk (s, set)
- char *s;
- char *set;
+static char *strrpbrk (char *s, char *set)
{
char sets[256];
int i;
return 0;
}
-char *ErrorString(aerrno)
- int aerrno; {
+char *ErrorString(int aerrno)
+{
static char tbuffer[100];
if (aerrno < 0 || aerrno >= sys_nerr) {
sprintf(tbuffer, "undefined error code %d", aerrno);
return tbuffer;
}
-int
-stripName(aname)
- char *aname;
- {if (strrchr(aname, '.') == 0) return 1;
+int stripName(char *aname)
+{
+ if (strrchr(aname, '.') == 0) return 1;
else return 0;
- }
+}
-int
-atoo(astr)
- register char *astr;
- {register afs_int32 value;
+int atoo(register char *astr)
+{
+ register afs_int32 value;
register char tc;
value = 0;
while ((tc = *astr++))
value += tc-'0';
}
return value;
- }
+}
#if defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DECOSF_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV)
/*
* Implementation lifted from that for AIX 3.1, since there didn't seem to be any
* reason why it wouldn't work.
*/
-static int
-quickStrip (iname, oname, ignored, copy_only)
-char *iname, *oname; {
+static int quickStrip (char *iname, char *oname, int ignored, int copy_only)
+{
int pid, status;
static char *strip[] = {
"strip", 0, 0,
case 0: /* child */
copy[1] = iname;
copy[2] = oname;
- execve("/bin/cp", copy, (char **)0);
+ execve("/bin/cp", copy, NULL);
perror("/bin/cp");
exit(1);
#else
#define STRIP_BIN "/bin/strip"
#endif
- execve(STRIP_BIN, strip, (char **)0);
+ execve(STRIP_BIN, strip, NULL);
perror(STRIP_BIN);
exit(1);
return status;
}
-/*
- * AIXobject - lie about file type
- *
- * Input:
- * ignored
- *
- * Returns:
- * !0 indicating that the file in question is an XCOFF type file.
- *
- * Note:
- * Since /bin/strip will make that call for us, we will lie so that
- * it has a chance.
- */
-int
-AIXobject(ignored) {
-
- return !0;
-}
-
#else
#ifdef AFS_AIX_ENV
#ifdef AFS_AIX32_ENV
* whoa! back up and be a little more rational (every little bit helps in
* aix_31).
*/
-static
-quickStrip (iname, oname, ignored, copy_only)
-char *iname, *oname; {
+static int quickStrip (char *iname, char *oname, int ignored, int copy_only)
+{
int pid, status;
static char *strip[] = {
"strip", 0, 0,
return status;
}
-/*
- * AIXobject - lie about file type
- *
- * Input:
- * ignored
- *
- * Returns:
- * !0 indicating that the file in question is an XCOFF type file.
- *
- * Note:
- * Since /bin/strip will make that call for us, we will lie so that
- * it has a chance.
- */
-AIXobject(ignored) {
-
- return !0;
-}
#endif /* AFS_AIX32_ENV */
#else /* !AFS_AIX_ENV */
#ifdef mips
#include "sex.h"
-int quickStrip(fd, asize)
-int fd; /* file descriptor */
-afs_int32 asize; /* ignored */
+int quickStrip(int fd, afs_int32 asize)
{
FILHDR fheader;
int dum, newlen;
return 0;
}
#else /* !mips */
-static int quickStrip (afd, asize)
- int afd;
- afs_int32 asize; {
-
+static int quickStrip (int afd, afs_int32 asize)
+{
int n, bytesLeft;
struct exec buf;
struct exec *head;
#include "AFS_component_version_number.c"
-int
-main (argc, argv)
- int argc;
- char **argv;
+int main (int argc, char *argv[])
{
int setOwner, setMode, setGroup, ifd, ofd;
afs_int32 mode=0, owner, group;
#if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DECOSF_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV)
stripcalled = 0;
if (strip == 1 ||
- ((strip == -1 && ((istat.st_mode & 0111) == 0111) && stripName(newNames[i])) && AIXobject(fnames[i])))
+ ((strip == -1 && ((istat.st_mode & 0111) == 0111) && stripName(newNames[i]))))
stripcalled = 1;
if (!stripcalled) {
/* Simply copy target to dest */
}
/* all done now */
exit(rcode);
- }
+}