update
authormirabilos <m@mirbsd.org>
Wed, 6 Dec 2017 16:41:04 +0000 (17:41 +0100)
committermirabilos <m@mirbsd.org>
Wed, 6 Dec 2017 16:41:04 +0000 (17:41 +0100)
29 files changed:
NEWS
aclocal.m4
b.c
bw.c
charmap.c
charmap.h
config.h
configure.ac
jupprc
kbd.c
macro.c
path.c
rc.c
regex.c
scrn.c
scrn.h
selinux.c
syntax/c.jsf.in
termcap.c
tty.h
types.h
ublock.c
uedit.c
uerror.c
usearch.c
utag.c
utils.c
vfile.c
vfile.h

diff --git a/NEWS b/NEWS
index edc9c7b..6e2881a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,20 @@
-$MirOS: contrib/code/jupp/NEWS,v 1.110 2017/08/09 01:00:22 tg Exp $
+$MirOS: contrib/code/jupp/NEWS,v 1.111 2017/12/03 03:26:18 tg Exp $
 -------------------------------------------------------------------
 
 jupp-current
 
+- Harmonise help rendering in jupprc (also for 2.8, 3.7, (NEW) 4.4)
+- Update internationalisation data to Unicode 10.0.0 with bugfixes
+- Don’t limit JOE_FILENAME
+- Optionally be NOMMU-safe: use vfork(), disable stuff needing fork()
+- Let ^K] also remove whitespace at EOF
+- Major code cleanup and a lot of warning fixes
+- Improve syntax highlighting (conf, c, all dark blue-using ones)
+- Don’t use sscanf(3) any more (dietlibc complains about bloat)
+- Add way to disable use of the FPU (including Math), for klibc
+- Make assume_color[sic!] actually work
+- Recognise libncursesw for tgetflag(3); add --disable-terminfo
+
 JOE 3.1jupp31
 
 - Fix <bsd/string.h> usage issue on Haiku
index 4eadb13..4f5bc14 100644 (file)
@@ -488,7 +488,7 @@ AC_SUBST(install_sh)])
 
 # serial 2
 
-# Check whether the underlying file-system supports filenames
+# Check whether the underlying filesystem supports filenames
 # with a leading dot.  For instance MS-DOS doesn't.
 AC_DEFUN([AM_SET_LEADING_DOT],
 [rm -rf .tst 2>/dev/null
diff --git a/b.c b/b.c
index 9e4e2d3..896775f 100644 (file)
--- a/b.c
+++ b/b.c
@@ -9,7 +9,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/b.c,v 1.20 2017/12/03 02:36:00 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/b.c,v 1.23 2017/12/06 16:37:40 tg Exp $");
 
 #include <unistd.h>
 #include <sys/stat.h>
@@ -429,7 +429,7 @@ int pisbow(P *p)
        int d = prgetc(q);
 
        prm(q);
-       if (joe_isalnum_(p->b->o.charmap,c) && (!joe_isalnum_(p->b->o.charmap,d) || pisbof(p)))
+       if (joe_isalnux(p->b->o.charmap,c) && (!joe_isalnux(p->b->o.charmap,d) || pisbof(p)))
                return 1;
        else
                return 0;
@@ -443,7 +443,7 @@ int piseow(P *p)
        int c = prgetc(q);
 
        prm(q);
-       if (joe_isalnum_(p->b->o.charmap,c) && (!joe_isalnum_(p->b->o.charmap,d) || piseof(p)))
+       if (joe_isalnux(p->b->o.charmap,c) && (!joe_isalnux(p->b->o.charmap,d) || piseof(p)))
                return 1;
        else
                return 0;
@@ -2028,13 +2028,15 @@ unsigned char *parsens(unsigned char *s, long int *skip, long int *amnt)
 
        *skip = 0;
        *amnt = LONG_MAX;
-       for (x = sLEN(n) - 1; x > 0 && ((n[x] >= '0' && n[x] <= '9') || n[x] == 'x' || n[x] == 'X'); --x) ;
+       for (x = sLEN(n) - 1; x > 0 && ((n[x] >= '0' && n[x] <= '9') || (n[x] | 0x20) == 'x'); --x)
+               /* nothing */;
        if (n[x] == ',') {
                void *vp;
 
                n[x] = 0;
                *skip = ustol(n + x + 1, &vp, USTOL_EOS);
-               for (--x; x > 0 && ((n[x] >= '0' && n[x] <= '9') || n[x] == 'x' || n[x] == 'X'); --x) ;
+               for (--x; x > 0 && ((n[x] >= '0' && n[x] <= '9') || (n[x] | 0x20) == 'x'); --x)
+                       /* nothing */;
                if (n[x] == ',') {
                        n[x] = 0;
                        if (vp != NULL)
@@ -2042,7 +2044,6 @@ unsigned char *parsens(unsigned char *s, long int *skip, long int *amnt)
                        *skip = ustol(n + x + 1, NULL, USTOL_EOS);
                }
        }
-#ifndef __MSDOS__
        if (n[0] == '~') {
                for (x = 1; n[x] && n[x] != '/'; ++x) ;
                if (n[x] == '/') {
@@ -2073,7 +2074,6 @@ unsigned char *parsens(unsigned char *s, long int *skip, long int *amnt)
                        }
                }
        }
-#endif
        return n;
 }
 
@@ -2109,13 +2109,11 @@ B *bload(unsigned char *s)
        n = parsens(s, &skip, &amnt);
 
        /* Open file or stream */
-#ifndef __MSDOS__
        if (n[0] == '!') {
                nescape(maint->t);
                ttclsn();
                fi = popen((char *)(n + 1), "r");
        } else
-#endif
        if (!strcmp(n, "-"))
                fi = stdin;
        else {
@@ -2175,12 +2173,9 @@ B *bload(unsigned char *s)
 
        /* Close stream */
 err:
-#ifndef __MSDOS__
        if (s[0] == '!')
                pclose(fi);
-       else
-#endif
-       if (strcmp(n, "-"))
+       else if (strcmp(n, "-"))
                fclose(fi);
 
 opnerr:
@@ -2429,14 +2424,11 @@ int bsave(P *p, unsigned char *s, long int size, int flag)
        if (amnt < size)
                size = amnt;
 
-#ifndef __MSDOS__
        if (s[0] == '!') {
                nescape(maint->t);
                ttclsn();
                f = popen((char *)(s + 1), "w");
-       } else
-#endif
-       if (s[0] == '>' && s[1] == '>')
+       } else if (s[0] == '>' && s[1] == '>')
                f = fopen((char *)(s + 2), "a");
        else if (!strcmp(s, "-")) {
                nescape(maint->t);
@@ -2476,12 +2468,9 @@ int bsave(P *p, unsigned char *s, long int size, int flag)
        }
 
 err:
-#ifndef __MSDOS__
        if (s[0] == '!')
                pclose(f);
-       else
-#endif
-       if (strcmp(s, "-"))
+       else if (strcmp(s, "-"))
                fclose(f);
        else
                fflush(f);
diff --git a/bw.c b/bw.c
index cc13814..8b6aedb 100644 (file)
--- a/bw.c
+++ b/bw.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/bw.c,v 1.25 2017/12/02 04:32:38 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/bw.c,v 1.26 2017/12/04 22:15:38 tg Exp $");
 
 #include <string.h>
 #ifdef HAVE_STDLIB_H
