******************************************************************/
/* $ACIS: $ */
-#ifndef lint
-#endif
-
/* ALSO utimes and strip the file
Generic install command. Options are:
#define MAXFILES 200
#define BUFSIZE 32768
+#include <afsconfig.h>
#include <afs/param.h>
+
+RCSID("$Header$");
+
#include <stdio.h>
#include <pwd.h>
#include <grp.h>
#ifdef AFS_HPUX_ENV
#include <utime.h>
#endif
+#include <unistd.h>
+#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;
+#if !defined(AFS_DARWIN60_ENV) && !defined(AFS_FBSD50_ENV)
extern int sys_nerr;
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_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)
-extern struct passwd *getpwnam();
-int stripcalled = 0;
+#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
+extern char *sys_errlist[];
#endif
-#ifndef rindex
-extern char *rindex(); /* this should always be defined, shouldn't it? */
-#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;
- bzero (sets, sizeof(sets));
- while (*set) sets[*set++] = 1;
+ memset(sets, 0, sizeof(sets));
+ while (*set) sets[(int) *set++] = 1;
i = strlen (s);
- while (i > 0) if (sets[s[--i]]) return &s[i];
+ while (i > 0) if (sets[(int)s[--i]]) return &s[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;
+ } else {
+ strcpy(tbuffer, sys_errlist[aerrno]);
}
- return sys_errlist[aerrno];
+ return tbuffer;
}
-stripName(aname)
- char *aname;
- {if (rindex(aname, '.') == 0) return 1;
+int stripName(char *aname)
+{
+ if (strrchr(aname, '.') == 0) return 1;
else return 0;
- }
+}
-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++)
+ while ((tc = *astr++))
{value <<= 3;
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)
+#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
-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);
return -1;
}
+#if !defined(AFS_OBSD_ENV) && !defined(AFS_NBSD_ENV)
/*
* done the copy, now strip if desired.
*/
strip[1] = oname;
#ifdef AFS_SUN5_ENV
#define STRIP_BIN "/usr/ccs/bin/strip"
-#elif defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
+#elif defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
#define STRIP_BIN "/usr/bin/strip"
#else
#define STRIP_BIN "/bin/strip"
#endif
- execve(STRIP_BIN, strip, (char **)0);
+ execve(STRIP_BIN, strip, NULL);
perror(STRIP_BIN);
exit(1);
return -1;
}
}
+#endif
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;
-}
-
#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"
-main (argc, argv)
- int argc;
- char **argv;
+int main (int argc, char *argv[])
{
int setOwner, setMode, setGroup, ifd, ofd;
- afs_int32 mode, owner, group;
+ afs_int32 mode=0, owner, group;
struct passwd *tpw;
struct group *tgp;
char *fnames[MAXFILES], *newNames[MAXFILES];
- afs_int32 rcode, code, newcode;
+ afs_int32 rcode, code;
char *dname;
char pname[1024];
#if defined (AFS_HPUX_ENV)
#endif /* AFS_HPUX_ENV */
char pnametmp[1024];
int pnamelen;
+ afs_int32 newcode;
static char diskBuffer[BUFSIZE]; /* must be static to avoid compiler bugs for large stuff */
char myHostName[100];
struct timeval tvp[2];
for (i=0;i<fptr;i++)
{/* figure out name to put as entry name for file */
- tp = rindex(fnames[i], '/');
+ tp = strrchr(fnames[i], '/');
if (tp) newNames[i] = tp+1;
else newNames[i] = fnames[i];
}
continue;
}
}
-#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)
+#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);
- }
+}