This commit is contained in:
tg 2004-12-28 22:33:21 +00:00
parent 0114af375d
commit 337bd6717f
2 changed files with 3 additions and 21 deletions

21
misc.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/misc.c,v 2.8 2004/12/28 22:32:08 tg Exp $ */ /** $MirBSD: src/bin/ksh/misc.c,v 2.9 2004/12/28 22:33:21 tg Exp $ */
/* $OpenBSD: misc.c,v 1.20 2003/10/22 07:40:38 jmc Exp $ */ /* $OpenBSD: misc.c,v 1.20 2003/10/22 07:40:38 jmc Exp $ */
/* /*
@ -13,7 +13,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "ksh_stat.h" #include "ksh_stat.h"
__RCSID("$MirBSD: src/bin/ksh/misc.c,v 2.8 2004/12/28 22:32:08 tg Exp $"); __RCSID("$MirBSD: src/bin/ksh/misc.c,v 2.9 2004/12/28 22:33:21 tg Exp $");
#ifndef UCHAR_MAX #ifndef UCHAR_MAX
# define UCHAR_MAX 0xFF # define UCHAR_MAX 0xFF
@ -1126,23 +1126,6 @@ strip_nuls(char *buf, int nbytes)
return nbytes; return nbytes;
} }
/* Copy at most dsize-1 bytes from src to dst, ensuring dst is null terminated.
* Returns dst.
*/
char *
str_zcpy(char *dst, const char *src, int dsize)
{
if (dsize > 0) {
int len = strlen(src);
if (len >= dsize)
len = dsize - 1;
memcpy(dst, src, len);
dst[len] = '\0';
}
return dst;
}
/* Like read(2), but if read fails due to non-blocking flag, resets flag /* Like read(2), but if read fails due to non-blocking flag, resets flag
* and restarts read. * and restarts read.
*/ */

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/proto.h,v 2.6 2004/12/28 22:32:08 tg Exp $ */ /** $MirBSD: src/bin/ksh/proto.h,v 2.7 2004/12/28 22:33:21 tg Exp $ */
/* $OpenBSD: proto.h,v 1.11 2003/05/16 19:58:57 jsyn Exp $ */ /* $OpenBSD: proto.h,v 1.11 2003/05/16 19:58:57 jsyn Exp $ */
/* $From: proto.h,v 1.3 1994/05/19 18:32:40 michael Exp michael $ */ /* $From: proto.h,v 1.3 1994/05/19 18:32:40 michael Exp michael $ */
@ -195,7 +195,6 @@ void print_columns(struct shf *shf, int n,
char *(*func)(void *, int, char *, int), char *(*func)(void *, int, char *, int),
void *arg, int max_width, int prefcol); void *arg, int max_width, int prefcol);
int strip_nuls(char *buf, int nbytes); int strip_nuls(char *buf, int nbytes);
char *str_zcpy(char *dst, const char *src, int dsize);
int blocking_read(int fd, char *buf, int nbytes); int blocking_read(int fd, char *buf, int nbytes);
int reset_nonblock(int fd); int reset_nonblock(int fd);
char *ksh_get_wd(char *buf, int bsize); char *ksh_get_wd(char *buf, int bsize);