home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-10-20 | 40.2 KB | 1,658 lines |
- diff -cr ../mntlib37/Changelog ./Changelog
- *** ../mntlib37/Changelog Wed Oct 20 11:09:56 1993
- --- ./Changelog Wed Oct 20 03:48:16 1993
- ***************
- *** 4,9 ****
- --- 4,61 ----
- Changes are listed in *reverse* order, most recent changes being
- first.
-
- + PATCHLEVEL38::
- +
- + symlink.c:
- + Set errno properly for readlink() on a non-link (EINVAL not EACCES).
- + lattice/setjmp.s: ++pvt1-117
- + Add sigsetjmp() and siglongjmp() for lattice.
- + compiler.h: ++pvt1-117
- + Make LCC do the right thing in limits.h.
- + termios.h, tcattr.c:
- + Add VLNEXT and VWERASE control chars.
- + types.h: ++roemer@hera.rbi.informatik.uni-frankfurt.de.uni-frankfurt.de
- + Add fd_set type and related macros.
- + falcon.h: ++Markus_Kilbinger@ac.maus.de
- + Change return types of VsetMask() and Dsp_Reserve() from
- + void to short.
- + _mulsi3.s, _umulsi3.s: ++schwab
- + .lmul and .ulmul aren't equivalent.
- + read.c, write.c: ++schwab
- + Reduce drag. Also alias read to _read and write to _write
- + when __GNUC__ && !__MSHORT__.
- + popen.c: ++schwab
- + Reduce drag. Also simplify code by using waitpid().
- + open.c: ++schwab
- + Pass as many flags as possible through to MiNT, and let it decide
- + what to do with them. Only fall back on emulation if we can't pa a
- + given flag.
- + ioctl.c, stat.c: ++schwab
- + Reduce drag.
- + rename.c: ++schwab
- + Try to preserve the old file under the new name as long as possible,
- + in case an error occurs. Unfortunately we cannot determine exactly
- + why Frename() failed, so this is not perfect (bug?). Also, reduce
- + library drag.
- + alarm.c: ++schwab
- + Use Talarm() instead of alarm() to reduce drag. Also
- + fix a bug in the code for old versions of MiNT. [I messed with
- + this a lot to get some more error checking and also added some
- + comments. -entropy]
- + wait.h: ++schwab@ls5.informatik.uni-dortmund.de
- + Make the wait prototype indirection more robust. Also fix the
- + definition of WIFSIGNALED().
- + wait3.c:
- + Remove bogus usage of non-existent rusage value added in PL37.
- + falcon.h: ++pvt1-117
- + Inline traps for Lattice.
- + wcmb.c: ++pvt1-117
- + Use _wnull from wnull.c instead of a local variable.
- + wcscat.c, wcscmp.c, wcscpy.c, wcslen.c, wnull.c: ++pvt1-117
- + NEW files for ISO wide char support.
- + stdlib.h: ++pvt1-117@nada.kth.se
- + Add prototypes for new ISO widechar functions.
- +
- PATCHLEVEL37::
-
- bzero.cpp, mincl:
- ***************
- *** 59,65 ****
- bit.
- fscanf.c, scanf.c, sscanf.c, lib.h: ++schwab
- The implementation of sscanf had a bug: the ungetc function would
- ! write into the format string passed to sscanf. This is a Bad Thing,
- since the string could be in readonly memory. Also changed the
- interface a bit so that there is less need for casts. Strictly
- speaking, the old way of casting the function pointers can result in
- --- 111,117 ----
- bit.
- fscanf.c, scanf.c, sscanf.c, lib.h: ++schwab
- The implementation of sscanf had a bug: the ungetc function would
- ! write into the scanned string passed to sscanf. This is a Bad Thing,
- since the string could be in readonly memory. Also changed the
- interface a bit so that there is less need for casts. Strictly
- speaking, the old way of casting the function pointers can result in
- diff -cr ../mntlib37/Files ./Files
- *** ../mntlib37/Files Wed Oct 20 11:09:58 1993
- --- ./Files Mon Oct 18 11:07:10 1993
- ***************
- *** 9,19 ****
- _cmpsf2.cpp binmode.c ftw.c mktemp.c stricmp.c
- _divdf3.cpp bsearch.c fungetc.c modf.cpp strlen.c
- _divmods.s bzero.cpp fwrite.c nlist.c strlwr.c
- ! _divsf3.cpp calloc.c gbl-ctors.h strncat.c
- ! _extends.cpp chdir.c getbuf.c obstack.c strncmp.c
- ! _fixdfsi.cpp chmod.c getenv.c perror.c strncpy.c
- ! ctermid.c getlogin.c pgrp.c
- ! printf.c
- _fixsfsi.cpp ctime.c getopt.c psignal.c strnicmp.c
- _fltsi.cpp ctype.c getpass.c putenv.c strpbrk.c
- _fltsisf.cpp cuserid.c getpid.c qsort.c strrchr.c
- --- 9,18 ----
- _cmpsf2.cpp binmode.c ftw.c mktemp.c stricmp.c
- _divdf3.cpp bsearch.c fungetc.c modf.cpp strlen.c
- _divmods.s bzero.cpp fwrite.c nlist.c strlwr.c
- ! _divsf3.cpp calloc.c gbl-ctors.h obstack.c strncat.c
- ! _extends.cpp chdir.c getbuf.c perror.c strncmp.c
- ! _fixdfsi.cpp chmod.c getenv.c pgrp.c strncpy.c
- ! ctermid.c getlogin.c printf.c
- _fixsfsi.cpp ctime.c getopt.c psignal.c strnicmp.c
- _fltsi.cpp ctype.c getpass.c putenv.c strpbrk.c
- _fltsisf.cpp cuserid.c getpid.c qsort.c strrchr.c
- ***************
- *** 25,44 ****
- _negdf2.s eprintf.c gnulib2.c regsup.c strtoul.c
- strupr.c
- _negsf2.s errbase.h grp.c sbrk.c system.c
- ! _normdf.cpp fclose.c ic.c setbuf.c sysvar.c
- ! _normsf.cpp fdopen.c setjmp.cpp textio.c
- _truncdf.cpp fflush.c ig.c setlocal.c time.c
- _udivmod.s ffs.c il.c setvbuf.c timeoday.c
- _umulsi3.s fgetc.c ip.c sgtty.c tmpfile.c
- ! a64l.c fgets.c
- ! abort.c filbuf.c iw.c siglist.c tmpnam.c
- ! abs.c findfile.c ldexp.cpp sprintf.c toxxx.c
- ! access.c flonum.h lib.h stksiz.c utime.c
- ! alglobal.c fopen.c libgcc1.c strcat.c
- ! libgcc2.c vfprintf.c
- ! alloca.cpp fprintf.c linea.c strchr.c vprintf.c
- ! alphasor.c fputc.c localtim.c strcmp.c wcmb.c
- ! longlong.h
-
- MiNT library:
-
- --- 24,45 ----
- _negdf2.s eprintf.c gnulib2.c regsup.c strtoul.c
- strupr.c
- _negsf2.s errbase.h grp.c sbrk.c system.c
- ! _normdf.cpp fclose.c setbuf.c sysvar.c
- ! _normsf.cpp fdopen.c ic.c setjmp.cpp textio.c
- _truncdf.cpp fflush.c ig.c setlocal.c time.c
- _udivmod.s ffs.c il.c setvbuf.c timeoday.c
- _umulsi3.s fgetc.c ip.c sgtty.c tmpfile.c
- ! a64l.c fgets.c tmpnam.c
- ! abort.c filbuf.c iw.c siglist.c toxxx.c
- ! abs.c findfile.c ldexp.cpp sprintf.c utime.c
- ! access.c flonum.h lib.h stksiz.c vfprintf.c
- ! alglobal.c fopen.c libgcc1.c strcat.c vprintf.c
- ! libgcc2.c wcmb.c
- ! alloca.cpp fprintf.c linea.c strchr.c wcscat.c
- ! alphasor.c fputc.c localtim.c strcmp.c wcscmp.c
- ! longlong.h wcscpy.c
- ! wcslen.c
- ! wnull.c
-
- MiNT library:
-
- diff -cr ../mntlib37/PatchLev.h ./PatchLev.h
- *** ../mntlib37/PatchLev.h Wed Oct 20 11:10:06 1993
- --- ./PatchLev.h Tue Oct 12 17:23:52 1993
- ***************
- *** 3,6 ****
- * directory.
- */
-
- ! #define PatchLevel "37"
- --- 3,6 ----
- * directory.
- */
-
- ! #define PatchLevel "38"
- diff -cr ../mntlib37/_mulsi3.s ./_mulsi3.s
- *** ../mntlib37/_mulsi3.s Wed Oct 20 11:10:20 1993
- --- ./_mulsi3.s Wed Oct 13 20:08:38 1993
- ***************
- *** 11,20 ****
-
- .text
- .even
- ! .globl __mulsi3, ___mulsi3, .lmul, .ulmul
-
- .lmul:
- - .ulmul:
- __mulsi3:
- ___mulsi3:
- movel d2,a0 | save registers
- --- 11,19 ----
-
- .text
- .even
- ! .globl __mulsi3, ___mulsi3, .lmul
-
- .lmul:
- __mulsi3:
- ___mulsi3:
- movel d2,a0 | save registers
- diff -cr ../mntlib37/_umulsi3.s ./_umulsi3.s
- *** ../mntlib37/_umulsi3.s Wed Oct 20 11:10:24 1993
- --- ./_umulsi3.s Wed Oct 13 20:08:42 1993
- ***************
- *** 11,18 ****
-
- .text
- .even
- ! .globl __umulsi3, ___umulsi3
-
- __umulsi3:
- ___umulsi3:
- movel d2,a0 | save registers
- --- 11,19 ----
-
- .text
- .even
- ! .globl __umulsi3, ___umulsi3, .ulmul
-
- + .ulmul:
- __umulsi3:
- ___umulsi3:
- movel d2,a0 | save registers
- diff -cr ../mntlib37/ioctl.c ./ioctl.c
- *** ../mntlib37/ioctl.c Wed Oct 20 11:11:26 1993
- --- ./ioctl.c Wed Oct 13 19:57:26 1993
- ***************
- *** 64,79 ****
- errno = EBADF;
- return -1;
- }
- ! (void) close(fd);
- ! null_fd = open("/dev/null", O_RDWR | O_NOCTTY);
- (void) Fforce(-1, null_fd);
- ! __open_stat[__OPEN_INDEX(-1)] =
- ! __open_stat[__OPEN_INDEX(null_fd)];
- if (null_fd != fd) {
- (void) Fforce(fd, null_fd);
- ! __open_stat[__OPEN_INDEX(fd)] =
- ! __open_stat[__OPEN_INDEX(null_fd)];
- ! (void) close(null_fd);
- }
- return 0;
- }
- --- 64,78 ----
- errno = EBADF;
- return -1;
- }
- ! (void) Fclose(fd);
- ! null_fd = Fopen(__mint < 9 ? "V:\\null"
- ! : "U:\\dev\\null", O_RDWR);
- (void) Fforce(-1, null_fd);
- ! __open_stat[__OPEN_INDEX(-1)].status = FH_UNKNOWN;
- ! __open_stat[__OPEN_INDEX(fd)].status = FH_UNKNOWN;
- if (null_fd != fd) {
- (void) Fforce(fd, null_fd);
- ! (void) Fclose(null_fd);
- }
- return 0;
- }
- diff -cr ../mntlib37/lattice/mc.prj ./lattice/mc.prj
- *** ../mntlib37/lattice/mc.prj Wed Oct 20 11:11:38 1993
- --- ./lattice/mc.prj Tue Oct 12 18:47:28 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mc3.prj ./lattice/mc3.prj
- *** ../mntlib37/lattice/mc3.prj Wed Oct 20 11:11:38 1993
- --- ./lattice/mc3.prj Tue Oct 12 18:47:30 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcnb.prj ./lattice/mcnb.prj
- *** ../mntlib37/lattice/mcnb.prj Wed Oct 20 11:11:40 1993
- --- ./lattice/mcnb.prj Tue Oct 12 18:47:34 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcnb3.prj ./lattice/mcnb3.prj
- *** ../mntlib37/lattice/mcnb3.prj Wed Oct 20 11:11:40 1993
- --- ./lattice/mcnb3.prj Tue Oct 12 18:47:36 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcr.prj ./lattice/mcr.prj
- *** ../mntlib37/lattice/mcr.prj Wed Oct 20 11:11:40 1993
- --- ./lattice/mcr.prj Tue Oct 12 18:47:38 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcr3.prj ./lattice/mcr3.prj
- *** ../mntlib37/lattice/mcr3.prj Wed Oct 20 11:11:42 1993
- --- ./lattice/mcr3.prj Tue Oct 12 18:47:40 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcrnb.prj ./lattice/mcrnb.prj
- *** ../mntlib37/lattice/mcrnb.prj Wed Oct 20 11:11:42 1993
- --- ./lattice/mcrnb.prj Tue Oct 12 18:47:44 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcrnb3.prj ./lattice/mcrnb3.prj
- *** ../mntlib37/lattice/mcrnb3.prj Wed Oct 20 11:11:42 1993
- --- ./lattice/mcrnb3.prj Tue Oct 12 18:47:46 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcs.prj ./lattice/mcs.prj
- *** ../mntlib37/lattice/mcs.prj Wed Oct 20 11:11:44 1993
- --- ./lattice/mcs.prj Tue Oct 12 18:47:48 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcsnb.prj ./lattice/mcsnb.prj
- *** ../mntlib37/lattice/mcsnb.prj Wed Oct 20 11:11:44 1993
- --- ./lattice/mcsnb.prj Tue Oct 12 18:47:52 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcsr.prj ./lattice/mcsr.prj
- *** ../mntlib37/lattice/mcsr.prj Wed Oct 20 11:11:44 1993
- --- ./lattice/mcsr.prj Tue Oct 12 18:47:54 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/mcsrnb.prj ./lattice/mcsrnb.prj
- *** ../mntlib37/lattice/mcsrnb.prj Wed Oct 20 11:11:46 1993
- --- ./lattice/mcsrnb.prj Tue Oct 12 18:47:56 1993
- ***************
- *** 195,200 ****
- --- 195,205 ----
- ..\WAIT3.C
- ..\WAITPID.C
- ..\WCMB.C
- + ..\WCSCAT.C
-
- + ..\WCSCMP.C
-
- + ..\WCSCPY.C
-
- + ..\WCSLEN.C
-
- + ..\WNULL.C
-
- ..\WRITE.C
- ..\WTMP.C
- ALLOCA.C
- diff -cr ../mntlib37/lattice/setjmp.s ./lattice/setjmp.s
- *** ../mntlib37/lattice/setjmp.s Wed Oct 20 11:12:00 1993
- --- ./lattice/setjmp.s Mon Oct 18 22:20:44 1993
- ***************
- *** 1,60 ****
- INCLUDE inc.i
-
- INFO
- xref ___mint
-
- ;
- ; setjmp.cpp
- ;
- CODE
- IF _REGARG
- xdef @setjmp
- ELSE
- xdef _setjmp
- ENDC
-
- IF _REGARG
- @setjmp:
- ELSE
- _setjmp:
- ! move.l 4(sp),a0 ; address of jmp_buf[]
- ENDC
- move.l (sp),(a0) ; save return address
- movem.l d2-d7/a2-a7,4(a0) ; save registers d2-d7/a2-a7
- ! clr.l d0 ; return value is 0
- rts
-
- ! IF _REGARG
- ! xdef @longjmp
- ! ELSE
- ! xdef _longjmp
- ! ENDC
- !
- IF _REGARG
- @longjmp:
- ELSE
- _longjmp:
- ENDC
- IF _SHORT
- ! tst.w ___mint ; see if MiNT is active
- ELSE
- tst.l ___mint
- ENDC
- ! beq.s NOMINT ; no -- do not call sigreturn
- move.w #$11a,-(sp) ; Psigreturn() system call
- trap #1 ; (ignored if not in a sig handler)
- addq.w #2,sp
- ! NOMINT:
- ! move.l 4(sp),a0 ; address of jmp_buf[]
- IF _SHORT
- ! move.w 8(sp),d0 ; value to return
- ELSE
- ! move.l 8(sp),d0 ; value to return
- ENDC
- ! bne.s L1 ; may not be 0
- ! move.l #1,d0
- L1:
- movem.l 4(a0),d2-d7/a2-a7 ; restore saved reggies
- move.l (a0),(sp) ; and the saved return address
- ! rts
- end
- --- 1,161 ----
- INCLUDE inc.i
-
- INFO
- +
- xref ___mint
- + xref __sigmask
-
- ;
- ; setjmp.cpp
- ;
- CODE
- +
- IF _REGARG
- xdef @setjmp
- + xdef @longjmp
- + xdef @sigsetjmp
- + xdef @siglongjmp
- ELSE
- xdef _setjmp
- + xdef _longjmp
- + xdef _sigsetjmp
- + xdef _siglongjmp
- + ENDC
- +
- + ; sigsetjmp(sigjmp_buf env, int savemask)
- + ; address of sigjmp_buf will be in a0
- + ; savemask will be in d0/a1 (signextended)
- + IF _REGARG
- + @sigsetjmp:
- + IF _SHORT
- + ext.l d0
- + ENDC
- + move.l d0,52(a0) ; save sigmask for siglongjmp?
- + ELSE
- + _sigsetjmp:
- + move.l 4(sp),a0
- + IF _SHORT
- + move.w 8(sp),a1
- + ELSE
- + move.l 8(sp),a1
- + ENDC
- + move.l a1,52(a0) ; save sigmask for siglongjmp?
- ENDC
-
- + beq.w Common ; no -- call common code
- +
- + move.l __sigmask,d0 ; save tos emulation signal mask
- + ; see if MiNT is active
- + IF _SHORT
- + tst.w ___mint
- + ELSE
- + tst.l ___mint
- + ENDC
- + beq.w SSJ_nomint ; no -- skip Psigblock
- + clr.l -(sp) ; add no signals to sigmask
- + move.w #$116,-(sp) ; Psigblock() system call
- + trap #1
- + addq #6,sp
- +
- + SSJ_nomint:
- + bset #0,d0 ; make it != 0 (SIGNULL is unmaskable)
- + move.l d0,52(a0) ; save signal mask
- + bra Common ; call code common with setjmp
- +
- +
- + ; setjmp(sigjmp_buf env)
- + ; address of jmp_buf will be in a0
- IF _REGARG
- @setjmp:
- ELSE
- _setjmp:
- ! move.l 4(sp),a0
- ENDC
- +
- + clr.l 52(a0) ; do not restore sigmask on longjmp
- + Common:
- move.l (sp),(a0) ; save return address
- movem.l d2-d7/a2-a7,4(a0) ; save registers d2-d7/a2-a7
- ! moveq #0,d0 ; return value is 0
- rts
-
- !
- ! ; siglongjmp(sigjmpbuf env, int retval)
- ! ; longjmp(sigjmpbuf env, int retval)
- IF _REGARG
- @longjmp:
- + @siglongjmp:
- ELSE
- _longjmp:
- + _siglongjmp:
- ENDC
- + ; see if MiNT is active
- IF _SHORT
- ! tst.w ___mint
- ELSE
- tst.l ___mint
- ENDC
- !
- ! beq.w LJ_nomint ; no -- do not call Psigreturn
- !
- ! IF _REGARG ; save d0,a0 before Psigreturn
- ! IF _SHORT
- ! move.w d0,-(sp)
- ! ELSE
- ! move.l d0,-(sp)
- ! ENDC
- ! move.l a0,-(sp)
- ! ENDC
- move.w #$11a,-(sp) ; Psigreturn() system call
- trap #1 ; (ignored if not in a sig handler)
- addq.w #2,sp
- !
- ! LJ_nomint:
- ! ; address of jmpbuf in a0
- ! IF _REGARG
- ! move.l (sp),a0
- ! ELSE
- ! move.l 4(sp),a0
- ! ENDC
- !
- ! move.l 52(a0),d0 ; want to restore sigmask?
- ! beq.w Norestore ; no -- skip restore code
- ! bclr #0,d0 ; dump SIGNUL
- ! move.l d0,__sigmask ; restore tos emulation signal mask
- !
- ! ; see if MiNT is active
- IF _SHORT
- ! tst.w ___mint
- ELSE
- ! tst.l ___mint
- ! ENDC
- ! beq.w Norestore ; no -- do not call Psigblock
- ! move.l d0,-(sp) ; add no signals to sigmask
- ! move.w #$117,-(sp) ; Psigblock() system call
- ! trap #1
- ! addq #6,sp
- ! move.l (sp),a0 ; restore a0 == jmpbuf
- !
- ! Norestore:
- ! ; value to return in d0 ...
- ! IF _REGARG
- ! IF _SHORT
- ! move.w 4(sp),d0
- ! ELSE
- ! move.l 4(sp),d0
- ! ENDC
- ! ELSE
- ! IF _SHORT
- ! move.w 8(sp),d0
- ! ELSE
- ! move.l 8(sp),d0
- ENDC
- ! ENDC
- !
- ! bne.w L1 ; ... may not be 0
- ! moveq #1,d0
- L1:
- movem.l 4(a0),d2-d7/a2-a7 ; restore saved reggies
- move.l (a0),(sp) ; and the saved return address
- ! rts ; will restore a7
- end
- diff -cr ../mntlib37/mincl ./mincl
- *** ../mntlib37/mincl Wed Oct 20 11:12:20 1993
- --- ./mincl Tue Oct 12 18:53:58 1993
- ***************
- *** 38,44 ****
- scanf.o sscanf.o setbuf.o setvbuf.o \
- setlocal.o sprintf.o strftime.o strtol.o strtoul.o system.o \
- tmpnam.o tmpfile.o toxxx.o \
- ! vfprintf.o vprintf.o wcmb.o
-
- #
- # other miscellaneous stuff
- --- 38,45 ----
- scanf.o sscanf.o setbuf.o setvbuf.o \
- setlocal.o sprintf.o strftime.o strtol.o strtoul.o system.o \
- tmpnam.o tmpfile.o toxxx.o \
- ! vfprintf.o vprintf.o wcmb.o \
- ! wcscat.o wcscmp.o wcscpy.o wcslen.o wnull.o
-
- #
- # other miscellaneous stuff
- diff -cr ../mntlib37/open.c ./open.c
- *** ../mntlib37/open.c Wed Oct 20 11:12:26 1993
- --- ./open.c Wed Oct 13 19:41:06 1993
- ***************
- *** 78,84 ****
- iomode = iomode & ~O_SHMODE;
-
- if (__mint >= 9) {
- ! modemask = O_ACCMODE | O_SHMODE | O_SYNC | O_NDELAY;
- iomode |= (iomode & O_EXCL) ? O_DENYRW : O_DENYNONE;
- if (__mint >= 96) {
- modemask |= _REALO_APPEND;
- --- 78,84 ----
- iomode = iomode & ~O_SHMODE;
-
- if (__mint >= 9) {
- ! modemask = O_ACCMODE | O_SHMODE | O_SYNC | O_NDELAY | O_CREAT | O_TRUNC;
- iomode |= (iomode & O_EXCL) ? O_DENYRW : O_DENYNONE;
- if (__mint >= 96) {
- modemask |= _REALO_APPEND;
- ***************
- *** 96,102 ****
- return -1;
- }
- rv = (int)Fopen(filename,iomode & modemask);
- ! if ((iomode & O_TRUNC) && (rv >= 0)) {
- /* Give up if the mode flags conflict */
- if (iomode & O_RDONLY) {
- (void)Fclose(rv);
- --- 96,102 ----
- return -1;
- }
- rv = (int)Fopen(filename,iomode & modemask);
- ! if ((iomode & ~modemask & O_TRUNC) && (rv >= 0)) {
- /* Give up if the mode flags conflict */
- if (iomode & O_RDONLY) {
- (void)Fclose(rv);
- ***************
- *** 123,142 ****
- else /* file doesn't exist */
- {
- if(iomode & O_CREAT) {
- ! rv = (int)Fcreate(filename, 0x00);
- ! if (rv >= 0) {
- (void)Fclose(rv);
- rv = (int)Fopen(filename,iomode & modemask);
- ! if (rv >= 0 && __mint >= 9)
- ! (void)Fchmod(filename, pmode);
- }
- }
- else
- rv = -ENOENT;
- }
-
- ! if((rv >= 0) && (iomode & O_APPEND))
- ! (void)lseek(rv, 0L, SEEK_END);
-
- if(rv < (__SMALLEST_VALID_HANDLE)) {
- errno = -rv;
- --- 123,146 ----
- else /* file doesn't exist */
- {
- if(iomode & O_CREAT) {
- ! if (__mint >= 9)
- ! rv = (int) Fopen (filename, iomode & modemask);
- ! else {
- ! rv = (int)Fcreate(filename, 0x00);
- ! if (rv >= 0) {
- (void)Fclose(rv);
- rv = (int)Fopen(filename,iomode & modemask);
- ! }
- }
- + if (rv >= 0 && __mint >= 9)
- + (void)Fchmod(filename, pmode);
- }
- else
- rv = -ENOENT;
- }
-
- ! if((rv >= 0) && (iomode & O_APPEND) && !(modemask & _REALO_APPEND))
- ! (void)Fseek(0L, rv, SEEK_END);
-
- if(rv < (__SMALLEST_VALID_HANDLE)) {
- errno = -rv;
- diff -cr ../mntlib37/popen.c ./popen.c
- *** ../mntlib37/popen.c Wed Oct 20 11:12:30 1993
- --- ./popen.c Wed Oct 13 22:12:36 1993
- ***************
- *** 9,17 ****
- #include <string.h>
- #include <errno.h>
- #include <unistd.h>
-
- - __EXTERN int wait __PROTO((int *));
- -
- struct _pipe {
- int pid; /* process id of child */
- FILE *pfile; /* created file descriptor */
- --- 9,18 ----
- #include <string.h>
- #include <errno.h>
- #include <unistd.h>
- + #include <sys/types.h>
- + #include <wait.h>
- + #include <mintbind.h>
-
- struct _pipe {
- int pid; /* process id of child */
- FILE *pfile; /* created file descriptor */
- ***************
- *** 24,30 ****
- const char *command, *type;
- {
- struct _pipe *p; /* the new pipe's list entry */
- ! int pipfd[2]; /* pipe file handles */
- int savefd; /* saved file descriptor for parent */
- int kidfd; /* file descriptor changed in child */
- /* 1 for "r", 0 for "w" */
- --- 25,31 ----
- const char *command, *type;
- {
- struct _pipe *p; /* the new pipe's list entry */
- ! short pipfd[2]; /* pipe file handles */
- int savefd; /* saved file descriptor for parent */
- int kidfd; /* file descriptor changed in child */
- /* 1 for "r", 0 for "w" */
- ***************
- *** 32,37 ****
- --- 33,39 ----
- char *shell;
- FILE *pipefile = 0;
- extern int __mint;
- + long r;
-
- if (__mint == 0) {
- errno = EINVAL;
- ***************
- *** 49,71 ****
- /* initialize the new pipe entry */
- kidfd = (*type == 'r') ? 1 : 0;
-
- ! savefd = dup(kidfd);
- /* get those close-on-exec flags right...
- (well just do fork/exec would be easier :-) -nox */
-
- ! if (savefd < 0 || fcntl (savefd, F_SETFD, (void *) 1) == -1 ||
- ! pipe(pipfd) != 0) { /* can't create pipe?? */
- free(p);
- return (FILE *)0;
- }
-
- /* other side of the pipe should be closed in the child */
- ! (void) fcntl(pipfd[1 - kidfd], F_SETFD, (void *) 1);
- ! dup2(pipfd[kidfd], kidfd);
- ! close(pipfd[kidfd]);
- p->pid = spawnlp(P_NOWAIT, shell, shell, "-c", command, (char *)0);
- ! dup2(savefd, kidfd);
- ! close(savefd);
-
- if (p->pid > 0) { /* command ran all right */
- /* note: 1-kidfd tells us which handle to use in the parent */
- --- 51,74 ----
- /* initialize the new pipe entry */
- kidfd = (*type == 'r') ? 1 : 0;
-
- ! savefd = r = Fdup (kidfd);
- /* get those close-on-exec flags right...
- (well just do fork/exec would be easier :-) -nox */
-
- ! if (r < 0 || (r = Fcntl (savefd, 1L, F_SETFD)) < 0 ||
- ! (r = Fpipe(pipfd)) < 0) { /* can't create pipe?? */
- free(p);
- + errno = (int) -r;
- return (FILE *)0;
- }
-
- /* other side of the pipe should be closed in the child */
- ! (void) Fcntl(pipfd[1 - kidfd], (long) 1, F_SETFD);
- ! Fforce(kidfd, pipfd[kidfd]);
- ! Fclose(pipfd[kidfd]);
- p->pid = spawnlp(P_NOWAIT, shell, shell, "-c", command, (char *)0);
- ! Fforce(kidfd, savefd);
- ! Fclose(savefd);
-
- if (p->pid > 0) { /* command ran all right */
- /* note: 1-kidfd tells us which handle to use in the parent */
- ***************
- *** 79,85 ****
- }
- else {
- /* carefully release all resources */
- ! close (pipfd[1 - kidfd]);
- free(p);
- }
- return pipefile;
- --- 82,90 ----
- }
- else {
- /* carefully release all resources */
- ! Fclose (pipfd[1 - kidfd]);
- ! if (p->pid > 0) /* just in case... */
- ! waitpid (p->pid, (int *) NULL, 0);
- free(p);
- }
- return pipefile;
- ***************
- *** 93,99 ****
- struct _pipe *p, /* the pipe's list element */
- **q; /* predecessor of p in the list */
- int status = -1; /* return status of the command */
- - int pid;
-
- /* search the pipe list for a pipe matching the FILE descriptor */
- for (p = __pipes, q = &__pipes; p && p->pfile != fp;
- --- 98,103 ----
- ***************
- *** 104,113 ****
- fclose(p->pfile); /* close the connection */
-
- /* now wait for the command to finish */
- !
- ! do {
- ! pid = wait(&status);
- ! } while (pid >= 0 && pid != p->pid);
-
- /* remove the pipe from the list */
- *q = p->pnext;
- --- 108,114 ----
- fclose(p->pfile); /* close the connection */
-
- /* now wait for the command to finish */
- ! waitpid (p->pid, &status, 0);
-
- /* remove the pipe from the list */
- *q = p->pnext;
- diff -cr ../mntlib37/read.c ./read.c
- *** ../mntlib37/read.c Wed Oct 20 11:13:04 1993
- --- ./read.c Wed Oct 13 20:01:48 1993
- ***************
- *** 10,15 ****
- --- 10,16 ----
- #include <signal.h>
- #include <unistd.h>
- #include <support.h>
- + #include <mintbind.h>
- #include "lib.h"
-
- #define CTRL(x) (x & 0x1f)
- ***************
- *** 70,80 ****
- flags = -1;
-
- if ( (__mint > 0) || (flags == -1) ||
- ! ( ((flags & (RAW|CBREAK)) == 0) && (flags & ECHO) ) ) {
- #ifdef EIO
- if (__mint && _isctty(fd)) {
- ! (void) ioctl(fd, TIOCGPGRP, &tty_pgrp);
- ! if (tty_pgrp != getpgrp()) {
- #if 0
- /* This isn't really what we mean here...we really want to
- know if our process group has no controlling terminal.
- --- 71,81 ----
- flags = -1;
-
- if ( (__mint > 0) || (flags == -1) ||
- ! ( ((flags & (RAW|CBREAK|ECHO)) == ECHO) ) ) {
- #ifdef EIO
- if (__mint && _isctty(fd)) {
- ! (void) Fcntl(fd, (long) &tty_pgrp, TIOCGPGRP);
- ! if (tty_pgrp != Pgetpgrp()) {
- #if 0
- /* This isn't really what we mean here...we really want to
- know if our process group has no controlling terminal.
- ***************
- *** 84,93 ****
- return -1;
- }
- #endif
- ! omask = sigblock(~0L);
- ! osigt = signal(SIGTTIN, SIG_IGN);
- ! (void) signal(SIGTTIN, osigt);
- ! (void) sigsetmask(omask);
- if ((omask & sigmask(SIGTTIN)) || (osigt == SIG_IGN)) {
- errno = EIO;
- return -1;
- --- 85,94 ----
- return -1;
- }
- #endif
- ! omask = Psigblock(~0L);
- ! osigt = (__Sigfunc) Psignal(SIGTTIN, SIG_IGN);
- ! (void) Psignal(SIGTTIN, (long) osigt);
- ! (void) Psigsetmask(omask);
- if ((omask & sigmask(SIGTTIN)) || (osigt == SIG_IGN)) {
- errno = EIO;
- return -1;
- ***************
- *** 148,153 ****
- --- 149,157 ----
- return r;
- }
-
- + #if defined (__GNUC__) && !defined (__MSHORT__)
- + __asm__ (".stabs \"_read\",5,0,0,__read");
- + #else
- int
- read(fd, buf, size)
- int fd;
- ***************
- *** 156,158 ****
- --- 160,163 ----
- {
- return (int) _read(fd, buf, (unsigned long)size);
- }
- + #endif
- diff -cr ../mntlib37/rename.c ./rename.c
- *** ../mntlib37/rename.c Wed Oct 20 11:13:08 1993
- --- ./rename.c Wed Oct 13 08:49:24 1993
- ***************
- *** 17,31 ****
- rval = 0; /* no-op */
- }
- #endif
- - if (!access(_newname, 0)) { /* new name already exists */
- - if (unlink(_newname))
- - return -1;
- - }
-
- _unx2dos(_oldname, oldname);
- _unx2dos(_newname, newname);
-
- ! if ( (rval = Frename(0, oldname, newname)) < 0 ) {
- errno = -rval;
- rval = -1;
- }
- --- 17,36 ----
- rval = 0; /* no-op */
- }
- #endif
-
- _unx2dos(_oldname, oldname);
- _unx2dos(_newname, newname);
-
- ! rval = Frename(0, oldname, newname);
- ! if (rval == 0)
- ! return 0;
- ! if (rval != -EXDEV && rval != -ENOENT)
- ! {
- ! (void) Fdelete (newname);
- ! rval = Frename(0, oldname, newname);
- ! }
- !
- ! if (rval < 0) {
- errno = -rval;
- rval = -1;
- }
- diff -cr ../mntlib37/sleep.c ./sleep.c
- *** ../mntlib37/sleep.c Wed Oct 20 11:13:18 1993
- --- ./sleep.c Thu Oct 14 01:53:00 1993
- ***************
- *** 7,18 ****
- --- 7,36 ----
- #include <mintbind.h>
- #include <signal.h>
- #include <unistd.h>
- + #include <limits.h>
-
- /* _clock() has a rez of CLOCKS_PER_SEC ticks/sec */
-
- #define USEC_PER_TICK (1000000L / ((unsigned long)CLOCKS_PER_SEC))
- #define USEC_TO_CLOCK_TICKS(us) ((us) / USEC_PER_TICK )
-
- + static unsigned long _alarm __PROTO((unsigned long secs));
- +
- + static unsigned long
- + _alarm(secs)
- + unsigned long secs;
- + {
- + unsigned long r;
- +
- + #ifndef __MSHORT__
- + if (secs > ((unsigned long) (LONG_MAX/1000)))
- + secs = ((unsigned long) (LONG_MAX/1000));
- + #endif
- + r = Talarm((long) secs);
- +
- + return (unsigned long) r;
- + }
- +
- static void __CDECL alarm_catch __PROTO((long signum));
-
- static void __CDECL
- ***************
- *** 29,35 ****
- unsigned long stop;
- long old_alarm_func;
- long old_sigmask;
- ! long alarm_sec;
- long remain;
- extern int __mint;
-
- --- 47,53 ----
- unsigned long stop;
- long old_alarm_func;
- long old_sigmask;
- ! unsigned long alarm_sec;
- long remain;
- extern int __mint;
-
- ***************
- *** 39,72 ****
- (void)Fselect(32000, 0L, 0L, 0L);
- n -= 32;
- }
- ! (void)Fselect(1000*n, 0L, 0L, 0L);
- return 0;
- }
- if (n == 0)
- return 0;
- ! alarm_sec = (long) alarm(0);
- old_sigmask = Psigblock(~0L);
- old_alarm_func = Psignal(SIGALRM, (long)alarm_catch);
- (void) Psigblock(~0L);
- stop = _clock() + n * CLOCKS_PER_SEC;
- if (alarm_sec && (alarm_sec < n))
- ! (void) alarm((unsigned) alarm_sec);
- else
- ! (void) alarm(n);
- ! Psigpause(old_sigmask);
- ! (void) alarm(0);
- (void) Psignal(SIGALRM, (long) alarm_catch);
- (void) Syield();
- (void) Psigblock(~0L);
- remain = ((long) stop - (long) _clock())
- / (long) CLOCKS_PER_SEC;
- if (alarm_sec) {
- alarm_sec -= ((long) n - remain);
- if (alarm_sec <= 0)
- (void) Pkill(Pgetpid(), SIGALRM);
- else
- ! (void) alarm((unsigned) alarm_sec);
- }
- (void) Psignal(SIGALRM, (long) old_alarm_func);
- (void) Psigsetmask(old_sigmask);
- (void) Syield();
- --- 57,115 ----
- (void)Fselect(32000, 0L, 0L, 0L);
- n -= 32;
- }
- ! if (n > 0)
- ! (void)Fselect(1000*n, 0L, 0L, 0L);
- return 0;
- }
- if (n == 0)
- return 0;
- ! /* Clear any existing alarm, but save its expire time.
- ! Then block all signals and save original mask.
- ! Install our alarm handler, and remask (since Psignal()
- ! just unmasked SIGALRM.)
- ! */
- ! alarm_sec = (long) Talarm(0L);
- old_sigmask = Psigblock(~0L);
- old_alarm_func = Psignal(SIGALRM, (long)alarm_catch);
- (void) Psigblock(~0L);
- + /* Figure out when we would normally wake up */
- stop = _clock() + n * CLOCKS_PER_SEC;
- + /* But only sleep as long as the original alarm clock */
- if (alarm_sec && (alarm_sec < n))
- ! (void) _alarm(alarm_sec);
- else
- ! (void) _alarm((unsigned long) n);
- ! /* Go to sleep with the original mask but always
- ! allow SIGALRM or we might never wake up.
- ! */
- ! Psigpause(old_sigmask & ~(sigmask(SIGALRM)));
- ! /* Cancel any time left on the alarm clock */
- ! (void) _alarm(0L);
- ! /* Eat any alarms that occurred before we cancelled.
- ! The Syield ensure we enter the kernel and handle the
- ! signal.
- ! */
- (void) Psignal(SIGALRM, (long) alarm_catch);
- (void) Syield();
- + /* Remask again after the Psignal() */
- (void) Psigblock(~0L);
- remain = ((long) stop - (long) _clock())
- / (long) CLOCKS_PER_SEC;
- if (alarm_sec) {
- + /* Restore the original timer (or if it expired,
- + post the signal now)
- + */
- alarm_sec -= ((long) n - remain);
- if (alarm_sec <= 0)
- (void) Pkill(Pgetpid(), SIGALRM);
- else
- ! (void) _alarm(alarm_sec);
- }
- + /* Restore the original alarm handler (which also
- + allows it to be delivered!) Then restore the
- + original signal mask (if the signal handler
- + does a longjmp() we might lose).
- + */
- (void) Psignal(SIGALRM, (long) old_alarm_func);
- (void) Psigsetmask(old_sigmask);
- (void) Syield();
- diff -cr ../mntlib37/stat.c ./stat.c
- *** ../mntlib37/stat.c Wed Oct 20 11:13:34 1993
- --- ./stat.c Wed Oct 13 19:37:00 1993
- ***************
- *** 89,98 ****
- /* if we hit a symbolic link, try to get its size right */
- if (lflag && ((st->st_mode & S_IFMT) == S_IFLNK)) {
- char buf[PATH_MAX + 1];
- ! r = readlink(path, buf, PATH_MAX);
- if (r < 0)
- return -1;
- ! st->st_size = r;
- }
- return 0;
- }
- --- 89,104 ----
- /* if we hit a symbolic link, try to get its size right */
- if (lflag && ((st->st_mode & S_IFMT) == S_IFLNK)) {
- char buf[PATH_MAX + 1];
- ! char buf1[PATH_MAX + 1];
- ! r = Freadlink(PATH_MAX, buf, path);
- if (r < 0)
- + {
- + errno = (int) -r;
- return -1;
- ! }
- ! buf[PATH_MAX] = 0;
- ! _dos2unx (buf, buf1);
- ! st->st_size = strlen (buf1);
- }
- return 0;
- }
- diff -cr ../mntlib37/symlink.c ./symlink.c
- *** ../mntlib37/symlink.c Wed Oct 20 11:13:50 1993
- --- ./symlink.c Wed Oct 20 03:54:02 1993
- ***************
- *** 5,10 ****
- --- 5,11 ----
- #include <string.h>
- #include <limits.h>
- #include <unistd.h>
- + #include <stat.h>
- #include "lib.h"
-
- extern int __mint;
- ***************
- *** 54,59 ****
- --- 55,69 ----
- _unx2dos(unxname, filename);
- r = Freadlink(PATH_MAX, linkto, filename);
- if (r < 0) {
- + if (r == -EACCES) {
- + struct stat sb;
- +
- + /* UNIX gives EINVAL, not EACCES, on non-links */
- + if ((Fxattr(1, filename, &sb) == 0)
- + && ((sb.st_mode & S_IFMT) != S_IFLNK)) {
- + r = -EINVAL;
- + }
- + }
- errno = (int) -r;
- return -1;
- }
- diff -cr ../mntlib37/tcattr.c ./tcattr.c
- *** ../mntlib37/tcattr.c Wed Oct 20 11:13:52 1993
- --- ./tcattr.c Mon Oct 18 06:59:32 1993
- ***************
- *** 86,91 ****
- --- 86,93 ----
- stp->c_cc[VSTOP] = (cc_t) t.t_stopc;
- stp->c_cc[VMIN] = (cc_t) 1;
- stp->c_cc[VTIME] = (cc_t) 0;
- + stp->c_cc[VLNEXT] = (cc_t) lt.t_lnextc;
- + stp->c_cc[VWERASE] = (cc_t) lt.t_werasc;
- return 0;
- }
-
- ***************
- *** 156,161 ****
- --- 158,165 ----
- lt.t_suspc = (char) stp->c_cc[VSUSP];
- t.t_startc = (char) stp->c_cc[VSTART];
- t.t_stopc = (char) stp->c_cc[VSTOP];
- + lt.t_lnextc = (char) stp->c_cc[VLNEXT];
- + lt.t_werasc = (char) stp->c_cc[VWERASE];
- switch (action)
- {
- case TCSAFLUSH:
- diff -cr ../mntlib37/wait3.c ./wait3.c
- *** ../mntlib37/wait3.c Wed Oct 20 11:14:06 1993
- --- ./wait3.c Tue Oct 12 23:03:02 1993
- ***************
- *** 73,79 ****
- (unsigned long) (sizeof (struct rusage)));
- _ms2tval(rsc[0], &(rusage->ru_utime));
- _ms2tval(rsc[1], &(rusage->ru_stime));
- - rusage->ru_maxrss = rsc[4];
- /* Kludge so GNU time will configure properly: */
- rusage->ru_nvcsw = 1;
- }
- --- 73,78 ----
- diff -cr ../mntlib37/wcmb.c ./wcmb.c
- *** ../mntlib37/wcmb.c Wed Oct 20 11:14:08 1993
- --- ./wcmb.c Tue Oct 12 18:45:12 1993
- ***************
- *** 5,10 ****
- --- 5,12 ----
- #include <stdlib.h>
- #include <stddef.h>
-
- + extern const wchar_t *_wnull;
- +
- int
- mblen(mbstr, n)
- const char *mbstr;
- ***************
- *** 57,65 ****
- size_t maxlen;
- {
- size_t revcnt = maxlen;
- - static const wchar_t wnull[1] = { 0 };
-
- ! if(wstr == NULL) wstr = wnull; /* Better avoid L"". */
-
- while(revcnt && (*mbstr++ = (char) *wstr++)) revcnt--;
-
- --- 59,66 ----
- size_t maxlen;
- {
- size_t revcnt = maxlen;
-
- ! if(wstr == NULL) wstr = _wnull; /* Better avoid L"". */
-
- while(revcnt && (*mbstr++ = (char) *wstr++)) revcnt--;
-
- Only in .: wcscat.c
- Only in .: wcscmp.c
- Only in .: wcscpy.c
- Only in .: wcslen.c
- Only in .: wnull.c
- diff -cr ../mntlib37/write.c ./write.c
- *** ../mntlib37/write.c Wed Oct 20 11:14:08 1993
- --- ./write.c Wed Oct 13 20:05:32 1993
- ***************
- *** 14,19 ****
- --- 14,20 ----
- #include <unistd.h>
- #include <signal.h>
- #include <stat.h>
- + #include <mintbind.h>
- #include "lib.h"
-
- extern __Sigfunc _sig_handler[]; /* TOS fakes for signal handling */
- ***************
- *** 29,34 ****
- --- 30,36 ----
- long r;
- extern int __mint;
- struct stat statbuf;
- + _DOSTIME timebuf;
-
- if (__mint == 0 && isatty(fd)) {
- r = __OPEN_INDEX(fd);
- ***************
- *** 54,69 ****
- return -1;
- }
- if (size && r == 0) {
- ! if (fstat(fd, &statbuf) < 0) return -1;
- ! if ((statbuf.st_mode & S_IFMT) == S_IFREG) {
- ! errno = ENOSPC;
- ! return -1;
- }
- }
-
- return r;
- }
-
- int
- write(fd, buf, size)
- int fd;
- --- 56,88 ----
- return -1;
- }
- if (size && r == 0) {
- ! if (__mint >= 9)
- ! {
- ! if ((r = Fcntl (fd, &statbuf, FSTAT)) < 0)
- ! {
- ! errno = (int) -r;
- ! return -1;
- }
- + if ((statbuf.st_mode & S_IFMT) == S_IFREG)
- + {
- + errno = ENOSPC;
- + return -1;
- + }
- + }
- + else if (Fdatime (&timebuf, fd, 0) == 0
- + && Fseek (0L, fd, SEEK_CUR) >= 0)
- + {
- + errno = ENOSPC;
- + return -1;
- + }
- }
-
- return r;
- }
-
- + #if defined (__GNUC__) && !defined (__MSHORT__)
- + __asm__ (".stabs \"_write\",5,0,0,__write");
- + #else
- int
- write(fd, buf, size)
- int fd;
- ***************
- *** 72,74 ****
- --- 91,94 ----
- {
- return (int) _write(fd, buf, (unsigned long)size);
- }
- + #endif
- *** /dev/null Wed Oct 20 12:09:44 1993
- --- wcscat.c Thu Oct 14 03:50:14 1993
- ***************
- *** 0 ****
- --- 1,51 ----
- + /* from Henry Spencer's stringlib */
- + /* check for src==NULL added by ERS */
- +
- + #include <stddef.h>
- + #include <stdlib.h>
- +
- + /*
- + * wcscat - append string src to dst
- + */
- + wchar_t * /* dst */
- + wcscat(dst, src)
- + wchar_t *dst;
- + const wchar_t *src;
- + {
- + register wchar_t *dscan;
- + register const wchar_t *sscan;
- +
- + if ((sscan = src) != NULL)
- + {
- + for (dscan = dst; *dscan; dscan++)
- + continue;
- + while ((*dscan++ = *sscan++))
- + continue;
- + }
- + return(dst);
- + }
- +
- + /*
- + * wcsncat - append at most n characters of string src to dst
- + */
- + wchar_t * /* dst */
- + wcsncat(dst, src, n)
- + wchar_t *dst;
- + const wchar_t *src;
- + size_t n;
- + {
- + register wchar_t *dscan, c;
- + register const wchar_t *sscan;
- + register long count;
- +
- + if(((sscan = src) != NULL) && (n > 0))
- + {
- + for (dscan = dst; *dscan; dscan++)
- + continue;
- + count = n;
- + while ((c = *sscan++) && --count >= 0)
- + *dscan++ = c;
- + *dscan = 0;
- + }
- + return(dst);
- + }
- *** /dev/null Wed Oct 20 12:09:46 1993
- --- wcscmp.c Wed Oct 6 11:18:00 1993
- ***************
- *** 0 ****
- --- 1,79 ----
- + /* from Henry Spencer's stringlib */
- + /* modified by ERS */
- +
- + #include <stddef.h>
- + #include <stdlib.h>
- +
- + /*
- + * wcscmp - compare string s1 to s2
- + */
- +
- + int /* <0 for <, 0 for ==, >0 for > */
- + wcscmp(scan1, scan2)
- + register const wchar_t *scan1;
- + register const wchar_t *scan2;
- + {
- + register wchar_t c1, c2;
- +
- + if (scan1 == NULL)
- + return scan2 == NULL ? 0 : -1;
- + if (scan2 == NULL) return 1;
- +
- + do {
- + c1 = *scan1++; c2 = *scan2++;
- + } while (c1 && c1 == c2);
- +
- + /*
- + * The following case analysis is necessary so that characters
- + * which look negative collate low against normal characters but
- + * high against the end-of-string NUL.
- + */
- + if (c1 == c2)
- + return(0);
- + else if (!c1)
- + return(-1);
- + else if (!c2)
- + return(1);
- + else
- + return(c1 - c2);
- + }
- +
- + /*
- + * wcsncmp - compare at most n characters of string s1 to s2
- + */
- +
- + int /* <0 for <, 0 for ==, >0 for > */
- + wcsncmp(scan1, scan2, n)
- + register const wchar_t *scan1;
- + register const wchar_t *scan2;
- + size_t n;
- + {
- + register wchar_t c1, c2;
- + register long count;
- +
- + if (scan1 == NULL) {
- + return scan2 == NULL ? 0 : -1;
- + }
- + if (scan2 == NULL) return 1;
- + count = n;
- + do {
- + c1 = *scan1++; c2 = *scan2++;
- + } while (--count >= 0 && c1 && c1 == c2);
- +
- + if (count < 0)
- + return(0);
- +
- + /*
- + * The following case analysis is necessary so that characters
- + * which look negative collate low against normal characters but
- + * high against the end-of-string NUL.
- + */
- + if (c1 == c2)
- + return(0);
- + else if (!c1)
- + return(-1);
- + else if (!c2)
- + return(1);
- + else
- + return(c1 - c2);
- + }
- *** /dev/null Wed Oct 20 12:09:48 1993
- --- wcscpy.c Thu Oct 14 03:51:38 1993
- ***************
- *** 0 ****
- --- 1,48 ----
- + /* from Henry Spencer's stringlib */
- + /* check for NULL string added by ERS */
- +
- + #include <stddef.h>
- + #include <stdlib.h>
- +
- + extern const wchar_t *_wnull;
- +
- + /*
- + * wcscpy - copy string src to dst
- + */
- + wchar_t * /* dst */
- + wcscpy(dst, src)
- + wchar_t *dst;
- + const wchar_t *src;
- + {
- + register wchar_t *dscan = dst;
- + register const wchar_t *sscan = src;
- +
- + if (sscan == NULL) sscan = _wnull;
- + while ((*dscan++ = *sscan++))
- + continue;
- + return(dst);
- + }
- +
- + /*
- + * wcsncpy - copy at most n characters of string src to dst
- + */
- + wchar_t * /* dst */
- + wcsncpy(dst, src, n)
- + wchar_t *dst;
- + const wchar_t *src;
- + size_t n;
- + {
- + register wchar_t *dscan;
- + register const wchar_t *sscan;
- + register long count;
- +
- + dscan = dst;
- + if ((sscan = src) == NULL)
- + sscan = _wnull;
- + count = n;
- + while (--count >= 0 && (*dscan++ = *sscan++))
- + continue;
- + while (--count >= 0)
- + *dscan++ = *_wnull;
- + return(dst);
- + }
- *** /dev/null Wed Oct 20 12:09:50 1993
- --- wcslen.c Mon Oct 4 13:55:44 1993
- ***************
- *** 0 ****
- --- 1,18 ----
- + /* from Henry Spencer's stringlib */
- + #include <stddef.h>
- + #include <stdlib.h>
- +
- + /*
- + * wcslen - length of string (not including NUL)
- + */
- + size_t
- + wcslen(scan)
- + register const wchar_t *scan;
- + {
- + register const wchar_t *start = scan+1;
- +
- + if (scan == NULL) return 0;
- + while (*scan++)
- + continue;
- + return (size_t)((long)scan - (long)start);
- + }
- *** /dev/null Wed Oct 20 12:10:14 1993
- --- wnull.c Wed Oct 6 13:39:54 1993
- ***************
- *** 0 ****
- --- 1,5 ----
- + /* This will avoid the construct L"". */
- +
- + #include <stddef.h>
- +
- + const wchar_t _wnull[1] = { 0 };
-