save ~1½K from the bootfloppy by reusing MirBSD libkern wcwidth(3)
but don’t bother for this for the regular /bin/mksh either to keep the generic code path tested well
This commit is contained in:
4
expr.c
4
expr.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.78 2015/09/05 19:19:03 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.79 2015/10/24 19:45:23 tg Exp $");
|
||||||
|
|
||||||
/* the order of these enums is constrained by the order of opinfo[] */
|
/* the order of these enums is constrained by the order of opinfo[] */
|
||||||
enum token {
|
enum token {
|
||||||
@ -916,6 +916,7 @@ ksh_access(const char *fn, int mode)
|
|||||||
return (rv);
|
return (rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MIRBSD_BOOTFLOPPY
|
||||||
/* From: X11/xc/programs/xterm/wcwidth.c,v 1.8 2014/06/24 19:53:53 tg Exp $ */
|
/* From: X11/xc/programs/xterm/wcwidth.c,v 1.8 2014/06/24 19:53:53 tg Exp $ */
|
||||||
|
|
||||||
struct mb_ucsrange {
|
struct mb_ucsrange {
|
||||||
@ -1195,3 +1196,4 @@ utf_wcwidth(unsigned int wc)
|
|||||||
return (2);
|
return (2);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
11
sh.h
11
sh.h
@ -108,6 +108,9 @@
|
|||||||
#if HAVE_VALUES_H
|
#if HAVE_VALUES_H
|
||||||
#include <values.h>
|
#include <values.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef MIRBSD_BOOTFLOPPY
|
||||||
|
#include <wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef __attribute__
|
#undef __attribute__
|
||||||
#if HAVE_ATTRIBUTE_BOUNDED
|
#if HAVE_ATTRIBUTE_BOUNDED
|
||||||
@ -172,9 +175,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.749 2015/10/09 21:36:59 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.750 2015/10/24 19:45:23 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R51 2015/10/09"
|
#define MKSH_VERSION "R51 2015/10/24"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
@ -1727,7 +1730,11 @@ int utf_widthadj(const char *, const char **);
|
|||||||
size_t utf_mbswidth(const char *) MKSH_A_PURE;
|
size_t utf_mbswidth(const char *) MKSH_A_PURE;
|
||||||
const char *utf_skipcols(const char *, int) MKSH_A_PURE;
|
const char *utf_skipcols(const char *, int) MKSH_A_PURE;
|
||||||
size_t utf_ptradj(const char *) MKSH_A_PURE;
|
size_t utf_ptradj(const char *) MKSH_A_PURE;
|
||||||
|
#ifdef MIRBSD_BOOTFLOPPY
|
||||||
|
#define utf_wcwidth(i) wcwidth((wchar_t)(i))
|
||||||
|
#else
|
||||||
int utf_wcwidth(unsigned int) MKSH_A_PURE;
|
int utf_wcwidth(unsigned int) MKSH_A_PURE;
|
||||||
|
#endif
|
||||||
int ksh_access(const char *, int);
|
int ksh_access(const char *, int);
|
||||||
struct tbl *tempvar(void);
|
struct tbl *tempvar(void);
|
||||||
/* funcs.c */
|
/* funcs.c */
|
||||||
|
Reference in New Issue
Block a user