From 284a0b18bebc536ab5a57a50716babe2aa207afe Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 17 Nov 2014 17:18:11 +0000 Subject: [PATCH] touched up code for old sco compiler --- qse/doc/page/installation.md | 11 +++++++++++ qse/lib/cmn/nwif-cfg.c | 5 ++++- qse/lib/cmn/pio.c | 28 +++++++++++++++++++++++----- qse/lib/cmn/rbt.c | 4 +++- qse/lib/cmn/rex.c | 18 ++++++++++++++---- qse/lib/cmn/slmb.c | 13 ++++++++++++- 6 files changed, 67 insertions(+), 12 deletions(-) diff --git a/qse/doc/page/installation.md b/qse/doc/page/installation.md index 63a3ef32..18f06a5a 100644 --- a/qse/doc/page/installation.md +++ b/qse/doc/page/installation.md @@ -158,6 +158,14 @@ available for the native makefile for Watcom C/C++ for OS/2 only. ### SCO UNIX System V/386 Release 3.2 ### +- If /usr/include/netinet and /usr/include/net are missing, + check if there are /usr/include/sys/netinet and /usr/include/sys/net. + f they exists, you can make these symbolic links. + + cd /usr/include + ln -sf sys/netinet netinet + ln -sf sys/net net + - Specify GREP if configure fails to find an acceptable grep. - Build in the source tree. Building outside the source tree is likely to fail for dificiency of the bundled make utility. @@ -165,6 +173,9 @@ available for the native makefile for Watcom C/C++ for OS/2 only. ./configure GREP=/bin/grep CFLAGS="" +- Change RANLIB from "ranlib" to "true" in libltdl/libtool. + + make ### More options ### diff --git a/qse/lib/cmn/nwif-cfg.c b/qse/lib/cmn/nwif-cfg.c index 93b708ad..2a4782ab 100644 --- a/qse/lib/cmn/nwif-cfg.c +++ b/qse/lib/cmn/nwif-cfg.c @@ -627,7 +627,10 @@ static int get_nwifcfg (int s, qse_nwifcfg_t* cfg, struct ifreq* ifr) * use the streams interface to get the hardware address. */ int strfd; - qse_mchar_t devname[QSE_COUNTOF(ifr->ifr_name) + 5 + 1] = QSE_MT("/dev/"); + /*qse_mchar_t devname[QSE_COUNTOF(ifr->ifr_name) + 5 + 1] = QSE_MT("/dev/");*/ + qse_mchar_t devname[QSE_COUNTOF(ifr->ifr_name) + 5 + 1]; + + qse_mbscpy (devname, QSE_MT("/dev/")); qse_mbscpy (&devname[5], ifr->ifr_name); if ((strfd = QSE_OPEN (devname, O_RDONLY, 0)) >= 0) { diff --git a/qse/lib/cmn/pio.c b/qse/lib/cmn/pio.c index 64d4219b..c0f888e0 100644 --- a/qse/lib/cmn/pio.c +++ b/qse/lib/cmn/pio.c @@ -425,8 +425,10 @@ static int close_unneeded_fds_using_proc (int* excepts, qse_size_t count) static int get_highest_fd (void) { +#if defined(HAVE_GETRLIMIT) struct rlimit rlim; - int fd; +#endif + int fd = -1; QSE_DIR* d; #if defined(F_MAXFD) @@ -473,6 +475,7 @@ static int get_highest_fd (void) return maxfd; } +#if defined(HAVE_GETRLIMIT) if (QSE_GETRLIMIT (RLIMIT_NOFILE, &rlim) <= -1 || rlim.rlim_max == RLIM_INFINITY) { @@ -481,6 +484,9 @@ static int get_highest_fd (void) #endif } else fd = rlim.rlim_max; +#elif defined(HAVE_SYSCONF) + fd = sysconf (_SC_OPEN_MAX); +#endif if (fd <= -1) fd = 1024; /* fallback */ /* F_MAXFD is the highest fd. but RLIMIT_NOFILE and @@ -488,6 +494,7 @@ static int get_highest_fd (void) * descriptors. make adjustment */ if (fd > 0) fd--; + return fd; } @@ -659,7 +666,7 @@ int qse_pio_init ( qse_pio_t* pio, qse_mmgr_t* mmgr, const qse_char_t* cmd, qse_env_t* env, int flags) { - qse_pio_hnd_t handle[6] = + qse_pio_hnd_t handle[6] /*= { QSE_PIO_HND_NIL, QSE_PIO_HND_NIL, @@ -667,14 +674,14 @@ int qse_pio_init ( QSE_PIO_HND_NIL, QSE_PIO_HND_NIL, QSE_PIO_HND_NIL - }; + }*/; - qse_tio_t* tio[3] = + qse_tio_t* tio[3] /*= { QSE_NULL, QSE_NULL, QSE_NULL - }; + }*/; int i, minidx = -1, maxidx = -1; @@ -741,6 +748,17 @@ int qse_pio_init ( pio->mmgr = mmgr; pio->flags = flags; + handle[0] = QSE_PIO_HND_NIL; + handle[1] = QSE_PIO_HND_NIL; + handle[2] = QSE_PIO_HND_NIL; + handle[3] = QSE_PIO_HND_NIL; + handle[4] = QSE_PIO_HND_NIL; + handle[5] = QSE_PIO_HND_NIL; + + tio[0] = QSE_NULL; + tio[1] = QSE_NULL; + tio[2] = QSE_NULL; + #if defined(_WIN32) /* http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx */ diff --git a/qse/lib/cmn/rbt.c b/qse/lib/cmn/rbt.c index 6cdde47d..73b81113 100644 --- a/qse/lib/cmn/rbt.c +++ b/qse/lib/cmn/rbt.c @@ -612,7 +612,9 @@ pair_t* qse_rbt_cbsert ( { /* back up the contents of the current pair * in case it is reallocated */ - pair_t tmp = *x_cur; + pair_t tmp; + + tmp = *x_cur; /* call the callback function to manipulate the pair */ x_new = cbserter (rbt, x_cur, kptr, klen, ctx); diff --git a/qse/lib/cmn/rex.c b/qse/lib/cmn/rex.c index 3c84c2a0..fc6def08 100644 --- a/qse/lib/cmn/rex.c +++ b/qse/lib/cmn/rex.c @@ -895,7 +895,7 @@ static qse_rex_node_t* comp_atom (comp_t* com) default: if (com->rex->option & QSE_REX_STRICT) { - qse_char_t spc[] = + static qse_char_t spc[] = { QSE_T(')'), QSE_T('?'), @@ -905,10 +905,20 @@ static qse_rex_node_t* comp_atom (comp_t* com) QSE_T('\0') }; - if (com->rex->option & QSE_REX_NOBOUND) - spc[4] = QSE_T('\0'); + static qse_char_t nobound_spc[] = + { + QSE_T(')'), + QSE_T('?'), + QSE_T('*'), + QSE_T('+'), + QSE_T('\0') + }; - if (qse_strchr (spc, com->c.value) != QSE_NULL) + const qse_char_t* ptr; + + ptr = (com->rex->option & QSE_REX_NOBOUND)? nobound_spc: spc; + + if (qse_strchr (ptr, com->c.value)) { com->rex->errnum = QSE_REX_ESPCAWP; return QSE_NULL; diff --git a/qse/lib/cmn/slmb.c b/qse/lib/cmn/slmb.c index 2220fa01..5fe5d1dd 100644 --- a/qse/lib/cmn/slmb.c +++ b/qse/lib/cmn/slmb.c @@ -293,8 +293,19 @@ qse_size_t qse_slmblenmax (void) * is CP_UTF8(65001). you should use functions in utf8.c for utf8 * handling on windows. 2 is the maximum for DBCS encodings. */ return 2; -#else + +#elif defined(MB_CUR_MAX) + return MB_CUR_MAX; + +#elif (QSE_SIZEOF_WCHAR_T == QSE_SIZEOF_MCHAR_T) + + /* no proper multibyte string support */ + return 1; + +#else + /* fallback max utf8 value */ + return 6; #endif }