optional (#ifdef MKSH_SMALL) saving of 364 more bytes of .text
intended e.g. for FreeWRT
This commit is contained in:
parent
35776a9d4d
commit
c43e701025
7
sh.h
7
sh.h
@ -8,7 +8,7 @@
|
||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.60 2006/11/09 20:53:42 tg Exp $"
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.61 2006/11/09 21:00:13 tg Exp $"
|
||||
#define MKSH_VERSION "R29 2006/11/09"
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
@ -492,10 +492,15 @@ EXTERN int x_cols I__(80); /* tty columns */
|
||||
|
||||
#define shf_fileno(shf) ((shf)->fd)
|
||||
#define shf_setfileno(shf,nfd) ((shf)->fd = (nfd))
|
||||
#ifdef MKSH_SMALL
|
||||
int shf_getc(struct shf *);
|
||||
int shf_putc(int, struct shf *);
|
||||
#else
|
||||
#define shf_getc(shf) ((shf)->rnleft > 0 ? (shf)->rnleft--, *(shf)->rp++ : \
|
||||
shf_getchar(shf))
|
||||
#define shf_putc(c, shf) ((shf)->wnleft == 0 ? shf_putchar((c), (shf)) : \
|
||||
((shf)->wnleft--, *(shf)->wp++ = (c)))
|
||||
#endif
|
||||
#define shf_eof(shf) ((shf)->flags & SHF_EOF)
|
||||
#define shf_error(shf) ((shf)->flags & SHF_ERROR)
|
||||
#define shf_errno(shf) ((shf)->errno_)
|
||||
|
18
shf.c
18
shf.c
@ -2,7 +2,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.6 2006/08/02 12:50:20 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.7 2006/11/09 21:00:13 tg Exp $");
|
||||
|
||||
/* flags to shf_emptybuf() */
|
||||
#define EB_READSW 0x01 /* about to switch to reading */
|
||||
@ -1000,3 +1000,19 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
|
||||
|
||||
return shf_error(shf) ? EOF : nwritten;
|
||||
}
|
||||
|
||||
#ifdef MKSH_SMALL
|
||||
int
|
||||
shf_getc(struct shf *shf)
|
||||
{
|
||||
return ((shf)->rnleft > 0 ? (shf)->rnleft--, *(shf)->rp++ :
|
||||
shf_getchar(shf));
|
||||
}
|
||||
|
||||
int
|
||||
shf_putc(int c, struct shf *shf)
|
||||
{
|
||||
return ((shf)->wnleft == 0 ? shf_putchar((c), (shf)) :
|
||||
((shf)->wnleft--, *(shf)->wp++ = (c)));
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user