Start modernizing types and compilation options. - sam - An updated version of the sam text editor.
 (HTM) git clone git://vernunftzentrum.de/sam.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 6fc03e733b8ec8871ae9b16228a252724caed864
 (DIR) parent 3f0e640d1eaf110d015506181383979f0b10a230
 (HTM) Author: Rob King <jking@deadpixi.com>
       Date:   Tue, 30 Aug 2016 21:09:32 -0500
       
       Start modernizing types and compilation options.
       
       Diffstat:
         include/u.h                         |     121 +++----------------------------
         libXg/Makefile                      |      13 ++-----------
         libframe/Makefile                   |      12 ++----------
         rsam/Makefile                       |       4 ++--
         rsam/rsam.c                         |       1 -
         sam/Makefile                        |      14 ++------------
         sam/mesg.c                          |       4 ++--
         samterm/Makefile                    |      15 ++-------------
         samterm/mesg.c                      |       4 ++--
       
       9 files changed, 26 insertions(+), 162 deletions(-)
       ---
 (DIR) diff --git a/include/u.h b/include/u.h
       @@ -1,117 +1,20 @@
       -/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
       +#include <fcntl.h>
       +#include <setjmp.h>
       +#include <stdint.h>
       +#include <stdio.h>
        #include <stdlib.h>
        #include <string.h>
        #include <sys/types.h>
       -#include <setjmp.h>
       -#include <stdio.h>
        #include <unistd.h>
       -#include <fcntl.h>
       -#include <stdint.h>
       -
       -typedef unsigned short      ushort;
       -typedef unsigned long       ulong;
       -typedef unsigned char                uchar;
       -typedef        unsigned short                Rune;
       -
       -        /* System configuration parameters */
       -
       -#ifdef        SYSVR3
       -#include        <malloc.h>
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       -#define        remove(v)                        unlink(v)
       -#define        WEXITSTATUS(s)                        (((s)>>8)&0xFF)
       -extern        char *getenv(char*);
       -extern        char *getlogin(void);
       -extern        char *strerror(int);
       -extern        void *memmove(void*, const void*, size_t);
       -#define        NEEDMEMMOVE
       -#define        NEEDSTRERROR
       -#define        NEEDVARARG
       -#endif        /* SYSVR3 */
       -
       -#ifdef        IRIX5
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       -#endif        /* IRIX5 */
       +#include <wchar.h>
        
       -#ifdef        IRIX
       -extern        void *memmove(void*, const void*, size_t);
       -#define        NEEDMEMMOVE
       -#endif        /* IRIX */
       +typedef uint16_t ushort;
       +typedef uint8_t  uchar;
       +typedef wchar_t  Rune;
        
       -#ifdef        UMIPS
       -typedef unsigned long        ulong;
       -typedef        unsigned short        ushort;
       -#define        const                        /* mips compiler doesn't support const */
       -extern        char *strerror(int);
       -extern        void *memmove(void*, const void*, size_t);
       -#define        NEEDMEMMOVE
       -#define        NEEDSTRERROR
       -#define        NEEDVARARG
       -#define        NOFIFO                        /* turn off exstart in samterm/unix.c */
       -#endif        /* UMIPS */
       -
       -#ifdef        SUNOS
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       -extern        char *strerror(int);
       -extern        void *memmove(void*, const void*, size_t);
       -extern        void *memcpy(void*, const void*, size_t);
       -#define        NEEDMEMMOVE
       -#define        NEEDSTRERROR
       -#endif        /* SUNOS */
       -
       -#ifdef        SOLARIS
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       +#if USE64BITS == 0
       +typedef uint32_t ulong;
       +#else
       +typedef uint64_t ulong;
        #endif
        
       -#ifdef        AIX
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       -#endif        /* AIX */
       -
       -#ifdef        OSF1
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       -extern        void *memmove(void*, const void*, size_t);
       -#endif        /* OSF1 */
       -
       -#ifdef  HPUX
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       -#define        NEEDSTRERROR
       -#endif  /* HPUX */
       -
       -#ifdef  APOLLO
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       -#endif  /* APOLLO */
       -
       -#ifdef  CONVEX
       -typedef unsigned long        ulong;
       -#endif  /* CONVEX */
       -
       -#ifdef  DYNIX
       -#define        SIG_ERR                BADSIG
       -#define        NEEDMEMMOVE
       -#define        remove(v)                        unlink(v)
       -#define        WEXITSTATUS(s)                        (((s)>>8)&0xFF)
       -#define        NEEDMEMMOVE
       -#define        NOFIFO                        /* turn off exstart in samterm/unix.c */
       -#endif  /* DYNIX */
       -
       -#ifdef        PTX
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       -#endif        /* PTX */
       -
       -#ifdef        BSDi
       -typedef unsigned long   ulong;
       -#endif        /* BSDi */
       -
       -#ifdef        v10
       -typedef        unsigned short        ushort;
       -typedef unsigned long        ulong;
       -#endif
 (DIR) diff --git a/libXg/Makefile b/libXg/Makefile
       @@ -2,20 +2,11 @@
        #
        #        Prototype Makefile for libXg
        #
       -#        define operating system.  ONE of:
       -#                -DIRIX -DSUNOS -DUMIPS -DSYSVR3 -DAIX -DOSF1
       -#                -DHPUX -DAPOLLO -DCONVEX -DDYNIX
       -#        
       -#        Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
       -#        if your compiler supports posix-compatible compilation
        include ../config.mk
        
       -OS=-DIRIX5 
       -
        #        add -Iincludedir for any include directories that need to be searched
        INCS=-I../include
        
       -
        #        set this if your X libraries are in different locations
        #        or if you need extra libraries to load with X11 applications
        XLIBS=-lXt
       @@ -29,8 +20,8 @@ AR=ar
        #        the name of the library
        LIB=libXg.a
        
       -CFLAGS=$(OS) -D_LIBXG_EXTENSION $(INCS) $(INCLUDES)
       -CC?=gcc
       +CFLAGS=-D_POSIX_C_SOURCE=200809L -D_LIBXG_EXTENSION $(INCS) $(INCLUDES)
       +CC?=c99
        
        OBJS=        arc.o arith.o balloc.o bitblt.o bitbltclip.o border.o bscreenrect.o\
                circle.o clipline.o clipr.o copymasked.o cursorset.o cursorswitch.o\
 (DIR) diff --git a/libframe/Makefile b/libframe/Makefile
       @@ -2,16 +2,8 @@
        #
        #        Prototype Makefile for libframe
        #
       -#        define operating system.  ONE of:
       -#                -DIRIX -DSUNOS -DUMIPS -DSYSVR3 -DAIX -DOSF1
       -#                -DHPUX -DAPOLLO -DCONVEX -DDYNIX
       -#        
       -#        Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
       -#        if your compiler supports posix-compatible compilation
        include ../config.mk
        
       -OS=-DIRIX5 
       -
        #        add -Iincludedir for any include directories that need to be searched
        #        for posix header files (for UMIPS, add -I/usr/include/posix)
        INCS=-I../include
       @@ -23,10 +15,10 @@ RANLIB=:
        #        add name of library
        AR=ar
        
       -CFLAGS=-c $(OS) $(INCS) -D_LIBXG_EXTENSION $(INCLUDES)
       +CFLAGS=-c $(INCS) -D_POSIX_C_SOURCE=200809L -D_LIBXG_EXTENSION $(INCLUDES)
        
        LIB=libframe.a
       -CC?=gcc
       +CC?=c99
        
        OBJ=frbox.o frdelete.o frdraw.o frinit.o frinsert.o frptofchar.o\
                frselect.o frstr.o frutil.o misc.o
 (DIR) diff --git a/rsam/Makefile b/rsam/Makefile
       @@ -5,12 +5,12 @@
        include ../config.mk
        
        LDFLAGS=
       +CFLAGS=-D_POSIX_C_SOURCE=200809L
        
        all: rsam
        
        rsam: rsam.o
       -        $(CC) -o rsam rsam.o
       -
       +        $(CC) $(CFLAGS) -o rsam rsam.o
        
        clean:
                rm -f *.o rsam
 (DIR) diff --git a/rsam/rsam.c b/rsam/rsam.c
       @@ -3,7 +3,6 @@
         * No warranty is expressed or implied; use at your own risk.
         */
        
       -#define _POSIX_C_SOURCE 200112L
        #include <fcntl.h>
        #include <limits.h>
        #include <stdio.h>
 (DIR) diff --git a/sam/Makefile b/sam/Makefile
       @@ -2,18 +2,8 @@
        #
        #        Prototype Makefile for sam
        #
       -#        define operating system.  ONE of:
       -#                -DIRIX -DSUNOS -DUMIPS -DSYSVR3 -DAIX -DOSF1
       -#                -DHPUX -DAPOLLO -DCONVEX -DDYNIX
       -#
       -#        -DIRIX is the default and should actually work on any modern system.
       -#        Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
       -#        if your compiler supports posix-compatible compilation.
       -#
        include ../config.mk
        
       -OS=-DIRIX5
       -
        #        add -Iincludedir for any include directories that need to be searched
        #        for posix header files (for UMIPS, add -I/usr/include/posix)
        INCS=-I../include
       @@ -42,10 +32,10 @@ RXSAMNAME=rsam
        
        SAMSAVE=/bin/sh\\n$(SAMSAVEDIR)/samsave
        
       -CFLAGS=$(OS) -D_LIBXG_EXTENSION $(INCS) $(INCLUDES)
       +CFLAGS=-D_POSIX_C_SOURCE=200809L -D_LIBXG_EXTENSION $(INCS) $(INCLUDES)
        
        LIB=../libframe/libframe.a ../libXg/libXg.a
       -CC?=gcc 
       +CC?=c99
        
        OBJ=sam.o address.o buffer.o cmd.o disc.o error.o file.o io.o \
                list.o mesg.o moveto.o multi.o rasp.o regexp.o shell.o \
 (DIR) diff --git a/sam/mesg.c b/sam/mesg.c
       @@ -714,9 +714,9 @@ void
        outvlong(void *v)
        {
                int i;
       -        ulong l;
       +        uintptr_t l;
        
       -        l = (ulong) v;
       +        l = (uintptr_t)v;
                for(i = 0; i < 8; i++, l >>= 8)
                        *outp++ = l;
        }
 (DIR) diff --git a/samterm/Makefile b/samterm/Makefile
       @@ -2,24 +2,13 @@
        #
        #        Prototype Makefile for samterm
        #
       -#        define operating system.  ONE of:
       -#                -DIRIX -DSUNOS -DUMIPS -DSYSVR3 -DAIX -DOSF1
       -#                -DHPUX -DAPOLLO -DCONVEX -DDYNIX
       -#
       -#        -DIRIX is the default and should actually work on any modern system.
       -#        Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
       -#        if your compiler supports posix-compatible compilation.
       -#
        
        include ../config.mk
        
       -OS=-DIRIX5
       -
        #        add -Iincludedir for any include directories that need to be searched
        #        for posix header files (for UMIPS, add -I/usr/include/posix)
        INCS=-I../include
        
       -
        #        SAMTERM contains the name of the file containing the samterm
        #        executable.
        SAMTERM=$(BINDIR)/samterm
       @@ -28,10 +17,10 @@ SAMTERM=$(BINDIR)/samterm
        #        or if you need extra libraries to load with X11 applications
        XLIBS=-lXt -lX11 -lXft
        
       -CFLAGS=$(OS) $(INCS) -D_LIBXG_EXTENSION $(INCLUDES)
       +CFLAGS=$(INCS) -D_POSIX_C_SOURCE=200809L -D_LIBXG_EXTENSION $(INCLUDES)
        
        LIBS=../libframe/libframe.a ../libXg/libXg.a
       -CC?=gcc
       +CC?=c99
        
        OBJ=main.o flayer.o icons.o io.o menu.o mesg.o rasp.o scroll.o unix.o
        
 (DIR) diff --git a/samterm/mesg.c b/samterm/mesg.c
       @@ -504,10 +504,10 @@ void
        outvlong(void *v)
        {
                int i;
       -        ulong l;
       +        uintptr_t l;
                uchar buf[8];
        
       -        l = (ulong) v;
       +        l = (uintptr_t)v;
                for(i = 0; i < sizeof(buf); i++, l >>= 8)
                        buf[i] = l;