@@ -536,7 +536,7 @@ static int lgen(SCRN *t, int y, int *screen, int *attr, int x, int w, P *p, long
                                do {
                                        outatr(utf8_map, t, screen + x, attr + x, x, y, tach, c1|atr);
                                        tach = tach1;
-                                       if (ifhave)
+                                       if (have)
                                                goto bye;
                                        if (++x == w)
                                                goto eosl;
@@ -594,7 +594,7 @@ static int lgen(SCRN *t, int y, int *screen, int *attr, int x, int w, P *p, long
                                } else
                                        --idx;
 
-                               if (ifhave)
+                               if (have)
                                        goto bye;
                                if (x >= w)
                                        goto eosl;
@@ -652,7 +652,7 @@ static void gennum(BW *w, int *screen, int *attr, SCRN *t, int y, int *comp)
                strlcpy((char *)buf, "      ",12);
        for (z = 0; buf[z]; ++z) {
                outatr(w->b->o.charmap, t, screen + z, attr + z, z, y, buf[z], 0);
-               if (ifhave)
+               if (have)
                        return;
                comp[z] = buf[z];
        }
@@ -815,7 +815,7 @@ void bwgen(BW *w, int linums)
        y = w->cursor->line - w->top->line + w->y;
        attr = t->attr + y*w->t->w;
        for (screen = t->scrn + y * w->t->w; y != bot; ++y, (screen += w->t->w), (attr += w->t->w)) {
-               if (ifhave && !linums)
+               if (have && !linums)
                        break;
                if (linums)
                        gennum(w, screen, attr, t, y, t->compose);
@@ -845,7 +845,7 @@ void bwgen(BW *w, int linums)
        y = w->y;
        attr = t->attr + w->y * w->t->w;
        for (screen = t->scrn + w->y * w->t->w; y != w->y + w->cursor->line - w->top->line; ++y, (screen += w->t->w), (attr += w->t->w)) {
-               if (ifhave && !linums)
+               if (have && !linums)
                        break;
                if (linums)
                        gennum(w, screen, attr, t, y, t->compose);
index aee4593..ab9d833 100644 (file)
--- a/charmap.c
+++ b/charmap.c
@@ -12,7 +12,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/charmap.c,v 1.23 2017/12/03 02:36:00 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/charmap.c,v 1.24 2017/12/04 21:53:33 tg Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -1071,7 +1071,7 @@ byte_ispunct(struct charmap *map, int c)
        if (c < 0 || c > 255)
                return (0);
        return (((map->print_map[ofst] & bitn) != 0) &&
-           ((map->alnum__map[ofst] & bitn) == 0));
+           ((map->alnux_map[ofst] & bitn) == 0));
 }
 
 int
@@ -1092,25 +1092,25 @@ byte_isspace(struct charmap *map, int c)
 }
 
 int
-byte_isalpha_(struct charmap *map, int c)
+byte_isalphx(struct charmap *map, int c)
 {
        int ofst = (c >> 3);
        int bitn = (1 << (c & 7));
 
        if (c < 0 || c > 255)
                return (0);
-       return ((map->alpha__map[ofst] & bitn) != 0);
+       return ((map->alphx_map[ofst] & bitn) != 0);
 }
 
 int
-byte_isalnum_(struct charmap *map, int c)
+byte_isalnux(struct charmap *map, int c)
 {
        int ofst = (c >> 3);
        int bitn = (1 << (c & 7));
 
        if (c < 0 || c > 255)
                return (0);
-       return ((map->alnum__map[ofst] & bitn) != 0);
+       return ((map->alnux_map[ofst] & bitn) != 0);
 }
 
 int
@@ -1160,8 +1160,8 @@ process_builtin(const struct builtin_charmap *builtin)
        map->is_punct = byte_ispunct;
        map->is_print = byte_isprint;
        map->is_space = byte_isspace;
-       map->is_alpha_ = byte_isalpha_;
-       map->is_alnum_ = byte_isalnum_;
+       map->is_alphx = byte_isalphx;
+       map->is_alnux = byte_isalnux;
        map->to_lower = byte_tolower;
        map->to_upper = byte_toupper;
        map->to_uni = to_uni;
@@ -1195,8 +1195,8 @@ process_builtin(const struct builtin_charmap *builtin)
 
        for (x = 0; x != 32; ++x) {
                map->print_map[x] = 0;
-               map->alpha__map[x] = 0;
-               map->alnum__map[x] = 0;
+               map->alphx_map[x] = 0;
+               map->alnux_map[x] = 0;
        }
 
        for (x = 0; x != 256; ++x) {
@@ -1208,8 +1208,8 @@ process_builtin(const struct builtin_charmap *builtin)
                        if (joe_iswprint(NULL, c))
                                set_bit(map->print_map, x);
                        if (joe_iswalpha(NULL, c)) {
-                               set_bit(map->alpha__map, x);
-                               set_bit(map->alnum__map, x);
+                               set_bit(map->alphx_map, x);
+                               set_bit(map->alnux_map, x);
                        }
 
                        y = joe_towlower(NULL, c);
@@ -1225,15 +1225,15 @@ process_builtin(const struct builtin_charmap *builtin)
        /* Set underbar <U+005F> */
 
        if ((c = from_uni(map, 0x5F)) != -1) {
-               set_bit(map->alpha__map, c);
-               set_bit(map->alnum__map, c);
+               set_bit(map->alphx_map, c);
+               set_bit(map->alnux_map, c);
        }
 
        /* Put digits into alnum map */
 
        for (x = 0x30; x != 0x3A; ++x) {
                if ((c = from_uni(map, x)) != -1)
-                       set_bit(map->alnum__map, c);
+                       set_bit(map->alnux_map, c);
        }
 
        map->next = charmaps;
@@ -1256,8 +1256,8 @@ load_builtins(void)
        map->is_punct = joe_iswpunct;
        map->is_print = joe_iswprint;
        map->is_space = joe_iswspace;
-       map->is_alpha_ = joe_iswalpha;
-       map->is_alnum_ = joe_iswalnum;
+       map->is_alphx = joe_iswalpha;
+       map->is_alnux = joe_iswalnum;
        map->to_lower = joe_towlower;
        map->to_upper = joe_towupper;
        map->next = charmaps;
index e3a9598..6325e33 100644 (file)
--- a/charmap.h
+++ b/charmap.h
@@ -10,7 +10,7 @@
 #define _Icharmap 1
 
 #ifdef EXTERN
-__IDSTRING(rcsid_charmap_h, "$MirOS: contrib/code/jupp/charmap.h,v 1.9 2017/12/02 17:00:48 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/charmap.h,v 1.10 2017/12/04 21:53:34 tg Exp $");
 #endif
 
 /* For sorted from_map entries */
@@ -33,8 +33,8 @@ struct charmap {
        int (*is_punct)(struct charmap *map,int c);
        int (*is_print)(struct charmap *map,int c);
        int (*is_space)(struct charmap *map,int c);
-       int (*is_alpha_)(struct charmap *map,int c);
-       int (*is_alnum_)(struct charmap *map,int c);
+       int (*is_alphx)(struct charmap *map,int c);
+       int (*is_alnux)(struct charmap *map,int c);
 
        /* Character conversion functions */
 
@@ -55,8 +55,8 @@ struct charmap {
        int from_size;                  /* No. pairs in from_map */
 
        unsigned char print_map[32];    /* Bit map of printable characters */
-       unsigned char alpha__map[32];   /* Bit map of alphabetic characters and _ */
-       unsigned char alnum__map[32];   /* Bit map of alphanumeric characters and _ */
+       unsigned char alphx_map[32];    /* Bit map of alphabetic characters and _ */
+       unsigned char alnux_map[32];    /* Bit map of alphanumeric characters and _ */
 };
 
 /* Predicates */
@@ -64,8 +64,8 @@ struct charmap {
 #define joe_ispunct(map,c) ((map)->is_punct((map),(c)))
 #define joe_isprint(map,c) ((map)->is_print((map),(c)))
 #define joe_isspace(map,c) ((map)->is_space((map),(c)))
-#define joe_isalpha_(map,c) ((map)->is_alpha_((map),(c)))
-#define joe_isalnum_(map,c) ((map)->is_alnum_((map),(c)))
+#define joe_isalphx(map,c) ((map)->is_alphx((map),(c)))
+#define joe_isalnux(map,c) ((map)->is_alnux((map),(c)))
 int joe_isblank PARAMS((struct charmap *map,int c));
 int joe_isspace_eof PARAMS((struct charmap *map,int c));
 
index a1467b5..e57bc94 100644 (file)
--- a/config.h
+++ b/config.h
 #endif
 #define NO_MORE_DATA EOF
 
-#if defined __MSDOS__ && SIZEOF_INT == 2 /* real mode ms-dos compilers */
-#if SIZEOF_VOID_P == 4 /* real mode ms-dos compilers with 'far' memory model or something like that */
-#define physical(a)  (((unsigned long)(a)&0xFFFF)+(((unsigned long)(a)&0xFFFF0000)>>12))
-#define normalize(a) ((void *)(((unsigned long)(a)&0xFFFF000F)+(((unsigned long)(a)&0x0000FFF0)<<12)))
-#else
-#define physical(a) ((unsigned long)(a))
-#define normalize(a) (a)
-#endif /* sizeof(void *) == 4 */
-
-#define SEGSIZ 1024
-#define PGSIZE 1024
-#define LPGSIZE 10
-#define ILIMIT (PGSIZE*96L)
-#define HTSIZE 128
-
-#else /* not real mode ms-dos */
-
-#define physical(a) ((unsigned long)(a))
-#define normalize(a) (a)
 #ifdef PAGE_SIZE
 #define PGSIZE PAGE_SIZE
 #else
 #define ILIMIT (PGSIZE*1024)
 #define HTSIZE 2048
 
-#endif /* real mode ms-dos */
-
 #if !defined(__GNUC__) && !defined(__attribute__)
 #define __attribute__(p) /* nothing */
 #endif
 
-#define ATTR_UNUSED    __attribute__((__unused__))
-
 #ifdef HAVE_GCC_ATTRIBUTE_BOUNDED
 #define ATTR_BOUNDED(p)        __attribute__((__bounded__ p))
 #else
@@ -160,7 +137,7 @@ size_t strlcpy(char *, const char *, size_t)
 #endif
 
 #ifdef EXTERN
-__IDSTRING(rcsid_config_h, "$MirOS: contrib/code/jupp/config.h,v 1.11 2017/12/03 02:36:01 tg Exp $");
+__IDSTRING(rcsid_config_h, "$MirOS: contrib/code/jupp/config.h,v 1.12 2017/12/04 22:15:38 tg Exp $");
 #endif
 
 #endif /* ifndef _JOE_CONFIG_H */
index 56e3015..a6f40c5 100644 (file)
@@ -1,4 +1,4 @@
-# $MirOS: contrib/code/jupp/configure.ac,v 1.62 2017/12/03 01:11:49 tg Exp $
+# $MirOS: contrib/code/jupp/configure.ac,v 1.63 2017/12/04 21:46:21 tg Exp $
 #-
 # Process this file with autoconf to produce a configure script.
 
@@ -65,6 +65,10 @@ AC_ARG_ENABLE(terminfo,
 [  --disable-terminfo      disable use of terminfo functions],
        terminfo=$enableval, terminfo=yes)
 
+AC_ARG_ENABLE(selinux,
+[  --disable-selinux       disable SELinux context copying],
+       selinux=$enableval, selinux=yes)
+
 AC_ARG_ENABLE([search_libs],
 [  --disable-search-libs   do not search in any external libraries],
        search_libs=$enableval, search_libs=yes)
@@ -84,7 +88,11 @@ else
        AC_SEARCH_LIBS(tgetflag, $search_libs_term, AC_DEFINE_UNQUOTED(TERMINFO, 1, [If we have newer terminfo/termcap capabilities]))
 fi
 AC_SEARCH_LIBS(snprintf, $search_libs_snprintf, AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [If we have snprintf]))
-AC_SEARCH_LIBS(is_selinux_enabled, $search_libs_selinux, AC_DEFINE_UNQUOTED(HAVE_SELINUX_FUN, 1, [We have SELinux functions]))
+if test x"$selinux" = x"no"; then
+       echo "DISabling looking for SELinux support"
+else
+       AC_SEARCH_LIBS(is_selinux_enabled, $search_libs_selinux, AC_DEFINE_UNQUOTED(HAVE_SELINUX_FUN, 1, [We have SELinux functions]))
+fi
 
 
 # other conditionals
@@ -167,11 +175,6 @@ AC_HEADER_TIOCGWINSZ
 
 AC_HEADER_TIME
 
-if test "$ac_cv_header_selinux_selinux_h" = "yes" -a "$ac_cv_header_selinux_context_h" = "yes" ; then
-       echo "Enabling SELinux context copying!"
-       AC_DEFINE(HAVE_SELINUX_HDR, 1, [We have SELinux headers])
-fi
-
 # Checks for typedefs, structures, and compiler characteristics.
 
 AC_C_PROTOTYPES
diff --git a/jupprc b/jupprc
index 2c7499c..6ca2fcb 100644 (file)
--- a/jupprc
+++ b/jupprc
  #HOOK#3102 filename matching
 
 {Basic
-\i   Help Screen    turn off with ^J     more help with ESC . (^[.)              \i
+\i   Help Screen    turn off with ^J     more help with Esc+. (^[.)              \i
 \i \i\u\bCURSOR\b\u           \u\bGOTO\b\u             \u\bBLOCK\b\u    \u\bDELETE\b\u    \u\bMISC\b\u         \u\bEXIT\b\u       \i \i
 \i \i^S left ^D right ^R  prev. screen ^KV move ^G  char  ^B  reformat ^KX save   \i \i
 \i \i^E up   ^X down  ^C  next screen  ^KC copy ^Y  line  ^V  overtype ^KQ abort  \i \i
 \i \i go to \uhttp://sf.net/projects/joe-editor/\u for upstream bug reports. JUPP 2.8 \i \i
 \i \i for DOS compiled by A. Totlis, packed with LHarc 2.13; JUPP 3.x for UNIX\d(R)\d \i \i
 \i \i at \uhttp://mirbsd.de/jupp\u and by \bThorsten "\dmirabilos\d" Glaser <\utg@mirbsd.org\u>\b \i \i
-\i \i @(#) jupprc 2017-11-31; 3.1; autoCR-LF; UTF-8 via locale; per-file encoding \i \i
+\i \i @(#) jupprc 2017-12-06; 3.1; autoCR-LF; UTF-8 via locale; per-file encoding \i \i
 }
 
  #HOOK#3103 additional help screens
@@ -580,11 +580,12 @@ keymap,"prompt",rtn                       ^D
 
 :main
 :inherit windows
-:def freedroidz splitw,prevw,scratch,"nbc-Output",rtn,nextw,save,markk,bol,markb,prevw,prevw,blkcpy,nextw,nextw,rtn,prevw,eol,"'",bol,qrepl,"'",rtn,rtn,"'\\\\''",rtn,"r",backs,backs,backs,bol,"LC_ALL=C; export LC_ALL; fn='",eol,rtn,"p=--posix; sed $p -e q </dev/null >/dev/null 2>&1 || p=; fns=$(echo \"$fn\" | sed $p -e 's\ 1[^^]\ 1[&]\ 1g; s\ 1\\^\ 1\\\\^\ 1g'); (case $fn in",rtn,"*.nxc) ;;",rtn,"*) echo '==> Error: filename not *.nxc'; exit ;;",rtn,"esac",rtn,"echo \"Compiling $fn\"",rtn,"nbc -sm- -d \"$fn\" 2>&1; x=$?",rtn,"if test $x = 0; then echo '==> OK'; else echo '==> Error code:' $x; fi",rtn,") | tr '\\n' '\ 1' | sed $p -e 's!\ 1# *\\([^\ 1]*\\)\ 1File \"[^\"]*/\\('\"$fns\"'\\)\" ; line \\([0-9]*\\)\ 1!\ 1\\2:\\3: \\1\ 1!g' -e 's!\ 1#\\([^\ 1]*\\)\ 1File \"\\([^\"]*\\)\" ; line \\([0-9]*\\)\ 1!\ 1\\2:\\3: \\1\ 1!g' | tr '\ 1' '\\n'",rtn,nmark,filt,"sh",rtn,rtn,"Press ^KQ to close this window!",rtn,parserr
+:def freedroidz splitw,prevw,scratch,"nbc-Output",rtn,nextw,save,markk,bol,markb,prevw,prevw,blkcpy,nextw,nextw,rtn,prevw,eol,"'",bol,qrepl,"'",rtn,rtn,"'\\\\''",rtn,"r",backs,backs,backs,bol,"LC_ALL=C; export LC_ALL; fn='",eol,"; p=--posix; sed $p -e q </dev/null >/dev/null 2>&1 || p=; r=$(sed $p -e 's\ 1[^^]\ 1[&]\ 1g; s\ 1\\^\ 1\\\\^\ 1g' <<EOF",rtn,"$fn",rtn,"EOF",rtn,"); (case $fn in *.nxc) ;; *) echo '==> Error: filename not *.nxc'; exit ;; esac; echo \"Compiling $fn\"; nbc -sm- -d \"$fn\" 2>&1; x=$?; if test $x = 0; then echo '==> OK'; else echo '==> Error code:' $x; fi) | tr '\\n' '\ 1' | sed $p -e 's!\ 1# *\\([^\ 1]*\\)\ 1File \"[^\"]*/\\('\"$r\"'\\)\" ; line \\([0-9]*\\)\ 1!\ 1\\2:\\3: \\1\ 1!g' -e 's!\ 1#\\([^\ 1]*\\)\ 1File \"\\([^\"]*\\)\" ; line \\([0-9]*\\)\ 1!\ 1\\2:\\3: \\1\ 1!g' | tr '\ 1' '\\n'",rtn,nmark,filt,"sh",rtn,rtn,"Press ^KQ to close this window!",rtn,parserr
 :def docompile edit,rtn,filt,query,parserr
+:def fixwhitespace eof," ",bof,"a",qrepl,"\\[",quote,"i",quote,"k",quote,"l",quote,"m ]\\+\\[",quote,"i",quote,"k",quote,"l",quote,"m ]\\$",rtn,rtn,rtn,"r",eof,rtn,ffirst,"\\^\\[^\\n]",rtn,"b",rtn,eol,markb,bof,delch,eof,markk,blkdel,ffirst,"\\?",rtn,"b",rtn,eol,rtn
+:def conflictmarker ffirst,"\\^\\[<>=]\\[<>=]\\[<>=]\\[<>=]\\[<>=]\\[<>=]\\[<>=]\\[ \\n]",rtn,rtn,ltarw
+:def pastemain helpcard,"Paste",rtn,keymap,"Paste",rtn
  #HOOK#3105 main keybindings
-eof," ",bof,qrepl,"\\[",quote,"i",quote,"k",quote,"l",quote,"m ]\\+\\[",quote,"i",quote,"k",quote,"l",quote,"m ]\\$",rtn,rtn,rtn,"r",eof,ffirst,"\\[^\\n]",rtn,"b",rtn,rtarw,rtn,markb,rtn,eof,markk,blkdel    ^K ]
-ffirst,"\\^\\[<>=]\\[<>=]\\[<>=]\\[<>=]\\[<>=]\\[<>=]\\[<>=]\\[ \\n]",rtn,rtn,ltarw                                                    ^Q =
 begin_marking,uparw,toggle_marking     ^[ [ 1 ; 2 A
 begin_marking,dnarw,toggle_marking     ^[ [ 1 ; 2 B
 begin_marking,rtarw,toggle_marking     ^[ [ 1 ; 2 C
@@ -593,11 +594,12 @@ begin_marking,bol,toggle_marking  ^[ [ 1 ; 2 H
 begin_marking,eol,toggle_marking       ^[ [ 1 ; 2 F
 begin_marking,bof,toggle_marking       ^[ [ 1 ; 6 H
 begin_marking,eof,toggle_marking       ^[ [ 1 ; 6 F
-:def pastemain helpcard,"Paste",rtn,keymap,"Paste",rtn
 pastemain      ^[ P
 pastemain      ^[ p
 pastemain      ^[ [ 2 0 0 ~
 nop            ^[ [ 2 0 1 ~
+fixwhitespace  ^K ]
+conflictmarker ^Q =
 backs          ^?
 backs          ^H
 backw          ^[ o
diff --git a/kbd.c b/kbd.c
index 45c43c6..f90deac 100644 (file)
--- a/kbd.c
+++ b/kbd.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/kbd.c,v 1.5 2017/12/02 02:07:28 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/kbd.c,v 1.6 2017/12/04 22:15:38 tg Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -159,73 +159,6 @@ static KMAP *kbuild(CAP *cap, KMAP *kmap, unsigned char *seq, void *bind, int *e
                for (x = 0; seq[x] && seq[x] != ' '; ++x) ;
                c = seq[x];
                seq[x] = 0;
-#ifdef __MSDOS__
-               if (!strcmp(seq + 1, "ku")) {
-                       capseq = "\0H";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "kd")) {
-                       capseq = "\0P";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "kl")) {
-                       capseq = "\0K";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "kr")) {
-                       capseq = "\0M";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "kI")) {
-                       capseq = "\0R";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "kD")) {
-                       capseq = "\0S";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "kh")) {
-                       capseq = "\0G";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "kH")) {
-                       capseq = "\0O";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "kP")) {
-                       capseq = "\0I";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "kN")) {
-                       capseq = "\0Q";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k1")) {
-                       capseq = "\0;";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k2")) {
-                       capseq = "\0<";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k3")) {
-                       capseq = "\0=";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k4")) {
-                       capseq = "\0>";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k5")) {
-                       capseq = "\0?";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k6")) {
-                       capseq = "\0@";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k7")) {
-                       capseq = "\0A";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k8")) {
-                       capseq = "\0B";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k9")) {
-                       capseq = "\0C";
-                       seql = 2;
-               } else if (!strcmp(seq + 1, "k0")) {
-                       capseq = "\0D";
-                       seql = 2;
-               }
-               seq[x] = c;
-               if (seql) {
-                       for (seq += x; *seq == ' '; ++seq) ;
-               }
-#else
                s = jgetstr(cap, seq + 1);
                seq[x] = c;
                if (s && (s = tcompile(cap, s, 0, 0, 0, 0))
@@ -233,9 +166,7 @@ static KMAP *kbuild(CAP *cap, KMAP *kmap, unsigned char *seq, void *bind, int *e
                        capseq = s;
                        seql = sLEN(s);
                        for (seq += x; *seq == ' '; ++seq) ;
-               }
-#endif
-               else {
+               } else {
                        *err = -2;
                        return kmap;
                }
diff --git a/macro.c b/macro.c
index a499502..f55f43d 100644 (file)
--- a/macro.c
+++ b/macro.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/macro.c,v 1.11 2017/12/02 04:32:40 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/macro.c,v 1.12 2017/12/06 16:37:40 tg Exp $");
 
 #include <string.h>
 #ifdef HAVE_STDLIB_H
@@ -168,16 +168,7 @@ MACRO *mparse(MACRO *m, unsigned char *buf, int *sta)
                                        buf[x] = 9;
                                        break;
                                case 'x':
-                                       c = 0;
-                                       if (buf[x + 1] >= '0' && buf[x + 1] <= '9')
-                                               c = c * 16 + buf[++x] - '0';
-                                       else if ((buf[x + 1] >= 'a' && buf[x + 1] <= 'f') || (buf[x + 1] >= 'A' && buf[x + 1] <= 'F'))
-                                               c = c * 16 + (buf[++x] & 0xF) + 9;
-                                       if (buf[x + 1] >= '0' && buf[x + 1] <= '9')
-                                               c = c * 16 + buf[++x] - '0';
-                                       else if ((buf[x + 1] >= 'a' && buf[x + 1] <= 'f') || (buf[x + 1] >= 'A' && buf[x + 1] <= 'F'))
-                                               c = c * 16 + (buf[++x] & 0xF) + 9;
-                                       buf[x] = c;
+                                       x += 1 + ustoc_hex(buf + x + 1, &c, USTOC_MAX);
                                        break;
                                case '0':
                                case '1':
@@ -189,12 +180,7 @@ MACRO *mparse(MACRO *m, unsigned char *buf, int *sta)
                                case '7':
                                case '8':
                                case '9':
-                                       c = buf[x] - '0';
-                                       if (buf[x + 1] >= '0' && buf[x + 1] <= '7')
-                                               c = c * 8 + buf[++x] - '0';
-                                       if (buf[x + 1] >= '0' && buf[x + 1] <= '7')
-                                               c = c * 8 + buf[++x] - '0';
-                                       buf[x] = c;
+                                       x += ustoc_oct(buf + x, &c, USTOC_MAX);
                                        break;
                                }
                        }
diff --git a/path.c b/path.c
index f811b25..f63a7b0 100644 (file)
--- a/path.c
+++ b/path.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/path.c,v 1.13 2017/12/02 02:07:29 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/path.c,v 1.14 2017/12/04 22:15:38 tg Exp $");
 
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
@@ -87,11 +87,7 @@ __RCSID("$MirOS: contrib/code/jupp/path.c,v 1.13 2017/12/02 02:07:29 tg Exp $");
 #define skip_drive_letter(path)        do_if_drive_letter((path), (path) += 2)
 
 #ifndef                _PATH_TMP
-#  ifdef __MSDOS__
-#    define    _PATH_TMP       ""
-#  else
 #    define    _PATH_TMP       "/tmp/"
-#  endif
 #endif
 
 #if !defined(PATH_MAX) && !defined(HAVE_GET_CURRENT_DIR_NAME)
@@ -327,47 +323,6 @@ int isreg(unsigned char *s)
        return 0;
 }
 /********************************************************************/
-#ifdef __MSDOS__
-#include <dos.h>
-#include <dir.h>
-
-struct direct {
-       unsigned char d_name[16];
-} direc;
-int dirstate = 0;
-struct ffblk ffblk;
-unsigned char *dirpath = NULL;
-
-void *opendir(unsigned char *path)
-{
-       dirstate = 0;
-       return &direc;
-}
-
-void closedir()
-{
-}
-
-struct direct *readdir()
-{
-       int x;
-
-       if (dirstate) {
-               if (findnext(&ffblk))
-                       return NULL;
-       } else {
-               if (findfirst("*.*", &ffblk, FA_DIREC))
-                       return NULL;
-               dirstate = 1;
-       }
-
-       strcpy(direc.d_name, ffblk.ff_name);
-       for (x = 0; direc.d_name[x]; ++x)
-               direc.d_name[x] = tolower(direc.d_name[x]);
-       return &direc;
-}
-#endif
-/********************************************************************/
 unsigned char **rexpnd(unsigned char *word)
 {
        void *dir;
@@ -401,34 +356,9 @@ int chJpwd(const unsigned char *path)
 
 int chpwd(const unsigned char *path)
 {
-#ifdef __MSDOS__
-       unsigned char buf[256];
-       int x;
-
-       if (!path)
-               return 0;
-       if ((path[0]) && (path[1] == ':')) {
-               if (_chdrive(path[0] & 0x1F))
-                       return -1;
-               path += 2;
-       }
-       if (!path[0])
-               return 0;
-       strcpy(buf, path);
-       x = strlen(buf);
-       while (x > 1) {
-               --x;
-               if ((buf[x] == '/') || (buf[x] == '\\'))
-                       buf[x] = 0;
-               else
-                       break;
-       }
-       return chdir(buf);
-#else
        if ((!path) || (!path[0]))
                return 0;
        return chdir((char *)path);
-#endif
 }
 
 /* The pwd function */
diff --git a/rc.c b/rc.c
index 2d8ce4a..ffa2f3d 100644 (file)
--- a/rc.c
+++ b/rc.c
@@ -9,7 +9,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/rc.c,v 1.29 2017/12/03 02:36:02 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/rc.c,v 1.30 2017/12/04 22:15:38 tg Exp $");
 
 #include <string.h>
 #ifdef HAVE_STDLIB_H
@@ -100,11 +100,7 @@ OPTIONS pdefault = {
        0,              /* read only */
        0,              /* french spacing */
        0,              /* spaces */
-#ifdef __MSDOS__
-       1,              /* crlf */
-#else
        0,              /* crlf */
-#endif
        0,              /* Highlight */
        NULL,           /* Syntax name */
        NULL,           /* Syntax */
@@ -146,11 +142,7 @@ OPTIONS fdefault = {
        0,              /* read only */
        0,              /* french spacing */
        0,              /* spaces */
-#ifdef __MSDOS__
-       1,              /* crlf */
-#else
        0,              /* crlf */
-#endif
        0,              /* Highlight */
        NULL,           /* Syntax name */
        NULL,           /* Syntax */
@@ -930,11 +922,7 @@ int procrc(CAP *cap, unsigned char *name)
        int err = 0;            /* Set to 1 if there was a syntax error */
 
        strlcpy((char *)buf, (char *)name, 1024);
-#ifdef __MSDOS__
-       fd = jfopen((char *)buf, "rt");
-#else
        fd = jfopen((char *)buf, "r");
-#endif
 
        if (!fd)
                return -1;      /* Return if we couldn't open the rc file */
diff --git a/regex.c b/regex.c
index 6fa4679..16a497e 100644 (file)
--- a/regex.c
+++ b/regex.c
@@ -8,17 +8,18 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/regex.c,v 1.7 2017/12/02 04:32:41 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/regex.c,v 1.9 2017/12/06 16:38:46 tg Exp $");
 
 #include "b.h"
 #include "charmap.h"
+#include "utils.h"
 #include "vs.h"
 
-int escape(int utf8_,unsigned char **a, int *b)
+int escape(int isutf8,unsigned char **a, int *b)
 {
        int c;
        unsigned char *s = *a;
-       int l = *b;
+       int l = *b, z;
 
        if (*s == '\\' && l >= 2) {
                ++s; --l;
@@ -67,45 +68,18 @@ int escape(int utf8_,unsigned char **a, int *b)
                case '5':
                case '6':
                case '7':
-                       c = *s - '0';
-                       ++s; --l;
-                       if (l > 0 && *s >= '0' && *s <= '7') {
-                               c = c * 8 + s[1] - '0';
-                               ++s; --l;
-                       }
-                       if (l > 0 && *s >= '0' && *s <= '7') {
-                               c = c * 8 + s[1] - '0';
-                               ++s; --l;
-                       }
+                       z = ustoc_oct(s, &c, l);
+                       s += z;
+                       l -= z;
                        break;
                case 'x':
                case 'X':
-                       c = 0;
-                       ++s; --l;
-                       if (l > 0 && *s >= '0' && *s <= '9') {
-                               c = c * 16 + *s - '0';
-                               ++s; --l;
-                       } else if (l > 0 && *s >= 'A' && *s <= 'F') {
-                               c = c * 16 + *s - 'A' + 10;
-                               ++s; --l;
-                       } else if (l > 0 && *s >= 'a' && *s <= 'f') {
-                               c = c * 16 + *s - 'a' + 10;
-                               ++s; --l;
-                       }
-
-                       if (l > 0 && *s >= '0' && *s <= '9') {
-                               c = c * 16 + *s - '0';
-                               ++s; --l;
-                       } else if (l > 0 && *s >= 'A' && *s <= 'F') {
-                               c = c * 16 + *s - 'A' + 10;
-                               ++s; --l;
-                       } else if (l > 0 && *s >= 'a' && *s <= 'f') {
-                               c = c * 16 + *s - 'a' + 10;
-                               ++s; --l;
-                       }
+                       z = ustoc_hex(s, &c, l);
+                       s += z;
+                       l -= z;
                        break;
                default:
-                       if (utf8_)
+                       if (isutf8)
                                c = utf8_decode_fwrd(&s, &l);
                        else {
                                c = *s++;
@@ -113,7 +87,7 @@ int escape(int utf8_,unsigned char **a, int *b)
                        }
                        break;
                }
-       } else if (utf8_) {
+       } else if (isutf8) {
                c = utf8_decode_fwrd(&s,&l);
        } else {
                c = *s++;
@@ -124,7 +98,7 @@ int escape(int utf8_,unsigned char **a, int *b)
        return c;
 }
 
-static int brack(int utf8_,unsigned char **a, int *la, int c)
+static int brack(int isutf8,unsigned char **a, int *la, int c)
 {
        int inverse = 0;
        int flag = 0;
@@ -152,12 +126,12 @@ static int brack(int utf8_,unsigned char **a, int *la, int c)
                } else {
                        int cl, cr;
 
-                       cl = escape(utf8_, &s, &l);
+                       cl = escape(isutf8, &s, &l);
 
                        if (l >= 2 && s[0] == '-' && s[1] != ']') {
                                --l;
                                ++s;
-                               cr = escape(utf8_, &s, &l);
+                               cr = escape(isutf8, &s, &l);
                                if (c >= cl && c <= cr)
                                        flag = 1;
                        } else if (c == cl)
@@ -171,13 +145,13 @@ static int brack(int utf8_,unsigned char **a, int *la, int c)
                return flag;
 }
 
-static void savec(int utf8_,unsigned char **pieces, int n, int c)
+static void savec(int isutf8,unsigned char **pieces, int n, int c)
 {
        unsigned char buf[16];
        int len;
        unsigned char *s = NULL;
 
-       if (utf8_)
+       if (isutf8)
                len = utf8_encode(buf,c);
        else {
                buf[0] = c;
@@ -243,7 +217,7 @@ static int skip_special(P *p)
                goto skip;
        case '{':
                to = '}';
-skip:
+ skip:
                do {
                        s = skip_special(p);
                } while (s != to && s != NO_MORE_DATA);
@@ -273,14 +247,14 @@ int pmatch(unsigned char **pieces, unsigned char *regex, int len, P *p, int n, i
        int c, d;
        P *q = pdup(p);
        P *o = NULL;
-       int utf8_ = p->b->o.charmap->type;
+       int isutf8 = p->b->o.charmap->type;
        struct charmap *map = p->b->o.charmap;
        struct utf8_sm sm;
 
        utf8_init(&sm);
 
        while (len) {
-               if (utf8_) {
+               if (isutf8) {
                        do {
                                c = utf8_decode(&sm,*regex++);
                                --len;
@@ -301,7 +275,7 @@ int pmatch(unsigned char **pieces, unsigned char *regex, int len, P *p, int n, i
                                d = pgetc(p);
                                if (d == NO_MORE_DATA)
                                        goto fail;
-                               savec(utf8_, pieces, n++, d);
+                               savec(isutf8, pieces, n++, d);
                                break;
                        case 'n':
                        case 'r':
@@ -324,7 +298,7 @@ int pmatch(unsigned char **pieces, unsigned char *regex, int len, P *p, int n, i
                        case '9':
                                regex -= 2;
                                len += 2;
-                               if (pgetc(p) != escape(utf8_, &regex, &len))
+                               if (pgetc(p) != escape(isutf8, &regex, &len))
                                        goto fail;
                                break;
                        case '*':
@@ -355,9 +329,9 @@ int pmatch(unsigned char **pieces, unsigned char *regex, int len, P *p, int n, i
                                d = pgetc(p);
                                if (d == NO_MORE_DATA)
                                        goto fail;
-                               if (!brack(utf8_, &regex, &len, d))
+                               if (!brack(isutf8, &regex, &len, d))
                                        goto fail;
-                               savec(utf8_, pieces, n++, d);
+                               savec(isutf8, pieces, n++, d);
                                break;
                        case '+':
                                {
@@ -381,13 +355,13 @@ int pmatch(unsigned char **pieces, unsigned char *regex, int len, P *p, int n, i
                                                if (regex[1] == '[') {
                                                        regex += 2;
                                                        len -= 2;
-                                                       brack(utf8_, &regex, &len, 0);
+                                                       brack(isutf8, &regex, &len, 0);
                                                } else {
-                                                       d = escape(utf8_, &regex, &len);
+                                                       d = escape(isutf8, &regex, &len);
                                                        if (icase)
                                                                d = joe_tolower(map,d);
                                                }
-                                       } else if (utf8_) {
+                                       } else if (isutf8) {
                                                if ((d = utf8_decode_fwrd(&regex, &len)) < 0)
                                                        goto done;
                                                else if (icase)
@@ -423,7 +397,7 @@ int pmatch(unsigned char **pieces, unsigned char *regex, int len, P *p, int n, i
                                                        if (oregex[1] == '[') {
                                                                tregex += 2;
                                                                tlen -= 2;
-                                                               match = brack(utf8_, &tregex, &tlen, c);
+                                                               match = brack(isutf8, &tregex, &tlen, c);
                                                        } else
                                                                match = (d == c);
                                                } else {
@@ -433,8 +407,7 @@ int pmatch(unsigned char **pieces, unsigned char *regex, int len, P *p, int n, i
                                                                match = (c == d);
                                                }
                                        } while (c != NO_MORE_DATA && match);
-
-                                     done:
+ done:
                                        if (r) {
                                                pset(p, r);
                                                prm(r);
@@ -480,13 +453,13 @@ int pmatch(unsigned char **pieces, unsigned char *regex, int len, P *p, int n, i
                        }
                }
        }
-succeed:
+ succeed:
        if (o)
                prm(o);
        prm(q);
        return 1;
 
-fail:
+ fail:
        if (o)
                prm(o);
        pset(p, q);
diff --git a/scrn.c b/scrn.c
index d5cf106..071fdd2 100644 (file)
--- a/scrn.c
+++ b/scrn.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/scrn.c,v 1.30 2017/12/02 04:49:46 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/scrn.c,v 1.31 2017/12/04 22:15:39 tg Exp $");
 
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
@@ -1557,7 +1557,7 @@ void nscroll(SCRN *t)
 
        for (y = 0; y != t->li; ++y) {
                q = t->sary[y];
-               if (ifhave)
+               if (have)
                        return;
                if (q && q != t->li) {
                        if (q > 0) {
diff --git a/scrn.h b/scrn.h
index f3e8288..ca3bc18 100644 (file)
--- a/scrn.h
+++ b/scrn.h
@@ -9,7 +9,7 @@
 #define _JOE_SCRN_H 1
 
 #ifdef EXTERN
-__IDSTRING(rcsid_scrn_h, "$MirOS: contrib/code/jupp/scrn.h,v 1.7 2017/12/02 17:00:50 tg Exp $");
+__IDSTRING(rcsid_scrn_h, "$MirOS: contrib/code/jupp/scrn.h,v 1.8 2017/12/04 22:15:39 tg Exp $");
 #endif
 
 #include "tty.h"               /* ttputc() */
@@ -72,24 +72,6 @@ void utf8_putc PARAMS((int c));
 
 /* Character attribute bits */
 
-#ifdef __MSDOS__
-
-#define INVERSE 1
-#define UNDERLINE 2
-#define BOLD 4
-#define BLINK 8
-#define DIM 16
-extern unsigned atab[];
-
-#define outatr(t,scrn,attr,x,y,c,a) do { \
-       (t); \
-       (x); \
-       (y); \
-       *(scrn) = ((unsigned)(c) | atab[a]); \
-} while(0)
-
-#else
-
 #define INVERSE                 256
 #define UNDERLINE       512
 #define BOLD           1024
@@ -131,8 +113,6 @@ extern unsigned atab[];
 
 void outatr PARAMS((struct charmap *map,SCRN *t,int *scrn,int *attrf,int xx,int yy,int c,int a));
 
-#endif
-
 /*
  * translate character and its attribute into something printable
  */
index e86f08e..bd56e7b 100644 (file)
--- a/selinux.c
+++ b/selinux.c
@@ -1,8 +1,9 @@
 #include "config.h"
 
-__RCSID("$MirOS: contrib/code/jupp/selinux.c,v 1.8 2017/12/02 02:07:31 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/selinux.c,v 1.10 2017/12/04 21:46:21 tg Exp $");
 
-#if defined(HAVE_SELINUX_HDR) && defined(HAVE_SELINUX_FUN)
+#if defined(HAVE_SELINUX_CONTEXT_H) && defined(HAVE_SELINUX_SELINUX_H) && \
+    defined(HAVE_SELINUX_FUN)
 #define WITH_SELINUX
 #else
 #undef WITH_SELINUX
@@ -49,14 +50,8 @@ copy_security_context(const char *from_file, const char *to_file)
        }
 
        if (getfilecon(to_file, &to_context) < 0) {
-#ifdef _
-               MSG_PUTS(_("\nCould not get security context for "));
-               msg_outtrans(to_file);
-               msg_putchar('\n');
-#else
                warn("Could not get security context for %s",
                    to_file);
-#endif
                freecon(from_context);
                return 1;
        }
index 787cfbc..fccdac7 100644 (file)
@@ -1,4 +1,4 @@
-# $MirOS: contrib/code/jupp/syntax/c.jsf.in,v 1.8 2017/12/02 05:38:05 tg Exp $
+# $MirOS: contrib/code/jupp/syntax/c.jsf.in,v 1.9 2017/12/02 22:24:07 tg Exp $
 #-
 # JOE syntax highlight file for C and C++
 
@@ -91,6 +91,7 @@
 =Idle
 =Bad           bold red
 =Preproc       yellow
+=PpCond                red
 =Define                bold blue
 =Comment       green
 =IncLocal      cyan
 :preident Preproc
        *               preproc         noeat strings
        "define"        predef
+       "elif"          preif
+       "if"            preif
+       "ifdef"         predef
+       "ifndef"        predef
        "include"       preinc
+       "undef"         predef
 done
        "a-z"           preident
 
@@ -146,7 +152,6 @@ done
        *               prebad
        "\n"            reset
 
-
 :predef Preproc
        *               predef
        " \t"           predef_ws
@@ -161,6 +166,28 @@ done
        *               idle            noeat
        "a-zA-Z0-9_"    predef_ident
 
+:preif Preproc
+       *               preif
+       " \t"           preif_ws
+       "\n"            reset
+
+:preif_ws Preproc
+       *               preif_cond      recolor=-1
+       " \t"           preif_ws
+
+:preif_cond PpCond
+       *               preif_cond
+       "\\"            preif_cont
+       "/"             preif_slash
+       "\n"            reset
+
+:preif_slash Preproc
+       *               preif_cond      noeat
+       "*"             comment         recolor=-2
+       "/"             line_comment    recolor=-2
+
+:preif_cont PpCond
+       *               preif_cond
 
 :preproc Preproc
        *               preproc
index 1891517..c11e0a0 100644 (file)
--- a/termcap.c
+++ b/termcap.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/termcap.c,v 1.17 2017/12/03 02:36:02 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/termcap.c,v 1.18 2017/12/06 16:37:40 tg Exp $");
 
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
@@ -455,6 +455,7 @@ void rmcap(CAP *cap)
 static unsigned char escape(unsigned char **s)
 {
        unsigned char c = *(*s)++;
+       int i;
 
        if (c == '^' && **s)
                if (**s != '?')
@@ -473,12 +474,9 @@ static unsigned char escape(unsigned char **s)
                case '5':
                case '6':
                case '7':
-                       c -= '0';
-                       if (**s >= '0' && **s <= '7')
-                               c = (c << 3) + *((*s)++) - '0';
-                       if (**s >= '0' && **s <= '7')
-                               c = (c << 3) + *((*s)++) - '0';
-                       return c;
+                       (*s)--;
+                       *s += ustoc_oct(*s, &i, USTOC_MAX);
+                       return i;
                case 'e':
                case 'E':
                        return 27;
diff --git a/tty.h b/tty.h
index 60b2be6..6909527 100644 (file)
--- a/tty.h
+++ b/tty.h
@@ -9,7 +9,7 @@
 #define _JOE_TTY_H 1
 
 #ifdef EXTERN_CMD_C
-__IDSTRING(rcsid_tty_h, "$MirOS: contrib/code/jupp/tty.h,v 1.10 2017/12/02 17:00:50 tg Exp $");
+__IDSTRING(rcsid_tty_h, "$MirOS: contrib/code/jupp/tty.h,v 1.11 2017/12/04 22:15:39 tg Exp $");
 #endif
 
 /* void ttopen(void);  Open the tty (attached to stdin) for use inside of JOE
@@ -130,22 +130,12 @@ int ttflsh PARAMS((void));
 extern int have;
 extern int leave;
 
-#ifdef __MSDOS__
-#define ifhave bioskey(1)
-#else
-#define ifhave have
-#endif
-
 /* void ttsig(int n);  Signal handler you provide.  This is called if the
  * editor gets a hangup signal, termination signal or if the input closes.
  * It is called with 'n' set to the number of the caught signal or 0 if the
  * input closed.
  */
-RETSIGTYPE ttsig PARAMS((int sig))
-#ifdef __GNUC__
-    __attribute__((__noreturn__))
-#endif
-    ;
+RETSIGTYPE ttsig PARAMS((int sig)) __attribute__((__noreturn__));
 
 /* void ttgtsz(int *x,int *y);  Get size of screen from ttsize/winsize
  * structure */
diff --git a/types.h b/types.h
index e006dab..856dd51 100644 (file)
--- a/types.h
+++ b/types.h
@@ -2,7 +2,7 @@
 #define _JOE_TYPES_H
 
 #ifdef EXTERN
-__IDSTRING(rcsid_types_h, "$MirOS: contrib/code/jupp/types.h,v 1.18 2017/12/02 18:33:25 tg Exp $");
+__IDSTRING(rcsid_types_h, "$MirOS: contrib/code/jupp/types.h,v 1.19 2017/12/04 22:15:39 tg Exp $");
 #endif
 
 /* Prefix to make string constants unsigned */
@@ -335,23 +335,6 @@ struct hentry {
 };
 
 /* Each terminal has one of these */
-
-#ifdef __MSDOS__
-
-struct scrn {
-       int     li;             /* Height of screen */
-       int     co;             /* Width of screen */
-       short   *scrn;          /* Buffer */
-       int     scroll;
-       int     insdel;
-       int     *updtab;        /* Lines which need to be updated */
-       /* HIGHLIGHT_STATE *syntab; */ /* Syntax highlight state at start of each line */
-       int     *syntab;
-       int     *compose;
-       int     *sary;
-};
-
-#else
 struct scrn {
        CAP     *cap;           /* Termcap/Terminfo data */
 
@@ -462,7 +445,6 @@ struct scrn {
        struct hentry   *htab;
        struct hentry   *ary;
 };
-#endif
 
 
 struct sortentry {
index 6615960..17dfbf4 100644 (file)
--- a/ublock.c
+++ b/ublock.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/ublock.c,v 1.19 2017/12/02 18:50:03 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/ublock.c,v 1.20 2017/12/04 22:15:39 tg Exp $");
 
 #include <unistd.h>
 #ifdef HAVE_STDLIB_H
@@ -1116,10 +1116,6 @@ static int checkmark(BW *bw)
 
 int ufilt(BW *bw)
 {
-#ifdef __MSDOS__
-       msgnw(bw->parent, "Sorry, no sub-processes in DOS (yet)");
-       return -1;
-#else
        switch (checkmark(bw)) {
        case 0:
                if (wmkpw(bw->parent, US "Command to filter block through (^C to abort): ", &filthist, dofilt, NULL, NULL, utypebw, NULL, NULL, locale_map))
@@ -1136,7 +1132,6 @@ int ufilt(BW *bw)
                msgnw(bw->parent, US "No block");
                return -1;
        }
-#endif
 }
 
 /* Force region to lower case */
diff --git a/uedit.c b/uedit.c
index 8023df4..9c5f32f 100644 (file)
--- a/uedit.c
+++ b/uedit.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/uedit.c,v 1.21 2017/12/03 02:36:03 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/uedit.c,v 1.23 2017/12/04 22:15:40 tg Exp $");
 
 #include <string.h>
 
@@ -191,15 +191,15 @@ int u_goto_prev(BW *bw)
        struct charmap *map=bw->b->o.charmap;
        int c = prgetc(p);
 
-       if (joe_isalnum_(map,c)) {
-               while (joe_isalnum_(map,(c=prgetc(p))))
+       if (joe_isalnux(map,c)) {
+               while (joe_isalnux(map,(c=prgetc(p))))
                        /* Do nothing */;
                if (c != NO_MORE_DATA)
                        pgetc(p);
        } else if (joe_isspace(map,c) || joe_ispunct(map,c)) {
                while ((c=prgetc(p)), (joe_isspace(map,c) || joe_ispunct(map,c)))
                        /* Do nothing */;
-               while(joe_isalnum_(map,(c=prgetc(p))))
+               while(joe_isalnux(map,(c=prgetc(p))))
                        /* Do nothing */;
                if (c != NO_MORE_DATA)
                        pgetc(p);
@@ -228,14 +228,14 @@ int u_goto_next(BW *bw)
        int c = brch(p);
        int rtn = -1;
 
-       if (joe_isalnum_(map,c)) {
+       if (joe_isalnux(map,c)) {
                rtn = 0;
-               while (joe_isalnum_(map,(c = brch(p))))
+               while (joe_isalnux(map,(c = brch(p))))
                        pgetc(p);
        } else if (joe_isspace(map,c) || joe_ispunct(map,c)) {
                while (joe_isspace(map, (c = brch(p))) || joe_ispunct(map,c))
                        pgetc(p);
-               while (joe_isalnum_(map,(c = brch(p)))) {
+               while (joe_isalnux(map,(c = brch(p)))) {
                        rtn = 0;
                        pgetc(p);
                }
@@ -869,8 +869,8 @@ int u_word_delete(BW *bw)
        struct charmap *map=bw->b->o.charmap;
        int c = brch(p);
 
-       if (joe_isalnum_(map,c))
-               while (joe_isalnum_(map,(c = brch(p))))
+       if (joe_isalnux(map,c))
+               while (joe_isalnux(map,(c = brch(p))))
                        pgetc(p);
        else if (joe_isspace(map,c))
                while (joe_isspace(map,(c = brch(p))))
@@ -897,8 +897,8 @@ int ubackw(BW *bw)
        int c = prgetc(bw->cursor);
        struct charmap *map=bw->b->o.charmap;
 
-       if (joe_isalnum_(map,c)) {
-               while (joe_isalnum_(map,(c = prgetc(bw->cursor))))
+       if (joe_isalnux(map,c)) {
+               while (joe_isalnux(map,(c = prgetc(bw->cursor))))
                        /* do nothing */;
                if (c != NO_MORE_DATA)
                        pgetc(bw->cursor);
@@ -1126,7 +1126,6 @@ int utypebw_raw(BW *bw, int k, int no_decode)
                }
 
                bw->cursor->xcol = piscol(bw->cursor);
-#ifndef __MSDOS__
                if (x < 0 || x >= bw->w)
                        simple = 0;
                if (bw->cursor->line < bw->top->line || bw->cursor->line >= bw->top->line + bw->h)
@@ -1162,7 +1161,6 @@ int utypebw_raw(BW *bw, int k, int no_decode)
                                atr = INVERSE;
                        outatr(bw->b->o.charmap, t, screen + x, attr + x, x, y, no_decode == 2 ? 0xFFFD : k, atr);
                }
-#endif
        }
        return 0;
 }
index b3e70f4..ad55856 100644 (file)
--- a/uerror.c
+++ b/uerror.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/uerror.c,v 1.7 2017/12/03 02:36:03 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/uerror.c,v 1.8 2017/12/04 21:53:34 tg Exp $");
 
 #include "b.h"
 #include "bw.h"
@@ -134,10 +134,10 @@ static int parseit(struct charmap *map,unsigned char *s, long int row)
 
        do {
                /* Skip to first word */
-               for (x = y; s[x] && !(joe_isalnum_(map,s[x]) || s[x] == '.' || s[x] == '/'); ++x) ;
+               for (x = y; s[x] && !(joe_isalnux(map,s[x]) || s[x] == '.' || s[x] == '/'); ++x) ;
 
                /* Skip to end of first word */
-               for (y = x; joe_isalnum_(map,s[y]) || s[y] == '.' || s[y] == '/'; ++y)
+               for (y = x; joe_isalnux(map,s[y]) || s[y] == '.' || s[y] == '/'; ++y)
                        if (s[y] == '.')
                                flg = 1;
        } while (!flg && x!=y);
index 8f2405f..bc0d77f 100644 (file)
--- a/usearch.c
+++ b/usearch.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/usearch.c,v 1.12 2017/12/02 18:50:04 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/usearch.c,v 1.15 2017/12/04 22:00:43 tg Exp $");
 
 #include <stdlib.h>
 
@@ -67,7 +67,7 @@ unsigned char **get_word_list(B *b,int ignore)
        idx = 0;
        while ((c=pgetc(p))!=NO_MORE_DATA)
                if (idx) {
-                       if (joe_isalnum_(b->o.charmap, c)) {
+                       if (joe_isalnux(b->o.charmap, c)) {
                                if (idx!=MAX_WORD_SIZE)
                                        buf[idx++] = c;
                        } else {
@@ -82,7 +82,7 @@ unsigned char **get_word_list(B *b,int ignore)
                        }
                } else {
                        start=p->byte-1;
-                       if (joe_isalpha_(b->o.charmap, c))
+                       if (joe_isalphx(b->o.charmap, c))
                                buf[idx++] = c;
                }
        prm(p);
@@ -91,7 +91,7 @@ unsigned char **get_word_list(B *b,int ignore)
                for (t = h->tab[idx];t;t=t->next)
                        list = vaadd(list, t->name);
        if (list)
-               vasort(list,sLEN(list));        
+               vasort(list,sLEN(list));
 
        htrm(h);
 
@@ -105,7 +105,7 @@ void fcmplt_ins(BW *bw, unsigned char *line)
 
        if (!piseol(bw->cursor)) {
                c = brch(bw->cursor);
-               if (joe_isalnum_(bw->b->o.charmap,c))
+               if (joe_isalnux(bw->b->o.charmap,c))
                        return;
        }
 
@@ -114,7 +114,7 @@ void fcmplt_ins(BW *bw, unsigned char *line)
        p = pdup(bw->cursor);
        do
                c = prgetc(p);
-               while (joe_isalnum_(bw->b->o.charmap,c));
+               while (joe_isalnux(bw->b->o.charmap,c));
        if (c!=NO_MORE_DATA)
                pgetc(p);
 
@@ -161,7 +161,7 @@ int ufinish(BW *bw)
 
        if (!piseol(bw->cursor)) {
                c = brch(bw->cursor);
-               if (joe_isalnum_(bw->b->o.charmap,c))
+               if (joe_isalnux(bw->b->o.charmap,c))
                        return -1;
        }
 
@@ -170,7 +170,7 @@ int ufinish(BW *bw)
        p = pdup(bw->cursor);
        do
                c = prgetc(p);
-               while (joe_isalnum_(bw->b->o.charmap,c));
+               while (joe_isalnux(bw->b->o.charmap,c));
        if (c!=NO_MORE_DATA)
                pgetc(p);
 
@@ -262,7 +262,7 @@ static P *searchf(BW *bw,SRCH *srch, P *p)
        for (x = 0; x != sLEN(pattern) && pattern[x] != '\\' && (pattern[x]<128 || !p->b->o.charmap->type); ++x)
                if (srch->ignore)
                        pattern[x] = joe_tolower(p->b->o.charmap,pattern[x]);
      wrapped:
+ wrapped:
        while (srch->ignore ? pifind(start, pattern, x) : pfind(start, pattern, x)) {
                pset(end, start);
                pfwrd(end, (long) x);
@@ -319,7 +319,7 @@ static P *searchb(BW *bw,SRCH *srch, P *p)
                if (srch->ignore)
                        pattern[x] = joe_tolower(p->b->o.charmap,pattern[x]);
 
      wrapped:
+ wrapped:
        while (pbkwd(start, 1L)
               && (srch->ignore ? prifind(start, pattern, x) : prfind(start, pattern, x))) {
                pset(end, start);
@@ -440,8 +440,8 @@ static P *insert(SRCH *srch, P *p, unsigned char *s, int len)
                        len -= x;
                        s += x;
                } else if (len >= 2) {
-                       if (((s[1] >= 'a' && s[1] <= 'z') || (s[1] >= 'A' && s[1] <= 'Z'))
-                                && srch->pieces[(s[1] & 0x1f) - 1]) {
+                       if (((s[1] >= 'a' && s[1] <= 'z') || (s[1] >= 'A' && s[1] <= 'Z')) &&
+                           srch->pieces[(s[1] & 0x1f) - 1]) {
                                binsm(p, sv(srch->pieces[(s[1] & 0x1f) - 1]));
                                pfwrd(p, (long) sLEN(srch->pieces[(s[1] & 0x1f) - 1]));
                                s += 2;
@@ -529,25 +529,20 @@ static int set_options(BW *bw, unsigned char *s, SRCH *srch, int *notify)
        srch->ignore = icase;
 
        for (x = 0; s[x]; ++x) {
-               switch (s[x]) {
+               switch (s[x] | 0x20) {
                case 'r':
-               case 'R':
                        srch->replace = 1;
                        break;
                case 'b':
-               case 'B':
                        srch->backwards = 1;
                        break;
                case 'i':
-               case 'I':
                        srch->ignore = 1;
                        break;
                case 's':
-               case 'S':
                        srch->ignore = 0;
                        break;
                case 'k':
-               case 'K':
                        srch->block_restrict = 1;
                        break;
                case '0':
@@ -718,19 +713,19 @@ static void goback(SRCH *srch, BW *bw)
 static int dopfrepl(BW *bw, int c, SRCH *srch, int *notify)
 {
        srch->addr = bw->cursor->byte;
-       if (c == 'N' || c == 'n')
+       if ((c | 0x20) == 'n')
                return dopfnext(bw, srch, notify);
-       else if (c == 'Y' || c == 'y' || c == ' ' || c == 'L' || c == 'l') {
+       else if ((c | 0x20) == 'y' || (c | 0x20) == 'l' || c == ' ') {
                srch->recs.link.prev->yn = 1;
                /* why do I return -1 on 'L' here? */
-               return ((doreplace(bw, srch) || c == 'L' || c == 'l') ?
+               return ((doreplace(bw, srch) || (c | 0x20) == 'l') ?
                    pfsave(bw, srch) : dopfnext(bw, srch, notify));
-       } else if (c == 'R' || c == 'r') {
+       } else if ((c | 0x20) == 'r') {
                if (doreplace(bw, srch))
                        return -1;
                srch->rest = 1;
                return dopfnext(bw, srch, notify);
-       } else if (c == 8 || c == 127 || c == 'b' || c == 'B') {
+       } else if (c == 8 || c == 127 || (c | 0x20) == 'b') {
                goback(srch, bw);
                goback(srch, bw);
                return dopfnext(bw, srch, notify);
@@ -797,14 +792,15 @@ static int fnext(BW *bw, SRCH *srch)
 {
        P *sta;
 
     next:
+ next:
        if (srch->repeat != -1) {
                if (!srch->repeat)
                        return 0;
                else
                        --srch->repeat;
        }
-      again:if (srch->backwards)
+ again:
+       if (srch->backwards)
                sta = searchb(bw, srch, bw->cursor);
        else
                sta = searchf(bw, srch, bw->cursor);
@@ -850,11 +846,13 @@ int dopfnext(BW *bw, SRCH *srch, int *notify)
                smode = 2;      /* We have started a search mode */
        if (srch->replace)
                visit(srch, bw, 0);
-again: switch (fnext(bw, srch)) {
+ again:
+       switch (fnext(bw, srch)) {
        case 0:
                break;
        case 1:
-bye:           if (!srch->flg && !srch->rest) {
+ bye:
+               if (!srch->flg && !srch->rest) {
                        if (srch->valid && srch->block_restrict)
                                msgnw(bw->parent, US "Not found (search restricted to marked block)");
                        else
@@ -927,20 +925,22 @@ bye:              if (!srch->flg && !srch->rest) {
 
 int pfnext(BW *bw)
 {
-       if (!globalsrch)        /* Query for search string if there isn't any */
+       SRCH *srch;
+
+       if (!globalsrch) {
+               /* Query for search string if there isn't any */
                return pffirst(bw);
-       else {
-               SRCH *srch = globalsrch;
+       }
 
-               globalsrch = NULL;
-               srch->addr = bw->cursor->byte;
-               if (!srch->wrap_p || srch->wrap_p->b!=bw->b) {
-                       prm(srch->wrap_p);
-                       srch->wrap_p = pdup(bw->cursor);
-                       srch->wrap_p->owner = &srch->wrap_p;
-                       srch->wrap_flag = 0;
-               }
-               srch->valid = 0;
-               return dopfnext(bw, setmark(srch), NULL);
+       srch = globalsrch;
+       globalsrch = NULL;
+       srch->addr = bw->cursor->byte;
+       if (!srch->wrap_p || srch->wrap_p->b!=bw->b) {
+               prm(srch->wrap_p);
+               srch->wrap_p = pdup(bw->cursor);
+               srch->wrap_p->owner = &srch->wrap_p;
+               srch->wrap_flag = 0;
        }
+       srch->valid = 0;
+       return dopfnext(bw, setmark(srch), NULL);
 }
diff --git a/utag.c b/utag.c
index 9ff0da0..4b8d95a 100644 (file)
--- a/utag.c
+++ b/utag.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/utag.c,v 1.6 2017/12/03 02:36:03 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/utag.c,v 1.7 2017/12/04 21:53:35 tg Exp $");
 
 #include "b.h"
 #include "bw.h"
@@ -132,18 +132,18 @@ int utag(BW *bw)
        BW *pbw;
 
        pbw = wmkpw(bw->parent, US "Tag search: ", &taghist, dotag, NULL, NULL, cmplt, NULL, NULL, locale_map);
-       if (pbw && joe_isalnum_(bw->b->o.charmap,brch(bw->cursor))) {
+       if (pbw && joe_isalnux(bw->b->o.charmap,brch(bw->cursor))) {
                P *p = pdup(bw->cursor);
                P *q = pdup(p);
                int c;
 
-               while (joe_isalnum_(bw->b->o.charmap,(c = prgetc(p))))
+               while (joe_isalnux(bw->b->o.charmap,(c = prgetc(p))))
                        /* do nothing */;
                if (c != NO_MORE_DATA) {
                        pgetc(p);
                }
                pset(q, p);
-               while (joe_isalnum_(bw->b->o.charmap,(c = pgetc(q))))
+               while (joe_isalnux(bw->b->o.charmap,(c = pgetc(q))))
                        /* do nothing */;
                if (c != NO_MORE_DATA) {
                        prgetc(q);
diff --git a/utils.c b/utils.c
index 7f09585..0bd9fde 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -8,7 +8,7 @@
  */
 #include "config.h"
 
-__RCSID("$MirOS: contrib/code/jupp/utils.c,v 1.7 2017/12/02 04:32:43 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/utils.c,v 1.8 2017/12/04 21:53:35 tg Exp $");
 
 #include <errno.h>
 #ifdef HAVE_UNISTD_H
@@ -121,11 +121,11 @@ int parse_ws(unsigned char **pp,int cmt)
 int parse_ident(unsigned char **pp, unsigned char *buf, int len)
 {
        unsigned char *p = *pp;
-       if (joe_isalpha_(locale_map,*p)) {
-               while(len && joe_isalnum_(locale_map,*p))
+       if (joe_isalphx(locale_map,*p)) {
+               while(len && joe_isalnux(locale_map,*p))
                        *buf++= *p++, --len;
                *buf=0;
-               while(joe_isalnum_(locale_map,*p))
+               while(joe_isalnux(locale_map,*p))
                        ++p;
                *pp = p;
                return 0;
@@ -153,7 +153,7 @@ int parse_kw(unsigned char **pp, unsigned char *kw)
        unsigned char *p = *pp;
        while(*kw && *kw==*p)
                ++kw, ++p;
-       if(!*kw && !joe_isalnum_(locale_map,*p)) {
+       if(!*kw && !joe_isalnux(locale_map,*p)) {
                *pp = p;
                return 0;
        } else
diff --git a/vfile.c b/vfile.c
index 9cc3df8..0bf5bc0 100644 (file)
--- a/vfile.c
+++ b/vfile.c
@@ -8,7 +8,7 @@
 #include "config.h"
 #include "types.h"
 
-__RCSID("$MirOS: contrib/code/jupp/vfile.c,v 1.11 2017/12/02 18:50:04 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/vfile.c,v 1.12 2017/12/04 22:15:40 tg Exp $");
 
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
@@ -122,7 +122,7 @@ static unsigned char *mema(int align, int size)
 {
        unsigned char *z = (unsigned char *) joe_malloc(align + size);
 
-       return z + align - physical(z) % align;
+       return z + (align - ((size_t)z % align));
 }
 
 unsigned char *vlock(VFILE *vfile, unsigned long addr)
@@ -156,18 +156,18 @@ unsigned char *vlock(VFILE *vfile, unsigned long addr)
                                if (!vheaders) {
                                        vheaders = (VPAGE **) joe_malloc((vheadsz = INC) * sizeof(VPAGE *));
                                        vbase = vp->data;
-                               } else if (physical(vp->data) < physical(vbase)) {
+                               } else if ((size_t)vp->data < (size_t)vbase) {
                                        VPAGE **t = vheaders;
-                                       int amnt = (physical(vbase) - physical(vp->data)) >> LPGSIZE;
+                                       int amnt = (((size_t)vbase) - ((size_t)vp->data)) >> LPGSIZE;
 
                                        vheaders = (VPAGE **) joe_malloc((amnt + vheadsz) * sizeof(VPAGE *));
                                        mmove(vheaders + amnt, t, vheadsz * sizeof(VPAGE *));
                                        vheadsz += amnt;
                                        vbase = vp->data;
                                        joe_free(t);
-                               } else if (((physical(vp->data + PGSIZE * INC) - physical(vbase)) >> LPGSIZE) > (unsigned long)vheadsz) {
+                               } else if (((((size_t)vp->data + PGSIZE * INC) - ((size_t)vbase)) >> LPGSIZE) > (unsigned long)vheadsz) {
                                        vheaders = (VPAGE **)
-                                           joe_realloc(vheaders, (vheadsz = (((physical(vp->data + PGSIZE * INC) - physical(vbase)) >> LPGSIZE))) * sizeof(VPAGE *));
+                                           joe_realloc(vheaders, (vheadsz = (((((size_t)vp->data + PGSIZE * INC) - ((size_t)vbase)) >> LPGSIZE))) * sizeof(VPAGE *));
                                }
                                for (q = 1; q != INC; ++q) {
                                        vp[q].next = freepages;
diff --git a/vfile.h b/vfile.h
index 915af67..e82eb97 100644 (file)
--- a/vfile.h
+++ b/vfile.h
@@ -9,7 +9,7 @@
 #define _JOE_VFILE_H 1
 
 #ifdef EXTERN
-__IDSTRING(rcsid_vfile_h, "$MirOS: contrib/code/jupp/vfile.h,v 1.5 2017/12/02 17:00:52 tg Exp $");
+__IDSTRING(rcsid_vfile_h, "$MirOS: contrib/code/jupp/vfile.h,v 1.6 2017/12/04 22:15:40 tg Exp $");
 #endif
 
 /* Additions:
@@ -100,7 +100,7 @@ unsigned char *vlock PARAMS((VFILE *vfile, unsigned long addr));
  * Return address of page header for given page
  */
 
-#define vheader(p) (vheaders[(physical((unsigned char *)(p))-physical(vbase))>>LPGSIZE])
+#define vheader(p) (vheaders[(((size_t)(unsigned char *)(p))-((size_t)vbase))>>LPGSIZE])
 
 /* void vchanged(char *);
  *