optional (#ifdef MKSH_SMALL) saving of 364 more bytes of .text

intended e.g. for FreeWRT
This commit is contained in:
tg
2006-11-09 21:00:13 +00:00
parent 35776a9d4d
commit c43e701025
2 changed files with 23 additions and 2 deletions

18
shf.c
View File

@@ -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