use strchr/strrchr/memset/memmove instead of index/rindex/bzero/bcopy
This commit is contained in:
parent
88e3ac566e
commit
031fee8254
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: futil.c,v 1.4 1997/10/17 14:53:34 lukem Exp $ */
|
||||
/* $NetBSD: futil.c,v 1.5 1997/10/18 11:05:34 lukem Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "from FreeBSD Id: futil.c,v 1.7 1997/10/08 07:45:39 charnier Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: futil.c,v 1.4 1997/10/17 14:53:34 lukem Exp $");
|
||||
__RCSID("$NetBSD: futil.c,v 1.5 1997/10/18 11:05:34 lukem Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -48,7 +48,7 @@ make_hierarchy(char *dir)
|
|||
else
|
||||
cp1 = cp2 = dir;
|
||||
while (cp2) {
|
||||
if ((cp2 = index(cp1, '/')) !=NULL )
|
||||
if ((cp2 = strchr(cp1, '/')) !=NULL )
|
||||
*cp2 = '\0';
|
||||
if (fexists(dir)) {
|
||||
if (!isdir(dir))
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: perform.c,v 1.7 1997/10/17 14:53:40 lukem Exp $ */
|
||||
/* $NetBSD: perform.c,v 1.8 1997/10/18 11:05:38 lukem Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: perform.c,v 1.7 1997/10/17 14:53:40 lukem Exp $");
|
||||
__RCSID("$NetBSD: perform.c,v 1.8 1997/10/18 11:05:38 lukem Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -376,7 +376,7 @@ pkg_do(char *pkg)
|
|||
if (make_hierarchy(LogDir)) {
|
||||
warnx("can't record package into '%s', you're on your own!",
|
||||
LogDir);
|
||||
bzero(LogDir, FILENAME_MAX);
|
||||
memset(LogDir, 0, FILENAME_MAX);
|
||||
code = 1;
|
||||
goto success; /* close enough for government work */
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: perform.c,v 1.5 1997/10/17 14:53:52 lukem Exp $ */
|
||||
/* $NetBSD: perform.c,v 1.6 1997/10/18 11:05:45 lukem Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.38 1997/10/13 15:03:51 jkh Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: perform.c,v 1.5 1997/10/17 14:53:52 lukem Exp $");
|
||||
__RCSID("$NetBSD: perform.c,v 1.6 1997/10/18 11:05:45 lukem Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -69,7 +69,7 @@ pkg_perform(char **pkgs)
|
|||
plist.head = plist.tail = NULL;
|
||||
|
||||
/* Break the package name into base and desired suffix (if any) */
|
||||
if ((cp = rindex(pkg, '.')) != NULL) {
|
||||
if ((cp = strrchr(pkg, '.')) != NULL) {
|
||||
suffix = cp + 1;
|
||||
*cp = '\0';
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist)
|
|||
args[nargs++] = "-c";
|
||||
args[nargs++] = "-f";
|
||||
args[nargs++] = tball;
|
||||
if (index(suffix, 'z')) /* Compress/gzip? */
|
||||
if (strchr(suffix, 'z')) /* Compress/gzip? */
|
||||
args[nargs++] = "-z";
|
||||
if (Dereference)
|
||||
args[nargs++] = "-h";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: file.c,v 1.6 1997/10/17 14:54:29 lukem Exp $ */
|
||||
/* $NetBSD: file.c,v 1.7 1997/10/18 11:05:51 lukem Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: file.c,v 1.6 1997/10/17 14:54:29 lukem Exp $");
|
||||
__RCSID("$NetBSD: file.c,v 1.7 1997/10/18 11:05:51 lukem Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -468,10 +468,10 @@ unpack(char *pkg, char *flist)
|
|||
* compressed.
|
||||
*/
|
||||
if (strcmp(pkg, "-")) {
|
||||
cp = rindex(pkg, '.');
|
||||
cp = strrchr(pkg, '.');
|
||||
if (cp) {
|
||||
strcpy(suffix, cp + 1);
|
||||
if (index(suffix, 'z') || index(suffix, 'Z'))
|
||||
if (strchr(suffix, 'z') || strchr(suffix, 'Z'))
|
||||
strcpy(args, "-z");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $NetBSD: ftpio.c,v 1.3 1997/10/17 14:54:32 lukem Exp $ */
|
||||
/* $NetBSD: ftpio.c,v 1.4 1997/10/18 11:05:56 lukem Exp $ */
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: ftpio.c,v 1.3 1997/10/17 14:54:32 lukem Exp $");
|
||||
__RCSID("$NetBSD: ftpio.c,v 1.4 1997/10/18 11:05:56 lukem Exp $");
|
||||
#endif
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
|
@ -20,7 +20,7 @@ __RCSID("$NetBSD: ftpio.c,v 1.3 1997/10/17 14:54:32 lukem Exp $");
|
|||
* `state' of FTP_t
|
||||
*
|
||||
* from FreeBSD Id: ftpio.c,v 1.25 1997/02/22 15:06:50 peter Exp
|
||||
* $NetBSD: ftpio.c,v 1.3 1997/10/17 14:54:32 lukem Exp $
|
||||
* $NetBSD: ftpio.c,v 1.4 1997/10/18 11:05:56 lukem Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -429,7 +429,7 @@ get_url_info(char *url_in, char *host_ret, int *port_ret, char *name_ret)
|
|||
/* We like to stomp a lot on the URL string in dissecting it, so copy it first */
|
||||
strncpy(url, url_in, BUFSIZ);
|
||||
host = url + 6;
|
||||
if ((cp = index(host, ':')) != NULL) {
|
||||
if ((cp = strchr(host, ':')) != NULL) {
|
||||
*(cp++) = '\0';
|
||||
port = strtol(cp, 0, 0);
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ get_url_info(char *url_in, char *host_ret, int *port_ret, char *name_ret)
|
|||
if (port_ret)
|
||||
*port_ret = port;
|
||||
|
||||
if ((name = index(cp ? cp : host, '/')) != NULL)
|
||||
if ((name = strchr(cp ? cp : host, '/')) != NULL)
|
||||
*(name++) = '\0';
|
||||
if (host_ret)
|
||||
strcpy(host_ret, host);
|
||||
|
@ -708,7 +708,7 @@ ftp_login_session(FTP_t ftp, char *host, char *user, char *passwd, int port, int
|
|||
return FAILURE;
|
||||
}
|
||||
ftp->addrtype = sin.sin_family = he->h_addrtype;
|
||||
bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length);
|
||||
memmove((char *)&sin.sin_addr, he->h_addr, he->h_length);
|
||||
}
|
||||
|
||||
sin.sin_port = htons(port);
|
||||
|
@ -788,8 +788,8 @@ ftp_file_op(FTP_t ftp, char *operation, char *file, FILE **fp, char *mode, off_t
|
|||
}
|
||||
|
||||
sin.sin_family = ftp->addrtype;
|
||||
bcopy(addr, (char *)&sin.sin_addr, 4);
|
||||
bcopy(addr + 4, (char *)&sin.sin_port, 2);
|
||||
memmove((char *)&sin.sin_addr, addr, 4);
|
||||
memmove((char *)&sin.sin_port, addr + 4, 2);
|
||||
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
|
||||
(void)close(s);
|
||||
return FAILURE;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: plist.c,v 1.5 1997/10/17 14:54:47 lukem Exp $ */
|
||||
/* $NetBSD: plist.c,v 1.6 1997/10/18 11:06:02 lukem Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: plist.c,v 1.5 1997/10/17 14:54:47 lukem Exp $");
|
||||
__RCSID("$NetBSD: plist.c,v 1.6 1997/10/18 11:06:02 lukem Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -156,7 +156,7 @@ new_plist_entry(void)
|
|||
PackingList ret;
|
||||
|
||||
ret = (PackingList)malloc(sizeof(struct _plist));
|
||||
bzero(ret, sizeof(struct _plist));
|
||||
memset(ret, 0, sizeof(struct _plist));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -495,7 +495,7 @@ delete_hierarchy(char *dir, Boolean ign_err, Boolean nukedirs)
|
|||
if (!nukedirs)
|
||||
return 0;
|
||||
while (cp2) {
|
||||
if ((cp2 = rindex(cp1, '/')) != NULL)
|
||||
if ((cp2 = strrchr(cp1, '/')) != NULL)
|
||||
*cp2 = '\0';
|
||||
if (!isemptydir(dir))
|
||||
return 0;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: str.c,v 1.4 1997/10/17 14:54:50 lukem Exp $ */
|
||||
/* $NetBSD: str.c,v 1.5 1997/10/18 11:06:07 lukem Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: str.c,v 1.4 1997/10/17 14:54:50 lukem Exp $");
|
||||
__RCSID("$NetBSD: str.c,v 1.5 1997/10/18 11:06:07 lukem Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -89,7 +89,7 @@ suffix(char *str, char *suff)
|
|||
char *idx;
|
||||
Boolean ret = FALSE;
|
||||
|
||||
idx = rindex(str, '.');
|
||||
idx = strrchr(str, '.');
|
||||
if (idx && !strcmp(idx + 1, suff))
|
||||
ret = TRUE;
|
||||
return ret;
|
||||
|
@ -101,7 +101,7 @@ nuke_suffix(char *str)
|
|||
{
|
||||
char *idx;
|
||||
|
||||
idx = rindex(str, '.');
|
||||
idx = strrchr(str, '.');
|
||||
if (idx)
|
||||
*idx = '\0'; /* Yow! Don't try this on a const! */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue