home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / lib / mlib38d.zoo / diffc next >
Encoding:
Text File  |  1993-10-20  |  40.2 KB  |  1,658 lines

  1. diff -cr ../mntlib37/Changelog ./Changelog
  2. *** ../mntlib37/Changelog    Wed Oct 20 11:09:56 1993
  3. --- ./Changelog    Wed Oct 20 03:48:16 1993
  4. ***************
  5. *** 4,9 ****
  6. --- 4,61 ----
  7.   Changes are listed in *reverse* order, most recent changes being
  8.   first.
  9.   
  10. + PATCHLEVEL38::
  11. + symlink.c:
  12. +     Set errno properly for readlink() on a non-link (EINVAL not EACCES).
  13. + lattice/setjmp.s: ++pvt1-117
  14. +     Add sigsetjmp() and siglongjmp() for lattice.
  15. + compiler.h: ++pvt1-117
  16. +     Make LCC do the right thing in limits.h.
  17. + termios.h, tcattr.c:
  18. +     Add VLNEXT and VWERASE control chars.
  19. + types.h: ++roemer@hera.rbi.informatik.uni-frankfurt.de.uni-frankfurt.de
  20. +     Add fd_set type and related macros.
  21. + falcon.h: ++Markus_Kilbinger@ac.maus.de
  22. +     Change return types of VsetMask() and Dsp_Reserve() from
  23. +     void to short.
  24. + _mulsi3.s, _umulsi3.s: ++schwab
  25. +     .lmul and .ulmul aren't equivalent.
  26. + read.c, write.c: ++schwab
  27. +     Reduce drag.  Also alias read to _read and write to _write
  28. +     when __GNUC__ && !__MSHORT__.
  29. + popen.c: ++schwab
  30. +     Reduce drag.  Also simplify code by using waitpid().
  31. + open.c: ++schwab
  32. +     Pass as many flags as possible through to MiNT, and let it decide
  33. +     what to do with them.  Only fall back on emulation if we can't pa a
  34. +     given flag.
  35. + ioctl.c, stat.c: ++schwab
  36. +     Reduce drag.
  37. + rename.c: ++schwab
  38. +     Try to preserve the old file under the new name as long as possible,
  39. +     in case an error occurs. Unfortunately we cannot determine exactly
  40. +     why Frename() failed, so this is not perfect (bug?).  Also, reduce
  41. +     library drag.
  42. + alarm.c: ++schwab
  43. +     Use Talarm() instead of alarm() to reduce drag.  Also
  44. +     fix a bug in the code for old versions of MiNT. [I messed with
  45. +     this a lot to get some more error checking and also added some
  46. +     comments. -entropy]
  47. + wait.h: ++schwab@ls5.informatik.uni-dortmund.de
  48. +     Make the wait prototype indirection more robust.  Also fix the
  49. +     definition of WIFSIGNALED().
  50. + wait3.c:
  51. +     Remove bogus usage of non-existent rusage value added in PL37.
  52. + falcon.h: ++pvt1-117
  53. +     Inline traps for Lattice.
  54. + wcmb.c: ++pvt1-117
  55. +     Use _wnull from wnull.c instead of a local variable.
  56. + wcscat.c, wcscmp.c, wcscpy.c, wcslen.c, wnull.c: ++pvt1-117
  57. +     NEW files for ISO wide char support.
  58. + stdlib.h: ++pvt1-117@nada.kth.se
  59. +     Add prototypes for new ISO widechar functions.
  60.   PATCHLEVEL37::
  61.   
  62.   bzero.cpp, mincl:
  63. ***************
  64. *** 59,65 ****
  65.       bit.
  66.   fscanf.c, scanf.c, sscanf.c, lib.h: ++schwab
  67.       The implementation of sscanf had a bug: the ungetc function would
  68. !     write into the format string passed to sscanf.  This is a Bad Thing,
  69.       since the string could be in readonly memory.  Also changed the
  70.       interface a bit so that there is less need for casts.  Strictly
  71.       speaking, the old way of casting the function pointers can result in
  72. --- 111,117 ----
  73.       bit.
  74.   fscanf.c, scanf.c, sscanf.c, lib.h: ++schwab
  75.       The implementation of sscanf had a bug: the ungetc function would
  76. !     write into the scanned string passed to sscanf.  This is a Bad Thing,
  77.       since the string could be in readonly memory.  Also changed the
  78.       interface a bit so that there is less need for casts.  Strictly
  79.       speaking, the old way of casting the function pointers can result in
  80. diff -cr ../mntlib37/Files ./Files
  81. *** ../mntlib37/Files    Wed Oct 20 11:09:58 1993
  82. --- ./Files    Mon Oct 18 11:07:10 1993
  83. ***************
  84. *** 9,19 ****
  85.   _cmpsf2.cpp    binmode.c    ftw.c        mktemp.c    stricmp.c
  86.   _divdf3.cpp    bsearch.c    fungetc.c    modf.cpp    strlen.c
  87.   _divmods.s    bzero.cpp    fwrite.c    nlist.c        strlwr.c
  88. ! _divsf3.cpp    calloc.c    gbl-ctors.h            strncat.c
  89. ! _extends.cpp    chdir.c        getbuf.c    obstack.c    strncmp.c
  90. ! _fixdfsi.cpp    chmod.c        getenv.c    perror.c    strncpy.c
  91. !         ctermid.c    getlogin.c    pgrp.c
  92. !                         printf.c
  93.   _fixsfsi.cpp    ctime.c        getopt.c    psignal.c    strnicmp.c
  94.   _fltsi.cpp    ctype.c        getpass.c    putenv.c    strpbrk.c
  95.   _fltsisf.cpp    cuserid.c    getpid.c    qsort.c        strrchr.c
  96. --- 9,18 ----
  97.   _cmpsf2.cpp    binmode.c    ftw.c        mktemp.c    stricmp.c
  98.   _divdf3.cpp    bsearch.c    fungetc.c    modf.cpp    strlen.c
  99.   _divmods.s    bzero.cpp    fwrite.c    nlist.c        strlwr.c
  100. ! _divsf3.cpp    calloc.c    gbl-ctors.h    obstack.c    strncat.c
  101. ! _extends.cpp    chdir.c        getbuf.c    perror.c    strncmp.c
  102. ! _fixdfsi.cpp    chmod.c        getenv.c    pgrp.c        strncpy.c
  103. !         ctermid.c    getlogin.c    printf.c
  104.   _fixsfsi.cpp    ctime.c        getopt.c    psignal.c    strnicmp.c
  105.   _fltsi.cpp    ctype.c        getpass.c    putenv.c    strpbrk.c
  106.   _fltsisf.cpp    cuserid.c    getpid.c    qsort.c        strrchr.c
  107. ***************
  108. *** 25,44 ****
  109.   _negdf2.s    eprintf.c    gnulib2.c    regsup.c    strtoul.c
  110.                                   strupr.c
  111.   _negsf2.s    errbase.h    grp.c        sbrk.c        system.c
  112. ! _normdf.cpp    fclose.c    ic.c        setbuf.c    sysvar.c
  113. ! _normsf.cpp    fdopen.c            setjmp.cpp    textio.c
  114.   _truncdf.cpp    fflush.c    ig.c        setlocal.c    time.c
  115.   _udivmod.s    ffs.c        il.c        setvbuf.c    timeoday.c
  116.   _umulsi3.s    fgetc.c        ip.c        sgtty.c        tmpfile.c
  117. ! a64l.c        fgets.c
  118. ! abort.c        filbuf.c    iw.c        siglist.c    tmpnam.c
  119. ! abs.c        findfile.c    ldexp.cpp    sprintf.c    toxxx.c
  120. ! access.c    flonum.h    lib.h        stksiz.c    utime.c
  121. ! alglobal.c    fopen.c        libgcc1.c    strcat.c
  122. !                 libgcc2.c            vfprintf.c
  123. ! alloca.cpp    fprintf.c    linea.c        strchr.c    vprintf.c
  124. ! alphasor.c    fputc.c        localtim.c    strcmp.c    wcmb.c
  125. !                 longlong.h
  126.   
  127.   MiNT library:
  128.   
  129. --- 24,45 ----
  130.   _negdf2.s    eprintf.c    gnulib2.c    regsup.c    strtoul.c
  131.                                   strupr.c
  132.   _negsf2.s    errbase.h    grp.c        sbrk.c        system.c
  133. ! _normdf.cpp    fclose.c            setbuf.c    sysvar.c
  134. ! _normsf.cpp    fdopen.c    ic.c        setjmp.cpp    textio.c
  135.   _truncdf.cpp    fflush.c    ig.c        setlocal.c    time.c
  136.   _udivmod.s    ffs.c        il.c        setvbuf.c    timeoday.c
  137.   _umulsi3.s    fgetc.c        ip.c        sgtty.c        tmpfile.c
  138. ! a64l.c        fgets.c                        tmpnam.c
  139. ! abort.c        filbuf.c    iw.c        siglist.c    toxxx.c    
  140. ! abs.c        findfile.c    ldexp.cpp    sprintf.c    utime.c
  141. ! access.c    flonum.h    lib.h        stksiz.c    vfprintf.c
  142. ! alglobal.c    fopen.c        libgcc1.c    strcat.c    vprintf.c
  143. !                 libgcc2.c            wcmb.c
  144. ! alloca.cpp    fprintf.c    linea.c        strchr.c    wcscat.c
  145. ! alphasor.c    fputc.c        localtim.c    strcmp.c    wcscmp.c
  146. !                 longlong.h            wcscpy.c
  147. !                                 wcslen.c
  148. !                                 wnull.c
  149.   
  150.   MiNT library:
  151.   
  152. diff -cr ../mntlib37/PatchLev.h ./PatchLev.h
  153. *** ../mntlib37/PatchLev.h    Wed Oct 20 11:10:06 1993
  154. --- ./PatchLev.h    Tue Oct 12 17:23:52 1993
  155. ***************
  156. *** 3,6 ****
  157.    *    directory.
  158.    */
  159.   
  160. ! #define PatchLevel "37"
  161. --- 3,6 ----
  162.    *    directory.
  163.    */
  164.   
  165. ! #define PatchLevel "38"
  166. diff -cr ../mntlib37/_mulsi3.s ./_mulsi3.s
  167. *** ../mntlib37/_mulsi3.s    Wed Oct 20 11:10:20 1993
  168. --- ./_mulsi3.s    Wed Oct 13 20:08:38 1993
  169. ***************
  170. *** 11,20 ****
  171.   
  172.       .text
  173.       .even
  174. !     .globl    __mulsi3, ___mulsi3, .lmul, .ulmul
  175.   
  176.   .lmul:
  177. - .ulmul:
  178.   __mulsi3:
  179.   ___mulsi3:
  180.       movel    d2,a0        | save registers
  181. --- 11,19 ----
  182.   
  183.       .text
  184.       .even
  185. !     .globl    __mulsi3, ___mulsi3, .lmul
  186.   
  187.   .lmul:
  188.   __mulsi3:
  189.   ___mulsi3:
  190.       movel    d2,a0        | save registers
  191. diff -cr ../mntlib37/_umulsi3.s ./_umulsi3.s
  192. *** ../mntlib37/_umulsi3.s    Wed Oct 20 11:10:24 1993
  193. --- ./_umulsi3.s    Wed Oct 13 20:08:42 1993
  194. ***************
  195. *** 11,18 ****
  196.   
  197.       .text
  198.       .even
  199. !     .globl    __umulsi3, ___umulsi3
  200.   
  201.   __umulsi3:
  202.   ___umulsi3:
  203.       movel    d2,a0        | save registers
  204. --- 11,19 ----
  205.   
  206.       .text
  207.       .even
  208. !     .globl    __umulsi3, ___umulsi3, .ulmul
  209.   
  210. + .ulmul:
  211.   __umulsi3:
  212.   ___umulsi3:
  213.       movel    d2,a0        | save registers
  214. diff -cr ../mntlib37/ioctl.c ./ioctl.c
  215. *** ../mntlib37/ioctl.c    Wed Oct 20 11:11:26 1993
  216. --- ./ioctl.c    Wed Oct 13 19:57:26 1993
  217. ***************
  218. *** 64,79 ****
  219.                   errno = EBADF;
  220.                   return -1;
  221.               }
  222. !             (void) close(fd);
  223. !             null_fd = open("/dev/null", O_RDWR | O_NOCTTY);
  224.               (void) Fforce(-1, null_fd);
  225. !             __open_stat[__OPEN_INDEX(-1)] =
  226. !                 __open_stat[__OPEN_INDEX(null_fd)];
  227.               if (null_fd != fd) {
  228.                   (void) Fforce(fd, null_fd);
  229. !                 __open_stat[__OPEN_INDEX(fd)] =
  230. !                     __open_stat[__OPEN_INDEX(null_fd)];
  231. !                 (void) close(null_fd);
  232.               }
  233.               return 0;
  234.           }
  235. --- 64,78 ----
  236.                   errno = EBADF;
  237.                   return -1;
  238.               }
  239. !             (void) Fclose(fd);
  240. !             null_fd = Fopen(__mint < 9 ? "V:\\null"
  241. !                     : "U:\\dev\\null", O_RDWR);
  242.               (void) Fforce(-1, null_fd);
  243. !             __open_stat[__OPEN_INDEX(-1)].status = FH_UNKNOWN;
  244. !             __open_stat[__OPEN_INDEX(fd)].status = FH_UNKNOWN;
  245.               if (null_fd != fd) {
  246.                   (void) Fforce(fd, null_fd);
  247. !                 (void) Fclose(null_fd);
  248.               }
  249.               return 0;
  250.           }
  251. diff -cr ../mntlib37/lattice/mc.prj ./lattice/mc.prj
  252. *** ../mntlib37/lattice/mc.prj    Wed Oct 20 11:11:38 1993
  253. --- ./lattice/mc.prj    Tue Oct 12 18:47:28 1993
  254. ***************
  255. *** 195,200 ****
  256. --- 195,205 ----
  257.   ..\WAIT3.C
  258.   ..\WAITPID.C
  259.   ..\WCMB.C
  260. + ..\WCSCAT.C
  261.  
  262. + ..\WCSCMP.C
  263.  
  264. + ..\WCSCPY.C
  265.  
  266. + ..\WCSLEN.C
  267.  
  268. + ..\WNULL.C
  269.  
  270.   ..\WRITE.C
  271.   ..\WTMP.C
  272.   ALLOCA.C
  273. diff -cr ../mntlib37/lattice/mc3.prj ./lattice/mc3.prj
  274. *** ../mntlib37/lattice/mc3.prj    Wed Oct 20 11:11:38 1993
  275. --- ./lattice/mc3.prj    Tue Oct 12 18:47:30 1993
  276. ***************
  277. *** 195,200 ****
  278. --- 195,205 ----
  279.   ..\WAIT3.C
  280.   ..\WAITPID.C
  281.   ..\WCMB.C
  282. + ..\WCSCAT.C
  283.  
  284. + ..\WCSCMP.C
  285.  
  286. + ..\WCSCPY.C
  287.  
  288. + ..\WCSLEN.C
  289.  
  290. + ..\WNULL.C
  291.  
  292.   ..\WRITE.C
  293.   ..\WTMP.C
  294.   ALLOCA.C
  295. diff -cr ../mntlib37/lattice/mcnb.prj ./lattice/mcnb.prj
  296. *** ../mntlib37/lattice/mcnb.prj    Wed Oct 20 11:11:40 1993
  297. --- ./lattice/mcnb.prj    Tue Oct 12 18:47:34 1993
  298. ***************
  299. *** 195,200 ****
  300. --- 195,205 ----
  301.   ..\WAIT3.C
  302.   ..\WAITPID.C
  303.   ..\WCMB.C
  304. + ..\WCSCAT.C
  305.  
  306. + ..\WCSCMP.C
  307.  
  308. + ..\WCSCPY.C
  309.  
  310. + ..\WCSLEN.C
  311.  
  312. + ..\WNULL.C
  313.  
  314.   ..\WRITE.C
  315.   ..\WTMP.C
  316.   ALLOCA.C
  317. diff -cr ../mntlib37/lattice/mcnb3.prj ./lattice/mcnb3.prj
  318. *** ../mntlib37/lattice/mcnb3.prj    Wed Oct 20 11:11:40 1993
  319. --- ./lattice/mcnb3.prj    Tue Oct 12 18:47:36 1993
  320. ***************
  321. *** 195,200 ****
  322. --- 195,205 ----
  323.   ..\WAIT3.C
  324.   ..\WAITPID.C
  325.   ..\WCMB.C
  326. + ..\WCSCAT.C
  327.  
  328. + ..\WCSCMP.C
  329.  
  330. + ..\WCSCPY.C
  331.  
  332. + ..\WCSLEN.C
  333.  
  334. + ..\WNULL.C
  335.  
  336.   ..\WRITE.C
  337.   ..\WTMP.C
  338.   ALLOCA.C
  339. diff -cr ../mntlib37/lattice/mcr.prj ./lattice/mcr.prj
  340. *** ../mntlib37/lattice/mcr.prj    Wed Oct 20 11:11:40 1993
  341. --- ./lattice/mcr.prj    Tue Oct 12 18:47:38 1993
  342. ***************
  343. *** 195,200 ****
  344. --- 195,205 ----
  345.   ..\WAIT3.C
  346.   ..\WAITPID.C
  347.   ..\WCMB.C
  348. + ..\WCSCAT.C
  349.  
  350. + ..\WCSCMP.C
  351.  
  352. + ..\WCSCPY.C
  353.  
  354. + ..\WCSLEN.C
  355.  
  356. + ..\WNULL.C
  357.  
  358.   ..\WRITE.C
  359.   ..\WTMP.C
  360.   ALLOCA.C
  361. diff -cr ../mntlib37/lattice/mcr3.prj ./lattice/mcr3.prj
  362. *** ../mntlib37/lattice/mcr3.prj    Wed Oct 20 11:11:42 1993
  363. --- ./lattice/mcr3.prj    Tue Oct 12 18:47:40 1993
  364. ***************
  365. *** 195,200 ****
  366. --- 195,205 ----
  367.   ..\WAIT3.C
  368.   ..\WAITPID.C
  369.   ..\WCMB.C
  370. + ..\WCSCAT.C
  371.  
  372. + ..\WCSCMP.C
  373.  
  374. + ..\WCSCPY.C
  375.  
  376. + ..\WCSLEN.C
  377.  
  378. + ..\WNULL.C
  379.  
  380.   ..\WRITE.C
  381.   ..\WTMP.C
  382.   ALLOCA.C
  383. diff -cr ../mntlib37/lattice/mcrnb.prj ./lattice/mcrnb.prj
  384. *** ../mntlib37/lattice/mcrnb.prj    Wed Oct 20 11:11:42 1993
  385. --- ./lattice/mcrnb.prj    Tue Oct 12 18:47:44 1993
  386. ***************
  387. *** 195,200 ****
  388. --- 195,205 ----
  389.   ..\WAIT3.C
  390.   ..\WAITPID.C
  391.   ..\WCMB.C
  392. + ..\WCSCAT.C
  393.  
  394. + ..\WCSCMP.C
  395.  
  396. + ..\WCSCPY.C
  397.  
  398. + ..\WCSLEN.C
  399.  
  400. + ..\WNULL.C
  401.  
  402.   ..\WRITE.C
  403.   ..\WTMP.C
  404.   ALLOCA.C
  405. diff -cr ../mntlib37/lattice/mcrnb3.prj ./lattice/mcrnb3.prj
  406. *** ../mntlib37/lattice/mcrnb3.prj    Wed Oct 20 11:11:42 1993
  407. --- ./lattice/mcrnb3.prj    Tue Oct 12 18:47:46 1993
  408. ***************
  409. *** 195,200 ****
  410. --- 195,205 ----
  411.   ..\WAIT3.C
  412.   ..\WAITPID.C
  413.   ..\WCMB.C
  414. + ..\WCSCAT.C
  415.  
  416. + ..\WCSCMP.C
  417.  
  418. + ..\WCSCPY.C
  419.  
  420. + ..\WCSLEN.C
  421.  
  422. + ..\WNULL.C
  423.  
  424.   ..\WRITE.C
  425.   ..\WTMP.C
  426.   ALLOCA.C
  427. diff -cr ../mntlib37/lattice/mcs.prj ./lattice/mcs.prj
  428. *** ../mntlib37/lattice/mcs.prj    Wed Oct 20 11:11:44 1993
  429. --- ./lattice/mcs.prj    Tue Oct 12 18:47:48 1993
  430. ***************
  431. *** 195,200 ****
  432. --- 195,205 ----
  433.   ..\WAIT3.C
  434.   ..\WAITPID.C
  435.   ..\WCMB.C
  436. + ..\WCSCAT.C
  437.  
  438. + ..\WCSCMP.C
  439.  
  440. + ..\WCSCPY.C
  441.  
  442. + ..\WCSLEN.C
  443.  
  444. + ..\WNULL.C
  445.  
  446.   ..\WRITE.C
  447.   ..\WTMP.C
  448.   ALLOCA.C
  449. diff -cr ../mntlib37/lattice/mcsnb.prj ./lattice/mcsnb.prj
  450. *** ../mntlib37/lattice/mcsnb.prj    Wed Oct 20 11:11:44 1993
  451. --- ./lattice/mcsnb.prj    Tue Oct 12 18:47:52 1993
  452. ***************
  453. *** 195,200 ****
  454. --- 195,205 ----
  455.   ..\WAIT3.C
  456.   ..\WAITPID.C
  457.   ..\WCMB.C
  458. + ..\WCSCAT.C
  459.  
  460. + ..\WCSCMP.C
  461.  
  462. + ..\WCSCPY.C
  463.  
  464. + ..\WCSLEN.C
  465.  
  466. + ..\WNULL.C
  467.  
  468.   ..\WRITE.C
  469.   ..\WTMP.C
  470.   ALLOCA.C
  471. diff -cr ../mntlib37/lattice/mcsr.prj ./lattice/mcsr.prj
  472. *** ../mntlib37/lattice/mcsr.prj    Wed Oct 20 11:11:44 1993
  473. --- ./lattice/mcsr.prj    Tue Oct 12 18:47:54 1993
  474. ***************
  475. *** 195,200 ****
  476. --- 195,205 ----
  477.   ..\WAIT3.C
  478.   ..\WAITPID.C
  479.   ..\WCMB.C
  480. + ..\WCSCAT.C
  481.  
  482. + ..\WCSCMP.C
  483.  
  484. + ..\WCSCPY.C
  485.  
  486. + ..\WCSLEN.C
  487.  
  488. + ..\WNULL.C
  489.  
  490.   ..\WRITE.C
  491.   ..\WTMP.C
  492.   ALLOCA.C
  493. diff -cr ../mntlib37/lattice/mcsrnb.prj ./lattice/mcsrnb.prj
  494. *** ../mntlib37/lattice/mcsrnb.prj    Wed Oct 20 11:11:46 1993
  495. --- ./lattice/mcsrnb.prj    Tue Oct 12 18:47:56 1993
  496. ***************
  497. *** 195,200 ****
  498. --- 195,205 ----
  499.   ..\WAIT3.C
  500.   ..\WAITPID.C
  501.   ..\WCMB.C
  502. + ..\WCSCAT.C
  503.  
  504. + ..\WCSCMP.C
  505.  
  506. + ..\WCSCPY.C
  507.  
  508. + ..\WCSLEN.C
  509.  
  510. + ..\WNULL.C
  511.  
  512.   ..\WRITE.C
  513.   ..\WTMP.C
  514.   ALLOCA.C
  515. diff -cr ../mntlib37/lattice/setjmp.s ./lattice/setjmp.s
  516. *** ../mntlib37/lattice/setjmp.s    Wed Oct 20 11:12:00 1993
  517. --- ./lattice/setjmp.s    Mon Oct 18 22:20:44 1993
  518. ***************
  519. *** 1,60 ****
  520.       INCLUDE    inc.i
  521.       
  522.       INFO
  523.       xref    ___mint
  524.   
  525.   ;
  526.   ; setjmp.cpp 
  527.   ;
  528.       CODE
  529.       IF    _REGARG
  530.       xdef    @setjmp
  531.       ELSE
  532.       xdef    _setjmp
  533.       ENDC
  534.       
  535.       IF    _REGARG
  536.   @setjmp:
  537.       ELSE
  538.   _setjmp:
  539. !     move.l    4(sp),a0        ; address of jmp_buf[]
  540.       ENDC
  541.       move.l    (sp),(a0)        ; save return address
  542.       movem.l    d2-d7/a2-a7,4(a0)    ; save registers d2-d7/a2-a7
  543. !     clr.l    d0            ; return value is 0
  544.       rts
  545.   
  546. !     IF    _REGARG
  547. !     xdef    @longjmp
  548. !     ELSE
  549. !     xdef    _longjmp
  550. !     ENDC
  551. !     
  552.       IF    _REGARG
  553.   @longjmp:
  554.       ELSE
  555.   _longjmp:
  556.       ENDC
  557.       IF    _SHORT
  558. !     tst.w    ___mint            ; see if MiNT is active
  559.       ELSE
  560.       tst.l    ___mint
  561.       ENDC
  562. !     beq.s    NOMINT            ; no -- do not call sigreturn
  563.       move.w    #$11a,-(sp)        ; Psigreturn() system call
  564.       trap    #1            ; (ignored if not in a sig handler)
  565.       addq.w    #2,sp
  566. ! NOMINT:
  567. !     move.l    4(sp),a0        ; address of jmp_buf[]
  568.       IF    _SHORT
  569. !     move.w    8(sp),d0        ; value to return
  570.       ELSE
  571. !     move.l    8(sp),d0        ; value to return
  572.       ENDC
  573. !     bne.s    L1            ; may not be 0
  574. !     move.l    #1,d0
  575.   L1:
  576.       movem.l    4(a0),d2-d7/a2-a7    ; restore saved reggies
  577.       move.l    (a0),(sp)        ; and the saved return address
  578. !     rts
  579.       end
  580. --- 1,161 ----
  581.       INCLUDE    inc.i
  582.       
  583.       INFO
  584.       xref    ___mint
  585. +     xref    __sigmask
  586.   
  587.   ;
  588.   ; setjmp.cpp 
  589.   ;
  590.       CODE
  591.       IF    _REGARG
  592.       xdef    @setjmp
  593. +     xdef    @longjmp
  594. +     xdef    @sigsetjmp
  595. +     xdef    @siglongjmp
  596.       ELSE
  597.       xdef    _setjmp
  598. +     xdef    _longjmp
  599. +     xdef    _sigsetjmp
  600. +     xdef    _siglongjmp
  601. +     ENDC
  602. +     ; sigsetjmp(sigjmp_buf env, int savemask)
  603. +     ; address of sigjmp_buf will be in a0
  604. +     ; savemask will be in d0/a1 (signextended)
  605. +     IF    _REGARG
  606. + @sigsetjmp:
  607. +     IF    _SHORT
  608. +     ext.l    d0
  609. +     ENDC
  610. +     move.l    d0,52(a0)        ; save sigmask for siglongjmp?
  611. +     ELSE
  612. + _sigsetjmp:
  613. +     move.l    4(sp),a0        
  614. +     IF    _SHORT
  615. +     move.w    8(sp),a1
  616. +     ELSE
  617. +     move.l    8(sp),a1
  618. +     ENDC
  619. +     move.l    a1,52(a0)        ; save sigmask for siglongjmp?
  620.       ENDC
  621.       
  622. +     beq.w    Common            ; no -- call common code
  623. +     
  624. +     move.l    __sigmask,d0        ; save tos emulation signal mask
  625. +     ; see if MiNT is active
  626. +     IF    _SHORT
  627. +     tst.w    ___mint
  628. +     ELSE
  629. +     tst.l    ___mint
  630. +     ENDC
  631. +     beq.w    SSJ_nomint        ; no -- skip Psigblock
  632. +     clr.l    -(sp)            ; add no signals to sigmask
  633. +     move.w    #$116,-(sp)        ; Psigblock() system call
  634. +     trap    #1
  635. +     addq    #6,sp
  636. + SSJ_nomint:
  637. +     bset    #0,d0            ; make it != 0 (SIGNULL is unmaskable)
  638. +     move.l    d0,52(a0)        ; save signal mask
  639. +     bra    Common            ; call code common with setjmp
  640. +     ; setjmp(sigjmp_buf env)
  641. +     ; address of jmp_buf will be in a0
  642.       IF    _REGARG
  643.   @setjmp:
  644.       ELSE
  645.   _setjmp:
  646. !     move.l    4(sp),a0
  647.       ENDC
  648. +     
  649. +     clr.l    52(a0)            ; do not restore sigmask on longjmp
  650. + Common:
  651.       move.l    (sp),(a0)        ; save return address
  652.       movem.l    d2-d7/a2-a7,4(a0)    ; save registers d2-d7/a2-a7
  653. !     moveq    #0,d0            ; return value is 0
  654.       rts
  655.   
  656. !     ; siglongjmp(sigjmpbuf env, int retval)
  657. !     ; longjmp(sigjmpbuf env, int retval)
  658.       IF    _REGARG
  659.   @longjmp:
  660. + @siglongjmp:
  661.       ELSE
  662.   _longjmp:
  663. + _siglongjmp:
  664.       ENDC
  665. +     ; see if MiNT is active
  666.       IF    _SHORT
  667. !     tst.w    ___mint    
  668.       ELSE
  669.       tst.l    ___mint
  670.       ENDC
  671. !     
  672. !     beq.w    LJ_nomint        ; no -- do not call Psigreturn
  673. !     
  674. !     IF    _REGARG            ; save d0,a0 before Psigreturn
  675. !     IF    _SHORT
  676. !     move.w    d0,-(sp)
  677. !     ELSE
  678. !     move.l    d0,-(sp)
  679. !     ENDC
  680. !     move.l    a0,-(sp)
  681. !     ENDC
  682.       move.w    #$11a,-(sp)        ; Psigreturn() system call
  683.       trap    #1            ; (ignored if not in a sig handler)
  684.       addq.w    #2,sp
  685. !     
  686. ! LJ_nomint:
  687. !     ; address of jmpbuf in a0
  688. !     IF    _REGARG
  689. !     move.l    (sp),a0
  690. !     ELSE
  691. !     move.l    4(sp),a0        
  692. !     ENDC
  693. !     
  694. !     move.l    52(a0),d0        ; want to restore sigmask?
  695. !     beq.w    Norestore        ; no -- skip restore code
  696. !     bclr    #0,d0            ; dump SIGNUL
  697. !     move.l    d0,__sigmask        ; restore tos emulation signal mask
  698. !     
  699. !     ; see if MiNT is active
  700.       IF    _SHORT
  701. !     tst.w    ___mint
  702.       ELSE
  703. !     tst.l    ___mint
  704. !     ENDC
  705. !     beq.w    Norestore        ; no -- do not call Psigblock
  706. !     move.l    d0,-(sp)        ; add no signals to sigmask
  707. !     move.w    #$117,-(sp)        ; Psigblock() system call
  708. !     trap    #1
  709. !     addq    #6,sp
  710. !     move.l    (sp),a0            ; restore a0 == jmpbuf
  711. ! Norestore:
  712. !     ; value to return in d0 ...
  713. !     IF    _REGARG
  714. !     IF    _SHORT
  715. !     move.w    4(sp),d0
  716. !     ELSE
  717. !     move.l    4(sp),d0
  718. !     ENDC
  719. !     ELSE
  720. !     IF    _SHORT
  721. !     move.w    8(sp),d0
  722. !     ELSE
  723. !     move.l    8(sp),d0
  724.       ENDC
  725. !     ENDC
  726. !     
  727. !     bne.w    L1            ; ... may not be 0
  728. !     moveq    #1,d0
  729.   L1:
  730.       movem.l    4(a0),d2-d7/a2-a7    ; restore saved reggies
  731.       move.l    (a0),(sp)        ; and the saved return address
  732. !     rts                ; will restore a7
  733.       end
  734. diff -cr ../mntlib37/mincl ./mincl
  735. *** ../mntlib37/mincl    Wed Oct 20 11:12:20 1993
  736. --- ./mincl    Tue Oct 12 18:53:58 1993
  737. ***************
  738. *** 38,44 ****
  739.       scanf.o sscanf.o setbuf.o setvbuf.o \
  740.       setlocal.o sprintf.o strftime.o strtol.o strtoul.o system.o \
  741.       tmpnam.o tmpfile.o toxxx.o \
  742. !     vfprintf.o vprintf.o wcmb.o
  743.   
  744.   #
  745.   # other miscellaneous stuff
  746. --- 38,45 ----
  747.       scanf.o sscanf.o setbuf.o setvbuf.o \
  748.       setlocal.o sprintf.o strftime.o strtol.o strtoul.o system.o \
  749.       tmpnam.o tmpfile.o toxxx.o \
  750. !     vfprintf.o vprintf.o wcmb.o \
  751. !     wcscat.o wcscmp.o wcscpy.o wcslen.o wnull.o
  752.   
  753.   #
  754.   # other miscellaneous stuff
  755. diff -cr ../mntlib37/open.c ./open.c
  756. *** ../mntlib37/open.c    Wed Oct 20 11:12:26 1993
  757. --- ./open.c    Wed Oct 13 19:41:06 1993
  758. ***************
  759. *** 78,84 ****
  760.       iomode = iomode & ~O_SHMODE;
  761.   
  762.       if (__mint >= 9) {
  763. !         modemask = O_ACCMODE | O_SHMODE | O_SYNC | O_NDELAY;
  764.           iomode |= (iomode & O_EXCL) ? O_DENYRW : O_DENYNONE;
  765.           if (__mint >= 96) {
  766.               modemask |= _REALO_APPEND;
  767. --- 78,84 ----
  768.       iomode = iomode & ~O_SHMODE;
  769.   
  770.       if (__mint >= 9) {
  771. !         modemask = O_ACCMODE | O_SHMODE | O_SYNC | O_NDELAY | O_CREAT | O_TRUNC;
  772.           iomode |= (iomode & O_EXCL) ? O_DENYRW : O_DENYNONE;
  773.           if (__mint >= 96) {
  774.               modemask |= _REALO_APPEND;
  775. ***************
  776. *** 96,102 ****
  777.               return -1;
  778.           }
  779.           rv = (int)Fopen(filename,iomode & modemask);
  780. !         if ((iomode & O_TRUNC) && (rv >= 0)) {
  781.               /* Give up if the mode flags conflict */
  782.               if (iomode & O_RDONLY) {
  783.                   (void)Fclose(rv);
  784. --- 96,102 ----
  785.               return -1;
  786.           }
  787.           rv = (int)Fopen(filename,iomode & modemask);
  788. !         if ((iomode & ~modemask & O_TRUNC) && (rv >= 0)) {
  789.               /* Give up if the mode flags conflict */
  790.               if (iomode & O_RDONLY) {
  791.                   (void)Fclose(rv);
  792. ***************
  793. *** 123,142 ****
  794.       else                    /* file doesn't exist */
  795.       {
  796.           if(iomode & O_CREAT) {
  797. !             rv = (int)Fcreate(filename, 0x00);
  798. !             if (rv >= 0) {
  799.                   (void)Fclose(rv);
  800.                   rv = (int)Fopen(filename,iomode & modemask);
  801. !                 if (rv >= 0 && __mint >= 9)
  802. !                     (void)Fchmod(filename, pmode);
  803.               }
  804.           }
  805.           else
  806.               rv = -ENOENT;
  807.       }
  808.   
  809. !     if((rv >= 0) && (iomode & O_APPEND))
  810. !         (void)lseek(rv, 0L, SEEK_END);
  811.   
  812.       if(rv < (__SMALLEST_VALID_HANDLE)) {
  813.           errno = -rv;
  814. --- 123,146 ----
  815.       else                    /* file doesn't exist */
  816.       {
  817.           if(iomode & O_CREAT) {
  818. !             if (__mint >= 9)
  819. !               rv = (int) Fopen (filename, iomode & modemask);
  820. !             else {
  821. !                 rv = (int)Fcreate(filename, 0x00);
  822. !                 if (rv >= 0) {
  823.                   (void)Fclose(rv);
  824.                   rv = (int)Fopen(filename,iomode & modemask);
  825. !                 }
  826.               }
  827. +             if (rv >= 0 && __mint >= 9)
  828. +                 (void)Fchmod(filename, pmode);
  829.           }
  830.           else
  831.               rv = -ENOENT;
  832.       }
  833.   
  834. !     if((rv >= 0) && (iomode & O_APPEND) && !(modemask & _REALO_APPEND))
  835. !         (void)Fseek(0L, rv, SEEK_END);
  836.   
  837.       if(rv < (__SMALLEST_VALID_HANDLE)) {
  838.           errno = -rv;
  839. diff -cr ../mntlib37/popen.c ./popen.c
  840. *** ../mntlib37/popen.c    Wed Oct 20 11:12:30 1993
  841. --- ./popen.c    Wed Oct 13 22:12:36 1993
  842. ***************
  843. *** 9,17 ****
  844.   #include    <string.h>
  845.   #include    <errno.h>
  846.   #include    <unistd.h>
  847.   
  848. - __EXTERN int wait __PROTO((int *));
  849.   struct _pipe {
  850.       int    pid;        /* process id of child            */
  851.       FILE    *pfile;        /* created file descriptor        */
  852. --- 9,18 ----
  853.   #include    <string.h>
  854.   #include    <errno.h>
  855.   #include    <unistd.h>
  856. + #include <sys/types.h>
  857. + #include <wait.h>
  858. + #include <mintbind.h>
  859.   
  860.   struct _pipe {
  861.       int    pid;        /* process id of child            */
  862.       FILE    *pfile;        /* created file descriptor        */
  863. ***************
  864. *** 24,30 ****
  865.   const char    *command, *type;
  866.   {
  867.       struct _pipe *p;    /* the new pipe's list entry    */
  868. !     int pipfd[2];        /* pipe file handles */
  869.       int savefd;        /* saved file descriptor for parent */
  870.       int kidfd;        /* file descriptor changed in child */
  871.                   /* 1 for "r", 0 for "w" */    
  872. --- 25,31 ----
  873.   const char    *command, *type;
  874.   {
  875.       struct _pipe *p;    /* the new pipe's list entry    */
  876. !     short pipfd[2];        /* pipe file handles */
  877.       int savefd;        /* saved file descriptor for parent */
  878.       int kidfd;        /* file descriptor changed in child */
  879.                   /* 1 for "r", 0 for "w" */    
  880. ***************
  881. *** 32,37 ****
  882. --- 33,39 ----
  883.       char *shell;
  884.       FILE *pipefile = 0;
  885.       extern int __mint;
  886. +     long r;
  887.   
  888.       if (__mint == 0) {
  889.           errno = EINVAL;
  890. ***************
  891. *** 49,71 ****
  892.       /* initialize the new pipe entry */
  893.       kidfd = (*type == 'r') ? 1 : 0;
  894.   
  895. !     savefd = dup(kidfd);
  896.       /* get those close-on-exec flags right...
  897.          (well just do fork/exec would be easier :-)    -nox */
  898.   
  899. !     if (savefd < 0 || fcntl (savefd, F_SETFD, (void *) 1) == -1 ||
  900. !         pipe(pipfd) != 0) {            /* can't create pipe?? */
  901.           free(p);
  902.           return (FILE *)0;
  903.       }
  904.   
  905.       /* other side of the pipe should be closed in the child */
  906. !     (void) fcntl(pipfd[1 - kidfd], F_SETFD, (void *) 1);
  907. !     dup2(pipfd[kidfd], kidfd);
  908. !     close(pipfd[kidfd]);
  909.       p->pid = spawnlp(P_NOWAIT, shell, shell, "-c", command, (char *)0);
  910. !     dup2(savefd, kidfd);
  911. !     close(savefd);
  912.   
  913.       if (p->pid > 0) {    /* command ran all right */
  914.       /* note: 1-kidfd tells us which handle to use in the parent */
  915. --- 51,74 ----
  916.       /* initialize the new pipe entry */
  917.       kidfd = (*type == 'r') ? 1 : 0;
  918.   
  919. !     savefd = r = Fdup (kidfd);
  920.       /* get those close-on-exec flags right...
  921.          (well just do fork/exec would be easier :-)    -nox */
  922.   
  923. !     if (r < 0 || (r = Fcntl (savefd, 1L, F_SETFD)) < 0 ||
  924. !         (r = Fpipe(pipfd)) < 0) {        /* can't create pipe?? */
  925.           free(p);
  926. +         errno = (int) -r;
  927.           return (FILE *)0;
  928.       }
  929.   
  930.       /* other side of the pipe should be closed in the child */
  931. !     (void) Fcntl(pipfd[1 - kidfd], (long) 1, F_SETFD);
  932. !     Fforce(kidfd, pipfd[kidfd]);
  933. !     Fclose(pipfd[kidfd]);
  934.       p->pid = spawnlp(P_NOWAIT, shell, shell, "-c", command, (char *)0);
  935. !     Fforce(kidfd, savefd);
  936. !     Fclose(savefd);
  937.   
  938.       if (p->pid > 0) {    /* command ran all right */
  939.       /* note: 1-kidfd tells us which handle to use in the parent */
  940. ***************
  941. *** 79,85 ****
  942.       }
  943.       else {
  944.           /* carefully release all resources */
  945. !         close (pipfd[1 - kidfd]);
  946.           free(p);
  947.       }
  948.       return pipefile;
  949. --- 82,90 ----
  950.       }
  951.       else {
  952.           /* carefully release all resources */
  953. !         Fclose (pipfd[1 - kidfd]);
  954. !         if (p->pid > 0)    /* just in case... */
  955. !           waitpid (p->pid, (int *) NULL, 0);
  956.           free(p);
  957.       }
  958.       return pipefile;
  959. ***************
  960. *** 93,99 ****
  961.       struct _pipe    *p,        /* the pipe's list element    */
  962.               **q;        /* predecessor of p in the list    */
  963.       int    status = -1;        /* return status of the command    */
  964. -     int    pid;
  965.   
  966.       /* search the pipe list for a pipe matching the FILE descriptor    */
  967.       for (p = __pipes, q = &__pipes;  p && p->pfile != fp;
  968. --- 98,103 ----
  969. ***************
  970. *** 104,113 ****
  971.       fclose(p->pfile);    /* close the connection        */
  972.   
  973.   /* now wait for the command to finish */
  974. !     do {
  975. !         pid = wait(&status);
  976. !     } while (pid >= 0 && pid != p->pid);
  977.   
  978.       /* remove the pipe from the list */
  979.       *q = p->pnext;
  980. --- 108,114 ----
  981.       fclose(p->pfile);    /* close the connection        */
  982.   
  983.   /* now wait for the command to finish */
  984. !     waitpid (p->pid, &status, 0);
  985.   
  986.       /* remove the pipe from the list */
  987.       *q = p->pnext;
  988. diff -cr ../mntlib37/read.c ./read.c
  989. *** ../mntlib37/read.c    Wed Oct 20 11:13:04 1993
  990. --- ./read.c    Wed Oct 13 20:01:48 1993
  991. ***************
  992. *** 10,15 ****
  993. --- 10,16 ----
  994.   #include <signal.h>
  995.   #include <unistd.h>
  996.   #include <support.h>
  997. + #include <mintbind.h>
  998.   #include "lib.h"
  999.   
  1000.   #define CTRL(x) (x & 0x1f)
  1001. ***************
  1002. *** 70,80 ****
  1003.           flags = -1;
  1004.   
  1005.       if ( (__mint > 0) || (flags  == -1) ||
  1006. !          ( ((flags & (RAW|CBREAK)) == 0) && (flags & ECHO) ) ) {
  1007.   #ifdef EIO
  1008.                   if (__mint && _isctty(fd)) {
  1009. !           (void) ioctl(fd, TIOCGPGRP, &tty_pgrp);
  1010. !           if (tty_pgrp != getpgrp()) {
  1011.   #if 0
  1012.               /* This isn't really what we mean here...we really want to
  1013.                  know if our process group has no controlling terminal.
  1014. --- 71,81 ----
  1015.           flags = -1;
  1016.   
  1017.       if ( (__mint > 0) || (flags  == -1) ||
  1018. !          ( ((flags & (RAW|CBREAK|ECHO)) == ECHO) ) ) {
  1019.   #ifdef EIO
  1020.                   if (__mint && _isctty(fd)) {
  1021. !           (void) Fcntl(fd, (long) &tty_pgrp, TIOCGPGRP);
  1022. !           if (tty_pgrp != Pgetpgrp()) {
  1023.   #if 0
  1024.               /* This isn't really what we mean here...we really want to
  1025.                  know if our process group has no controlling terminal.
  1026. ***************
  1027. *** 84,93 ****
  1028.                 return -1;
  1029.               }
  1030.   #endif
  1031. !             omask = sigblock(~0L);
  1032. !             osigt = signal(SIGTTIN, SIG_IGN);
  1033. !             (void) signal(SIGTTIN, osigt);
  1034. !             (void) sigsetmask(omask);
  1035.               if ((omask & sigmask(SIGTTIN)) || (osigt == SIG_IGN)) {
  1036.                 errno = EIO;
  1037.                 return -1;
  1038. --- 85,94 ----
  1039.                 return -1;
  1040.               }
  1041.   #endif
  1042. !             omask = Psigblock(~0L);
  1043. !             osigt = (__Sigfunc) Psignal(SIGTTIN, SIG_IGN);
  1044. !             (void) Psignal(SIGTTIN, (long) osigt);
  1045. !             (void) Psigsetmask(omask);
  1046.               if ((omask & sigmask(SIGTTIN)) || (osigt == SIG_IGN)) {
  1047.                 errno = EIO;
  1048.                 return -1;
  1049. ***************
  1050. *** 148,153 ****
  1051. --- 149,157 ----
  1052.       return r;
  1053.   }
  1054.   
  1055. + #if defined (__GNUC__) && !defined (__MSHORT__)
  1056. + __asm__ (".stabs \"_read\",5,0,0,__read");
  1057. + #else
  1058.   int
  1059.   read(fd, buf, size)
  1060.       int fd;
  1061. ***************
  1062. *** 156,158 ****
  1063. --- 160,163 ----
  1064.   {
  1065.       return (int) _read(fd, buf, (unsigned long)size);
  1066.   }
  1067. + #endif
  1068. diff -cr ../mntlib37/rename.c ./rename.c
  1069. *** ../mntlib37/rename.c    Wed Oct 20 11:13:08 1993
  1070. --- ./rename.c    Wed Oct 13 08:49:24 1993
  1071. ***************
  1072. *** 17,31 ****
  1073.           rval = 0;    /* no-op */
  1074.       }
  1075.   #endif
  1076. -     if (!access(_newname, 0)) {    /* new name already exists */
  1077. -         if (unlink(_newname))
  1078. -             return -1;
  1079. -     }
  1080.   
  1081.       _unx2dos(_oldname, oldname);
  1082.       _unx2dos(_newname, newname);
  1083.   
  1084. !     if ( (rval = Frename(0, oldname, newname)) < 0 ) {
  1085.           errno = -rval;
  1086.           rval = -1;
  1087.       }
  1088. --- 17,36 ----
  1089.           rval = 0;    /* no-op */
  1090.       }
  1091.   #endif
  1092.   
  1093.       _unx2dos(_oldname, oldname);
  1094.       _unx2dos(_newname, newname);
  1095.   
  1096. !     rval = Frename(0, oldname, newname);
  1097. !     if (rval == 0)
  1098. !       return 0;
  1099. !     if (rval != -EXDEV && rval != -ENOENT)
  1100. !       {
  1101. !         (void) Fdelete (newname);
  1102. !         rval = Frename(0, oldname, newname);
  1103. !       }
  1104. !     if (rval < 0) {
  1105.           errno = -rval;
  1106.           rval = -1;
  1107.       }
  1108. diff -cr ../mntlib37/sleep.c ./sleep.c
  1109. *** ../mntlib37/sleep.c    Wed Oct 20 11:13:18 1993
  1110. --- ./sleep.c    Thu Oct 14 01:53:00 1993
  1111. ***************
  1112. *** 7,18 ****
  1113. --- 7,36 ----
  1114.   #include <mintbind.h>
  1115.   #include <signal.h>
  1116.   #include <unistd.h>
  1117. + #include <limits.h>
  1118.   
  1119.   /* _clock() has a rez of CLOCKS_PER_SEC ticks/sec */
  1120.   
  1121.   #define USEC_PER_TICK (1000000L / ((unsigned long)CLOCKS_PER_SEC))
  1122.   #define    USEC_TO_CLOCK_TICKS(us)    ((us) / USEC_PER_TICK )
  1123.   
  1124. + static unsigned long _alarm __PROTO((unsigned long secs));
  1125. + static unsigned long
  1126. + _alarm(secs)
  1127. +     unsigned long secs;
  1128. + {
  1129. +     unsigned long r;
  1130. + #ifndef __MSHORT__
  1131. +     if (secs > ((unsigned long) (LONG_MAX/1000)))
  1132. +         secs = ((unsigned long) (LONG_MAX/1000));
  1133. + #endif
  1134. +     r = Talarm((long) secs);
  1135. +     return (unsigned long) r;
  1136. + }
  1137.   static void __CDECL alarm_catch __PROTO((long signum));
  1138.   
  1139.   static void __CDECL
  1140. ***************
  1141. *** 29,35 ****
  1142.       unsigned long stop;
  1143.       long old_alarm_func;
  1144.       long old_sigmask;
  1145. !     long alarm_sec;
  1146.       long remain;
  1147.       extern int __mint;
  1148.   
  1149. --- 47,53 ----
  1150.       unsigned long stop;
  1151.       long old_alarm_func;
  1152.       long old_sigmask;
  1153. !     unsigned long alarm_sec;
  1154.       long remain;
  1155.       extern int __mint;
  1156.   
  1157. ***************
  1158. *** 39,72 ****
  1159.                   (void)Fselect(32000, 0L, 0L, 0L);
  1160.                   n -= 32;
  1161.               }
  1162. !             (void)Fselect(1000*n, 0L, 0L, 0L);
  1163.               return 0;
  1164.           }
  1165.           if (n == 0)
  1166.               return 0;
  1167. !         alarm_sec = (long) alarm(0);
  1168.           old_sigmask = Psigblock(~0L);
  1169.           old_alarm_func = Psignal(SIGALRM, (long)alarm_catch);
  1170.           (void) Psigblock(~0L);
  1171.           stop = _clock() + n * CLOCKS_PER_SEC;
  1172.           if (alarm_sec && (alarm_sec < n))
  1173. !             (void) alarm((unsigned) alarm_sec);
  1174.           else
  1175. !             (void) alarm(n);
  1176. !         Psigpause(old_sigmask);
  1177. !         (void) alarm(0);
  1178.           (void) Psignal(SIGALRM, (long) alarm_catch);
  1179.           (void) Syield();
  1180.           (void) Psigblock(~0L);
  1181.           remain = ((long) stop - (long) _clock()) 
  1182.                 / (long) CLOCKS_PER_SEC;
  1183.           if (alarm_sec) {
  1184.               alarm_sec -= ((long) n - remain);
  1185.               if (alarm_sec <= 0)
  1186.                   (void) Pkill(Pgetpid(), SIGALRM);
  1187.               else
  1188. !                 (void) alarm((unsigned) alarm_sec);
  1189.           }
  1190.           (void) Psignal(SIGALRM, (long) old_alarm_func);
  1191.           (void) Psigsetmask(old_sigmask);
  1192.           (void) Syield();
  1193. --- 57,115 ----
  1194.                   (void)Fselect(32000, 0L, 0L, 0L);
  1195.                   n -= 32;
  1196.               }
  1197. !             if (n > 0)
  1198. !               (void)Fselect(1000*n, 0L, 0L, 0L);
  1199.               return 0;
  1200.           }
  1201.           if (n == 0)
  1202.               return 0;
  1203. !         /* Clear any existing alarm, but save its expire time.
  1204. !            Then block all signals and save original mask.
  1205. !            Install our alarm handler, and remask (since Psignal()
  1206. !            just unmasked SIGALRM.)
  1207. !         */
  1208. !         alarm_sec = (long) Talarm(0L);
  1209.           old_sigmask = Psigblock(~0L);
  1210.           old_alarm_func = Psignal(SIGALRM, (long)alarm_catch);
  1211.           (void) Psigblock(~0L);
  1212. +         /* Figure out when we would normally wake up */
  1213.           stop = _clock() + n * CLOCKS_PER_SEC;
  1214. +         /* But only sleep as long as the original alarm clock */
  1215.           if (alarm_sec && (alarm_sec < n))
  1216. !             (void) _alarm(alarm_sec);
  1217.           else
  1218. !             (void) _alarm((unsigned long) n);
  1219. !         /* Go to sleep with the original mask but always
  1220. !            allow SIGALRM or we might never wake up.
  1221. !         */
  1222. !         Psigpause(old_sigmask & ~(sigmask(SIGALRM)));
  1223. !         /* Cancel any time left on the alarm clock */
  1224. !         (void) _alarm(0L);
  1225. !         /* Eat any alarms that occurred before we cancelled.
  1226. !            The Syield ensure we enter the kernel and handle the
  1227. !            signal.
  1228. !         */
  1229.           (void) Psignal(SIGALRM, (long) alarm_catch);
  1230.           (void) Syield();
  1231. +         /* Remask again after the Psignal() */
  1232.           (void) Psigblock(~0L);
  1233.           remain = ((long) stop - (long) _clock()) 
  1234.                 / (long) CLOCKS_PER_SEC;
  1235.           if (alarm_sec) {
  1236. +             /* Restore the original timer (or if it expired,
  1237. +                post the signal now)
  1238. +             */
  1239.               alarm_sec -= ((long) n - remain);
  1240.               if (alarm_sec <= 0)
  1241.                   (void) Pkill(Pgetpid(), SIGALRM);
  1242.               else
  1243. !                 (void) _alarm(alarm_sec);
  1244.           }
  1245. +         /* Restore the original alarm handler (which also
  1246. +            allows it to be delivered!)  Then restore the
  1247. +            original signal mask (if the signal handler
  1248. +            does a longjmp() we might lose).
  1249. +         */
  1250.           (void) Psignal(SIGALRM, (long) old_alarm_func);
  1251.           (void) Psigsetmask(old_sigmask);
  1252.           (void) Syield();
  1253. diff -cr ../mntlib37/stat.c ./stat.c
  1254. *** ../mntlib37/stat.c    Wed Oct 20 11:13:34 1993
  1255. --- ./stat.c    Wed Oct 13 19:37:00 1993
  1256. ***************
  1257. *** 89,98 ****
  1258.       /* if we hit a symbolic link, try to get its size right */
  1259.           if (lflag && ((st->st_mode & S_IFMT) == S_IFLNK)) {
  1260.               char buf[PATH_MAX + 1];
  1261. !             r = readlink(path, buf, PATH_MAX);
  1262.               if (r < 0)
  1263.                   return -1;
  1264. !             st->st_size = r;
  1265.           }
  1266.           return 0;
  1267.       }
  1268. --- 89,104 ----
  1269.       /* if we hit a symbolic link, try to get its size right */
  1270.           if (lflag && ((st->st_mode & S_IFMT) == S_IFLNK)) {
  1271.               char buf[PATH_MAX + 1];
  1272. !             char buf1[PATH_MAX + 1];
  1273. !             r = Freadlink(PATH_MAX, buf, path);
  1274.               if (r < 0)
  1275. +               {
  1276. +                 errno = (int) -r;
  1277.                   return -1;
  1278. !               }
  1279. !             buf[PATH_MAX] = 0;
  1280. !             _dos2unx (buf, buf1);
  1281. !             st->st_size = strlen (buf1);
  1282.           }
  1283.           return 0;
  1284.       }
  1285. diff -cr ../mntlib37/symlink.c ./symlink.c
  1286. *** ../mntlib37/symlink.c    Wed Oct 20 11:13:50 1993
  1287. --- ./symlink.c    Wed Oct 20 03:54:02 1993
  1288. ***************
  1289. *** 5,10 ****
  1290. --- 5,11 ----
  1291.   #include <string.h>
  1292.   #include <limits.h>
  1293.   #include <unistd.h>
  1294. + #include <stat.h>
  1295.   #include "lib.h"
  1296.   
  1297.   extern int __mint;
  1298. ***************
  1299. *** 54,59 ****
  1300. --- 55,69 ----
  1301.       _unx2dos(unxname, filename);
  1302.       r = Freadlink(PATH_MAX, linkto, filename);
  1303.       if (r < 0) {
  1304. +         if (r == -EACCES) {
  1305. +             struct stat sb;
  1306. +             /* UNIX gives EINVAL, not EACCES, on non-links */
  1307. +             if ((Fxattr(1, filename, &sb) == 0)
  1308. +                 && ((sb.st_mode & S_IFMT) != S_IFLNK)) {
  1309. +                 r = -EINVAL;
  1310. +             }
  1311. +         }
  1312.           errno = (int) -r;
  1313.           return -1;
  1314.       }
  1315. diff -cr ../mntlib37/tcattr.c ./tcattr.c
  1316. *** ../mntlib37/tcattr.c    Wed Oct 20 11:13:52 1993
  1317. --- ./tcattr.c    Mon Oct 18 06:59:32 1993
  1318. ***************
  1319. *** 86,91 ****
  1320. --- 86,93 ----
  1321.     stp->c_cc[VSTOP]    = (cc_t) t.t_stopc;
  1322.     stp->c_cc[VMIN]    = (cc_t) 1;
  1323.     stp->c_cc[VTIME]    = (cc_t) 0;
  1324. +   stp->c_cc[VLNEXT]    = (cc_t) lt.t_lnextc;
  1325. +   stp->c_cc[VWERASE]    = (cc_t) lt.t_werasc;
  1326.     return 0;
  1327.   }
  1328.   
  1329. ***************
  1330. *** 156,161 ****
  1331. --- 158,165 ----
  1332.     lt.t_suspc        = (char) stp->c_cc[VSUSP];
  1333.     t.t_startc        = (char) stp->c_cc[VSTART];
  1334.     t.t_stopc        = (char) stp->c_cc[VSTOP];
  1335. +   lt.t_lnextc        = (char) stp->c_cc[VLNEXT];
  1336. +   lt.t_werasc        = (char) stp->c_cc[VWERASE];
  1337.     switch (action)
  1338.     {
  1339.       case TCSAFLUSH:
  1340. diff -cr ../mntlib37/wait3.c ./wait3.c
  1341. *** ../mntlib37/wait3.c    Wed Oct 20 11:14:06 1993
  1342. --- ./wait3.c    Tue Oct 12 23:03:02 1993
  1343. ***************
  1344. *** 73,79 ****
  1345.                      (unsigned long) (sizeof (struct rusage)));
  1346.               _ms2tval(rsc[0], &(rusage->ru_utime));
  1347.               _ms2tval(rsc[1], &(rusage->ru_stime));
  1348. -             rusage->ru_maxrss = rsc[4];
  1349.               /* Kludge so GNU time will configure properly: */
  1350.               rusage->ru_nvcsw = 1;
  1351.           }
  1352. --- 73,78 ----
  1353. diff -cr ../mntlib37/wcmb.c ./wcmb.c
  1354. *** ../mntlib37/wcmb.c    Wed Oct 20 11:14:08 1993
  1355. --- ./wcmb.c    Tue Oct 12 18:45:12 1993
  1356. ***************
  1357. *** 5,10 ****
  1358. --- 5,12 ----
  1359.   #include <stdlib.h>
  1360.   #include <stddef.h>
  1361.   
  1362. + extern const wchar_t *_wnull;
  1363.   int
  1364.   mblen(mbstr, n)
  1365.   const char *mbstr;
  1366. ***************
  1367. *** 57,65 ****
  1368.   size_t maxlen;
  1369.   {
  1370.       size_t revcnt = maxlen;
  1371. -     static const wchar_t wnull[1] = { 0 };
  1372.       
  1373. !     if(wstr == NULL) wstr = wnull; /* Better avoid L"". */
  1374.       
  1375.       while(revcnt && (*mbstr++ = (char) *wstr++)) revcnt--;
  1376.       
  1377. --- 59,66 ----
  1378.   size_t maxlen;
  1379.   {
  1380.       size_t revcnt = maxlen;
  1381.       
  1382. !     if(wstr == NULL) wstr = _wnull; /* Better avoid L"". */
  1383.       
  1384.       while(revcnt && (*mbstr++ = (char) *wstr++)) revcnt--;
  1385.       
  1386. Only in .: wcscat.c
  1387. Only in .: wcscmp.c
  1388. Only in .: wcscpy.c
  1389. Only in .: wcslen.c
  1390. Only in .: wnull.c
  1391. diff -cr ../mntlib37/write.c ./write.c
  1392. *** ../mntlib37/write.c    Wed Oct 20 11:14:08 1993
  1393. --- ./write.c    Wed Oct 13 20:05:32 1993
  1394. ***************
  1395. *** 14,19 ****
  1396. --- 14,20 ----
  1397.   #include <unistd.h>
  1398.   #include <signal.h>
  1399.   #include <stat.h>
  1400. + #include <mintbind.h>
  1401.   #include "lib.h"
  1402.   
  1403.   extern __Sigfunc _sig_handler[]; /* TOS fakes for signal handling */
  1404. ***************
  1405. *** 29,34 ****
  1406. --- 30,36 ----
  1407.       long r;
  1408.       extern int __mint;
  1409.       struct stat statbuf;
  1410. +     _DOSTIME timebuf;
  1411.   
  1412.       if (__mint == 0 && isatty(fd)) {
  1413.           r = __OPEN_INDEX(fd);
  1414. ***************
  1415. *** 54,69 ****
  1416.           return -1;
  1417.       }
  1418.       if (size && r == 0) {
  1419. !         if (fstat(fd, &statbuf) < 0) return -1;
  1420. !         if ((statbuf.st_mode & S_IFMT) == S_IFREG) {
  1421. !             errno = ENOSPC;
  1422. !             return -1;
  1423.           }
  1424.       }
  1425.   
  1426.       return r;
  1427.   }
  1428.   
  1429.   int
  1430.   write(fd, buf, size)
  1431.       int fd;
  1432. --- 56,88 ----
  1433.           return -1;
  1434.       }
  1435.       if (size && r == 0) {
  1436. !       if (__mint >= 9)
  1437. !         {
  1438. !           if ((r = Fcntl (fd, &statbuf, FSTAT)) < 0)
  1439. !         {
  1440. !           errno = (int) -r;
  1441. !           return -1;
  1442.           }
  1443. +           if ((statbuf.st_mode & S_IFMT) == S_IFREG)
  1444. +         {
  1445. +           errno = ENOSPC;
  1446. +           return -1;
  1447. +         }
  1448. +         }
  1449. +       else if (Fdatime (&timebuf, fd, 0) == 0
  1450. +            && Fseek (0L, fd, SEEK_CUR) >= 0)
  1451. +         {
  1452. +           errno = ENOSPC;
  1453. +           return -1;
  1454. +         }
  1455.       }
  1456.   
  1457.       return r;
  1458.   }
  1459.   
  1460. + #if defined (__GNUC__) && !defined (__MSHORT__)
  1461. + __asm__ (".stabs \"_write\",5,0,0,__write");
  1462. + #else
  1463.   int
  1464.   write(fd, buf, size)
  1465.       int fd;
  1466. ***************
  1467. *** 72,74 ****
  1468. --- 91,94 ----
  1469.   {
  1470.       return (int) _write(fd, buf, (unsigned long)size);
  1471.   }
  1472. + #endif
  1473. *** /dev/null    Wed Oct 20 12:09:44 1993
  1474. --- wcscat.c    Thu Oct 14 03:50:14 1993
  1475. ***************
  1476. *** 0 ****
  1477. --- 1,51 ----
  1478. + /* from Henry Spencer's stringlib */
  1479. + /* check for src==NULL added by ERS */
  1480. + #include <stddef.h>
  1481. + #include <stdlib.h>
  1482. + /*
  1483. +  * wcscat - append string src to dst
  1484. +  */
  1485. + wchar_t *                /* dst */
  1486. + wcscat(dst, src)
  1487. + wchar_t *dst;
  1488. + const wchar_t *src;
  1489. + {
  1490. +     register wchar_t *dscan;
  1491. +     register const wchar_t *sscan;
  1492. +     if ((sscan = src) != NULL)
  1493. +     {
  1494. +         for (dscan = dst; *dscan; dscan++)
  1495. +         continue;
  1496. +         while ((*dscan++ = *sscan++))
  1497. +             continue;
  1498. +     }
  1499. +     return(dst);
  1500. + }
  1501. + /*
  1502. +  * wcsncat - append at most n characters of string src to dst
  1503. +  */
  1504. + wchar_t *                /* dst */
  1505. + wcsncat(dst, src, n)
  1506. + wchar_t *dst;
  1507. + const wchar_t *src;
  1508. + size_t n;
  1509. + {
  1510. +     register wchar_t *dscan, c;
  1511. +     register const wchar_t *sscan;
  1512. +     register long count;
  1513. +     if(((sscan = src) != NULL) && (n > 0))
  1514. +     {
  1515. +         for (dscan = dst; *dscan; dscan++)
  1516. +         continue;
  1517. +         count = n;
  1518. +         while ((c = *sscan++) && --count >= 0)
  1519. +         *dscan++ = c;
  1520. +         *dscan = 0;
  1521. +     }
  1522. +     return(dst);
  1523. + }
  1524. *** /dev/null    Wed Oct 20 12:09:46 1993
  1525. --- wcscmp.c    Wed Oct  6 11:18:00 1993
  1526. ***************
  1527. *** 0 ****
  1528. --- 1,79 ----
  1529. + /* from Henry Spencer's stringlib */
  1530. + /* modified by ERS */
  1531. + #include <stddef.h>
  1532. + #include <stdlib.h>
  1533. + /*
  1534. +  * wcscmp - compare string s1 to s2
  1535. +  */
  1536. + int                /* <0 for <, 0 for ==, >0 for > */
  1537. + wcscmp(scan1, scan2)
  1538. + register const wchar_t *scan1;
  1539. + register const wchar_t *scan2;
  1540. + {
  1541. +     register wchar_t c1, c2;
  1542. +     if (scan1 == NULL)
  1543. +         return scan2 == NULL ? 0 : -1;
  1544. +     if (scan2 == NULL) return 1;
  1545. +     do {
  1546. +         c1 = *scan1++; c2 = *scan2++;
  1547. +     } while (c1 && c1 == c2);
  1548. +     /*
  1549. +      * The following case analysis is necessary so that characters
  1550. +      * which look negative collate low against normal characters but
  1551. +      * high against the end-of-string NUL.
  1552. +      */
  1553. +     if (c1 == c2)
  1554. +         return(0);
  1555. +     else if (!c1)
  1556. +         return(-1);
  1557. +     else if (!c2)
  1558. +         return(1);
  1559. +     else
  1560. +         return(c1 - c2);
  1561. + }
  1562. + /*
  1563. +  * wcsncmp - compare at most n characters of string s1 to s2
  1564. +  */
  1565. + int                /* <0 for <, 0 for ==, >0 for > */
  1566. + wcsncmp(scan1, scan2, n)
  1567. + register const wchar_t *scan1;
  1568. + register const wchar_t *scan2;
  1569. + size_t n;
  1570. + {
  1571. +     register wchar_t c1, c2;
  1572. +     register long count;
  1573. +     if (scan1 == NULL) {
  1574. +         return scan2 == NULL ? 0 : -1;
  1575. +     }
  1576. +     if (scan2 == NULL) return 1;
  1577. +     count = n;
  1578. +     do {
  1579. +         c1 = *scan1++; c2 = *scan2++;
  1580. +     } while (--count >= 0 && c1 && c1 == c2);
  1581. +     if (count < 0)
  1582. +         return(0);
  1583. +     /*
  1584. +      * The following case analysis is necessary so that characters
  1585. +      * which look negative collate low against normal characters but
  1586. +      * high against the end-of-string NUL.
  1587. +      */
  1588. +     if (c1 == c2)
  1589. +         return(0);
  1590. +     else if (!c1)
  1591. +         return(-1);
  1592. +     else if (!c2)
  1593. +         return(1);
  1594. +     else
  1595. +         return(c1 - c2);
  1596. + }
  1597. *** /dev/null    Wed Oct 20 12:09:48 1993
  1598. --- wcscpy.c    Thu Oct 14 03:51:38 1993
  1599. ***************
  1600. *** 0 ****
  1601. --- 1,48 ----
  1602. + /* from Henry Spencer's stringlib */
  1603. + /* check for NULL string added by ERS */
  1604. + #include <stddef.h>
  1605. + #include <stdlib.h>
  1606. + extern const wchar_t *_wnull;
  1607. + /*
  1608. +  * wcscpy - copy string src to dst
  1609. +  */
  1610. + wchar_t *                /* dst */
  1611. + wcscpy(dst, src)
  1612. + wchar_t *dst;
  1613. + const wchar_t *src;
  1614. + {
  1615. +     register wchar_t *dscan = dst;
  1616. +     register const wchar_t *sscan = src;
  1617. +     if (sscan == NULL) sscan = _wnull;
  1618. +     while ((*dscan++ = *sscan++))
  1619. +         continue;
  1620. +     return(dst);
  1621. + }
  1622. + /*
  1623. +  * wcsncpy - copy at most n characters of string src to dst
  1624. +  */
  1625. + wchar_t *                /* dst */
  1626. + wcsncpy(dst, src, n)
  1627. + wchar_t *dst;
  1628. + const wchar_t *src;
  1629. + size_t n;
  1630. + {
  1631. +     register wchar_t *dscan;
  1632. +     register const wchar_t *sscan;
  1633. +     register long count;
  1634. +     dscan = dst;
  1635. +     if ((sscan = src) == NULL)
  1636. +         sscan = _wnull;
  1637. +     count = n;
  1638. +     while (--count >= 0 && (*dscan++ = *sscan++))
  1639. +         continue;
  1640. +     while (--count >= 0)
  1641. +         *dscan++ = *_wnull;
  1642. +     return(dst);
  1643. + }
  1644. *** /dev/null    Wed Oct 20 12:09:50 1993
  1645. --- wcslen.c    Mon Oct  4 13:55:44 1993
  1646. ***************
  1647. *** 0 ****
  1648. --- 1,18 ----
  1649. + /* from Henry Spencer's stringlib */
  1650. + #include <stddef.h>
  1651. + #include <stdlib.h>
  1652. + /*
  1653. +  * wcslen - length of string (not including NUL)
  1654. +  */
  1655. + size_t
  1656. + wcslen(scan)
  1657. + register const wchar_t *scan;
  1658. + {
  1659. +     register const wchar_t *start = scan+1;
  1660. +     if (scan == NULL) return 0;
  1661. +     while (*scan++)
  1662. +         continue;
  1663. +     return (size_t)((long)scan - (long)start);
  1664. + }
  1665. *** /dev/null    Wed Oct 20 12:10:14 1993
  1666. --- wnull.c    Wed Oct  6 13:39:54 1993
  1667. ***************
  1668. *** 0 ****
  1669. --- 1,5 ----
  1670. + /* This will avoid the construct L"". */
  1671. + #include <stddef.h>
  1672. + const wchar_t _wnull[1] = { 0 };
  1673.