home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / lib / mlib36d.zoo / diffc next >
Encoding:
Text File  |  1993-09-22  |  45.2 KB  |  1,831 lines

  1. diff -cr ../mntlib35/Changelog ./Changelog
  2. *** ../mntlib35/Changelog    Mon Sep 13 07:21:28 1993
  3. --- ./Changelog    Wed Sep 22 15:06:46 1993
  4. ***************
  5. *** 4,9 ****
  6. --- 4,90 ----
  7.   Changes are listed in *reverse* order, most recent changes being
  8.   first.
  9.   
  10. + PATCHLEVEL36::
  11. + mincl:
  12. +     Added target for nlist.o.
  13. + mincl, sozobon/makefile, lattice/mincl.lcc, purec/mintlib.prj: ++entropy
  14. +     Added targets for truncate.o, wcmb.o, printf.o, vfprintf.o,
  15. +     vprintf.o.
  16. + truncate.c, types.h: ++schwab
  17. +     NEW file, implementation of truncate()/ftruncate().  Protos in
  18. +     types.h.
  19. + getwd.c: ++schwab
  20. +     Make getwd() return an error message in the buffer on failure.
  21. + _addsubs.cpp: ++nox
  22. +     Correct an inverted branch.
  23. + open.c: ++nox@jelal.north.de, ++entropy
  24. +     Fix so that when we use Fcreate() we then Fclose() and Fopen() the
  25. +     file, so we get sharing modes correct.
  26. + utime.c: ++schwab
  27. +     utime(NULL) uses time() to convert the current time to Unix format
  28. +     and immediately converts it back to GEMDOS format. Instead it should
  29. +     use the GEMDOS format directly.
  30. +     stime() must be changed because Tset{date,time} can now return a
  31. +     real error number. This depends on Tset{date,time} returning -1 if
  32. +     args are bad, which is true for all TOS versions, i think.
  33. + ttyname.c: ++schwab
  34. +     ttyname() should not return names starting with "u:" when _rootdir is
  35. +     'U', to be consistent with rest of library. find_ino now gets the
  36. +     dir name in gemdos format and it calls dos2unx on it.  ttyname.c
  37. +     unnecessarily depends on dirent.c, we know that Dreaddir works.  We
  38. +     can also avoid the hairy fstat(), since we know that Fcntl(FSTAT)
  39. +     works.
  40. + signal.c: ++schwab
  41. +     Pass through additional signal handler parameters via _trampoline().
  42. + rename.c: ++rwilhelm@physik.tu-muenchen.de
  43. +     Eliminate a useless strcmp().
  44. + main.c: ++schwab
  45. +     When converting a path variable from the environment, we can conserve
  46. +     memory by using the fact that _path_unx2dos enlarges the path by at
  47. +     most two times the number of elements. On the other hand, if there is
  48. +     no PCONVERT env var, the provided space was too small.
  49. + isatty.c: ++schwab
  50. +     Removes the dependency of isatty() on ttyname().
  51. + spawn.c: ++schwab
  52. +     Cleaned up the script emulation code, and changed it in that only
  53. +     files starting with "#!" are interpretable (as Unix does).  The
  54. +     first 1024 bytes of the file are examined when looking for
  55. +     interpreter and arguments.  A small bug is also corrected: errno
  56. +     should never be changed when there is no error.
  57. + falcon.h: ++Markus_Kilbinger@ac.maus.de
  58. +     Add two omitted backslashes to fix new trap definitions.
  59. + chmod.c: ++schwab@ls5.informatik.uni-dortmund.de
  60. +     chmod() unnecessarily calls stat() to check if the file is a
  61. +     directory; this information is already available through Fattrib().
  62. + nlist.c, nlist.h: ++shenson@nyx.cs.du.edu
  63. +     NEW files nlist.c, nlist.h.  A version of nlist() for mntlib/toslib.
  64. +     Works OK with my binary config program but your milage may vary.
  65. + wcmb.c, stdlib.h: ++pvt1-117@nada.kth.se
  66. +     NEW file wcmb.c for ANSI wide char functions.
  67. + waitpid.c: ++Robert.Wilhelm@Physik.TU-Muenchen.DE
  68. +     Add a forgotten patch for non-GCC compilers.
  69. + ctype.h: ++dsb@cs.duke.edu
  70. +     The toint() macro in ctype.h was translating hex digits wrong.
  71. + --begin jrb changes--
  72. + math-68881.h: ++jrb
  73. +     -- Put extern "C" around file when __cplusplus
  74. +     -- Make hypot use internal version of sqrt (because signature
  75. +        clash in libg++:xfix )
  76. +     -- Define internal version (_sqrt) of sqrt.
  77. + osbind.h: ++Robert.Wilhelm@Physik.TU-Muenchen.DE
  78. +     Changed addw #n,sp to lea n(s),sp which is 4 cycles shorter.
  79. + fprintf.c: ++jrb
  80. +     Break out vfprintf, printf and vprintf into their own .o's. That
  81. +     way the user can replace any of them.
  82. + printf.c, vfprintf.c, vprintf.c:: ++jrb
  83. +     NEW files.
  84. + mincl: ++jrb
  85. +     Add targets for above.
  86. + gnulib2.c: Steven Ourada (sourada@iastate.edu)
  87. +     #define WORD_BIG_ENDIAN for long long.
  88. + --end jrb changes--
  89.   PATCHLEVEL35::
  90.   
  91.   unx2dos.c: ++schwab
  92. ***************
  93. *** 84,90 ****
  94.       Add errors ENOTDIR and ELOOP.
  95.   signal.h: ++Ole_Arndt@f.maus.de (Ole Arndt)
  96.       Fix definition of _SIGSET_MAX_INDEX to correct several bugs
  97. !     in the POSIX signal mask functios.
  98.   stdio.h:
  99.       Add vsscanf() and _getbuf() protos (yech).
  100.   dirent.h:
  101. --- 165,171 ----
  102.       Add errors ENOTDIR and ELOOP.
  103.   signal.h: ++Ole_Arndt@f.maus.de (Ole Arndt)
  104.       Fix definition of _SIGSET_MAX_INDEX to correct several bugs
  105. !     in the POSIX signal mask functions.
  106.   stdio.h:
  107.       Add vsscanf() and _getbuf() protos (yech).
  108.   dirent.h:
  109. diff -cr ../mntlib35/Files ./Files
  110. *** ../mntlib35/Files    Sun Jul 18 09:03:42 1993
  111. --- ./Files    Tue Sep 21 20:34:36 1993
  112. ***************
  113. *** 8,18 ****
  114.   _cmpdf2.cpp    bcopy.cpp    fsetpos.c    memcmp.c    strftime.c
  115.   _cmpsf2.cpp    binmode.c    ftw.c        mktemp.c    stricmp.c
  116.   _divdf3.cpp    bsearch.c    fungetc.c    modf.cpp    strlen.c
  117. ! _divmods.s    bzero.cpp    fwrite.c            strlwr.c
  118.   _divsf3.cpp    calloc.c    gbl-ctors.h            strncat.c
  119.   _extends.cpp    chdir.c        getbuf.c    obstack.c    strncmp.c
  120.   _fixdfsi.cpp    chmod.c        getenv.c    perror.c    strncpy.c
  121.           ctermid.c    getlogin.c    pgrp.c
  122.   _fixsfsi.cpp    ctime.c        getopt.c    psignal.c    strnicmp.c
  123.   _fltsi.cpp    ctype.c        getpass.c    putenv.c    strpbrk.c
  124.   _fltsisf.cpp    cuserid.c    getpid.c    qsort.c        strrchr.c
  125. --- 8,19 ----
  126.   _cmpdf2.cpp    bcopy.cpp    fsetpos.c    memcmp.c    strftime.c
  127.   _cmpsf2.cpp    binmode.c    ftw.c        mktemp.c    stricmp.c
  128.   _divdf3.cpp    bsearch.c    fungetc.c    modf.cpp    strlen.c
  129. ! _divmods.s    bzero.cpp    fwrite.c    nlist.c        strlwr.c
  130.   _divsf3.cpp    calloc.c    gbl-ctors.h            strncat.c
  131.   _extends.cpp    chdir.c        getbuf.c    obstack.c    strncmp.c
  132.   _fixdfsi.cpp    chmod.c        getenv.c    perror.c    strncpy.c
  133.           ctermid.c    getlogin.c    pgrp.c
  134. +                         printf.c
  135.   _fixsfsi.cpp    ctime.c        getopt.c    psignal.c    strnicmp.c
  136.   _fltsi.cpp    ctype.c        getpass.c    putenv.c    strpbrk.c
  137.   _fltsisf.cpp    cuserid.c    getpid.c    qsort.c        strrchr.c
  138. ***************
  139. *** 34,42 ****
  140.   abs.c        findfile.c    ldexp.cpp    sprintf.c    toxxx.c
  141.   access.c    flonum.h    lib.h        stksiz.c    utime.c
  142.   alglobal.c    fopen.c        libgcc1.c    strcat.c
  143. !                 libgcc2.c
  144. ! alloca.cpp    fprintf.c    linea.c        strchr.c
  145. ! alphasor.c    fputc.c        localtim.c    strcmp.c
  146.                   longlong.h
  147.   
  148.   MiNT library:
  149. --- 35,43 ----
  150.   abs.c        findfile.c    ldexp.cpp    sprintf.c    toxxx.c
  151.   access.c    flonum.h    lib.h        stksiz.c    utime.c
  152.   alglobal.c    fopen.c        libgcc1.c    strcat.c
  153. !                 libgcc2.c            vfprintf.c
  154. ! alloca.cpp    fprintf.c    linea.c        strchr.c    vprintf.c
  155. ! alphasor.c    fputc.c        localtim.c    strcmp.c    wcmb.c
  156.                   longlong.h
  157.   
  158.   MiNT library:
  159. ***************
  160. *** 51,56 ****
  161. --- 52,58 ----
  162.   Makefile    getcwd.c            read.c        sysconf.c
  163.   OChangelog                    rename.c    thread.c
  164.   PatchLev.h    getdtabl.c    link.c        rmdir.c        times.c
  165. +                                 truncate.c
  166.   README        getgroup.c    lockf.c        scandir.c    ttyname.c
  167.   alarm.c        gethostn.c    main.c        scanf.c        uname.c
  168.   atexit.c    getpages.c            select.c    unlink.c
  169. diff -cr ../mntlib35/Makefile ./Makefile
  170. *** ../mntlib35/Makefile    Mon Sep 13 11:22:00 1993
  171. --- ./Makefile    Wed Sep 15 09:55:56 1993
  172. ***************
  173. *** 218,223 ****
  174. --- 218,224 ----
  175.       rm -f *.o *.olb *.tmp
  176.       rm -f core report nohup.out
  177.       rm -f foo bar baz
  178. +     rm -f *.target
  179.   
  180.   distclean: realclean
  181.       rm -f diffc diffh
  182. diff -cr ../mntlib35/PatchLev.h ./PatchLev.h
  183. *** ../mntlib35/PatchLev.h    Fri Jul  9 06:30:38 1993
  184. --- ./PatchLev.h    Wed Sep 15 09:51:26 1993
  185. ***************
  186. *** 3,6 ****
  187.    *    directory.
  188.    */
  189.   
  190. ! #define PatchLevel "35"
  191. --- 3,6 ----
  192.    *    directory.
  193.    */
  194.   
  195. ! #define PatchLevel "36"
  196. diff -cr ../mntlib35/_addsubs.cpp ./_addsubs.cpp
  197. *** ../mntlib35/_addsubs.cpp    Sun Jun  6 05:13:22 1993
  198. --- ./_addsubs.cpp    Tue Sep 21 13:53:32 1993
  199. ***************
  200. *** 83,89 ****
  201.       bclr    d3,d1        | kill sign bit u.exp
  202.       bclr    d3,d0        | kill sign bit u.exp
  203.       btst    d3,d2        | same sign for u and v?
  204. !     bne    0f
  205.       cmpl    d0,d1        | different signs - maybe x - x ?
  206.       seq    d2        | set 'cancellation' flag
  207.   0:
  208. --- 83,89 ----
  209.       bclr    d3,d1        | kill sign bit u.exp
  210.       bclr    d3,d0        | kill sign bit u.exp
  211.       btst    d3,d2        | same sign for u and v?
  212. !     beq    0f
  213.       cmpl    d0,d1        | different signs - maybe x - x ?
  214.       seq    d2        | set 'cancellation' flag
  215.   0:
  216. diff -cr ../mntlib35/chmod.c ./chmod.c
  217. *** ../mntlib35/chmod.c    Sat Jun 26 07:05:06 1993
  218. --- ./chmod.c    Tue Sep 21 09:42:20 1993
  219. ***************
  220. *** 19,25 ****
  221.   {
  222.          int  dosattrib = 0, r;
  223.          char path[PATH_MAX];
  224. -        struct stat stb;
  225.   
  226.          (void)_unx2dos(_path, path);
  227.   
  228. --- 19,24 ----
  229. ***************
  230. *** 33,42 ****
  231.       }
  232.   
  233.   /* The following lines ensure that the archive bit isn't cleared */
  234. !     r = Fattrib(path, 0, dosattrib);
  235. !      if (r > 0 && (r & FA_CHANGED))
  236.           dosattrib |= FA_CHANGED;
  237.   
  238.   #if 0
  239.          if (!(mode & S_IREAD))
  240.                  dosattrib |= FA_HIDDEN;
  241. --- 32,48 ----
  242.       }
  243.   
  244.   /* The following lines ensure that the archive bit isn't cleared */
  245. !     r = Fattrib(path, 0, 0);
  246. !     if (r < 0)
  247. !       {
  248. !         errno = -r;
  249. !         return -1;
  250. !       }
  251. !      if (r & FA_CHANGED)
  252.           dosattrib |= FA_CHANGED;
  253.   
  254. +     if (r & FA_DIR)
  255. +       dosattrib |= FA_DIR;
  256.   #if 0
  257.          if (!(mode & S_IREAD))
  258.                  dosattrib |= FA_HIDDEN;
  259. ***************
  260. *** 46,55 ****
  261.          r = Fattrib(path, 1, dosattrib);
  262.          if (r < 0) {
  263.   /* GEMDOS doesn't allow chmod on a directory, so pretend it worked */
  264. !                if (!stat(_path, &stb)) {
  265. !                 if ( (stb.st_mode & S_IFMT) == S_IFDIR )
  266. !             return 0;
  267. !                }
  268.                  errno = -r;
  269.                  return -1;
  270.          }
  271. --- 52,59 ----
  272.          r = Fattrib(path, 1, dosattrib);
  273.          if (r < 0) {
  274.   /* GEMDOS doesn't allow chmod on a directory, so pretend it worked */
  275. !         if (dosattrib & FA_DIR)
  276. !           return 0;
  277.                  errno = -r;
  278.                  return -1;
  279.          }
  280. Only in .: diffc
  281. diff -cr ../mntlib35/fprintf.c ./fprintf.c
  282. *** ../mntlib35/fprintf.c    Sat Sep  5 20:48:38 1992
  283. --- ./fprintf.c    Thu Sep 16 02:35:34 1993
  284. ***************
  285. *** 19,53 ****
  286.       va_end(args);
  287.       return r;
  288.   }
  289. - int
  290. - vfprintf(fp, fmt, args)
  291. -     FILE *fp;
  292. -     const char *fmt;
  293. -     va_list args;
  294. - {
  295. -     return(_doprnt(fp, fmt, args));
  296. - }
  297. - #if __STDC__
  298. - int printf(const char *fmt, ...)
  299. - #else
  300. - int printf(fmt) const char *fmt;
  301. - #endif
  302. - {
  303. -     va_list args;
  304. -     int r;
  305. -     va_start(args, fmt);
  306. -     r = _doprnt(stdout, fmt, args);
  307. -     va_end(args);
  308. -     return r;
  309. - }
  310. - int
  311. - vprintf(fmt, args)
  312. -     const char *fmt;
  313. -     va_list args;
  314. - {
  315. -     return(_doprnt(stdout, fmt, args));
  316. - }
  317. --- 19,21 ----
  318. diff -cr ../mntlib35/getcwd.c ./getcwd.c
  319. *** ../mntlib35/getcwd.c    Sun Jun 20 08:24:30 1993
  320. --- ./getcwd.c    Tue Sep 21 18:42:18 1993
  321. ***************
  322. *** 3,8 ****
  323. --- 3,9 ----
  324.   #include <stdlib.h>    /* both of these added for malloc() */
  325.   #include <limits.h>
  326.   #include <errno.h>
  327. + #include <string.h>
  328.   #include <osbind.h>
  329.   #include <mintbind.h>
  330.   #include <unistd.h>
  331. ***************
  332. *** 66,70 ****
  333.   char *getwd(buf)
  334.   char *buf;
  335.   {
  336. !     return getcwd(buf, PATH_MAX);
  337.   }
  338. --- 67,75 ----
  339.   char *getwd(buf)
  340.   char *buf;
  341.   {
  342. !   char *ret = getcwd(buf, PATH_MAX);
  343. !   if (ret)
  344. !     return ret;
  345. !   strcpy (buf, strerror (errno));
  346. !   return NULL;
  347.   }
  348. diff -cr ../mntlib35/gnulib2.c ./gnulib2.c
  349. *** ../mntlib35/gnulib2.c    Sat Dec 12 14:25:36 1992
  350. --- ./gnulib2.c    Thu Sep 16 18:00:24 1993
  351. ***************
  352. *** 88,94 ****
  353.   /* Define this if most significant word of a multiword number is numbered.  */
  354.   /* For 68000 we can decide arbitrarily
  355.      since there are no machine instructions for them.  */
  356. ! /* #define WORDS_BIG_ENDIAN */
  357.   
  358.   /* number of bits in an addressible storage unit */
  359.   #define BITS_PER_UNIT 8
  360. --- 88,94 ----
  361.   /* Define this if most significant word of a multiword number is numbered.  */
  362.   /* For 68000 we can decide arbitrarily
  363.      since there are no machine instructions for them.  */
  364. ! #define WORDS_BIG_ENDIAN
  365.   
  366.   /* number of bits in an addressible storage unit */
  367.   #define BITS_PER_UNIT 8
  368. diff -cr ../mntlib35/isatty.c ./isatty.c
  369. *** ../mntlib35/isatty.c    Tue Jun 22 03:21:26 1993
  370. --- ./isatty.c    Tue Sep 21 09:54:16 1993
  371. ***************
  372. *** 51,58 ****
  373. --- 51,60 ----
  374.   _isctty(fd)
  375.     int fd;
  376.   {
  377. + #if 0
  378.     char ctty_name[L_ctermid];
  379.     char ftty_name[L_ctermid];
  380. + #endif
  381.     struct stat st, tt;
  382.     extern int __mint;
  383.   
  384. ***************
  385. *** 67,74 ****
  386.       */
  387.       return (st.st_dev == tt.st_dev && st.st_ino == tt.st_ino);
  388.     }
  389. ! #endif
  390.     (void) ctermid(ctty_name);
  391.     (void) strncpy(ftty_name, ttyname(fd), L_ctermid);
  392.     return !(strncmp(ctty_name, ftty_name, L_ctermid));
  393.   }
  394. --- 69,81 ----
  395.       */
  396.       return (st.st_dev == tt.st_dev && st.st_ino == tt.st_ino);
  397.     }
  398. !   /* We know that __mint < 9 (the Fcntl's above don't have the chance
  399. !      to fail), use the same algorithm that ttyname() uses in this
  400. !      case: it returns "/dev/aux" if fd == -2 */
  401. !   return fd != -2;
  402. ! #else
  403.     (void) ctermid(ctty_name);
  404.     (void) strncpy(ftty_name, ttyname(fd), L_ctermid);
  405.     return !(strncmp(ctty_name, ftty_name, L_ctermid));
  406. + #endif
  407.   }
  408. diff -cr ../mntlib35/lattice/mincl.lcc ./lattice/mincl.lcc
  409. *** ../mntlib35/lattice/mincl.lcc    Mon Feb 22 09:44:02 1993
  410. --- ./lattice/mincl.lcc    Wed Sep 22 15:00:40 1993
  411. ***************
  412. *** 21,27 ****
  413.       heapbase.o ident.o il.o ic.o iw.o ig.o ip.o inistack.o \
  414.       ioctl.o isatty.o kill.o killpg.o link.o localtim.o lockf.o lseek.o ltoa.o \
  415.       main.o malloc.o memccpy.o memchr.o memcmp.o memcpy.o memset.o mkdir.o \
  416. !     mknod.o mktemp.o nice.o open.o pause.o perror.o pipe.o popen.o \
  417.       psignal.o putenv.o qsort.o raise.o rand.o random.o read.o realloc.o \
  418.       regexp.o regsup.o \
  419.       rename.o rmdir.o sbrk.o scandir.o scanf.o select.o setbuf.o setlocal.o \
  420. --- 21,27 ----
  421.       heapbase.o ident.o il.o ic.o iw.o ig.o ip.o inistack.o \
  422.       ioctl.o isatty.o kill.o killpg.o link.o localtim.o lockf.o lseek.o ltoa.o \
  423.       main.o malloc.o memccpy.o memchr.o memcmp.o memcpy.o memset.o mkdir.o \
  424. !     mknod.o mktemp.o nice.o open.o pause.o perror.o pipe.o popen.o printf.o \
  425.       psignal.o putenv.o qsort.o raise.o rand.o random.o read.o realloc.o \
  426.       regexp.o regsup.o \
  427.       rename.o rmdir.o sbrk.o scandir.o scanf.o select.o setbuf.o setlocal.o \
  428. ***************
  429. *** 31,40 ****
  430.       strerror.o strftime.o strlen.o stricmp.o strlwr.o strncat.o strncmp.o \
  431.       strncpy.o strnicmp.o strpbrk.o strrchr.o strrev.o strspn.o strstr.o strtok.o \
  432.       strtol.o strtoul.o strupr.o symlink.o sysconf.o system.o sysvar.o textio.o thread.o \
  433. !     time.o timeoday.o times.o tmpfile.o tmpnam.o ttyname.o uname.o \
  434.       unlink.o unx2dos.o utime.o utmp.o wait.o wait3.o waitpid.o write.o wtmp.o \
  435.       _divmods.o _mulsi3.o _udivmod.o _umulsi3.o bcopy.o linea.o osbind.o \
  436. !     setjmp.o vfork.o
  437.   
  438.   all:    $(ALL)
  439.   
  440. --- 31,40 ----
  441.       strerror.o strftime.o strlen.o stricmp.o strlwr.o strncat.o strncmp.o \
  442.       strncpy.o strnicmp.o strpbrk.o strrchr.o strrev.o strspn.o strstr.o strtok.o \
  443.       strtol.o strtoul.o strupr.o symlink.o sysconf.o system.o sysvar.o textio.o thread.o \
  444. !     time.o timeoday.o times.o tmpfile.o tmpnam.o truncate.o ttyname.o uname.o \
  445.       unlink.o unx2dos.o utime.o utmp.o wait.o wait3.o waitpid.o write.o wtmp.o \
  446.       _divmods.o _mulsi3.o _udivmod.o _umulsi3.o bcopy.o linea.o osbind.o \
  447. !     setjmp.o vfork.o vfprintf.o vprintf.o wcmb.o
  448.   
  449.   all:    $(ALL)
  450.   
  451. Only in ../mntlib35: lblong.target
  452. diff -cr ../mntlib35/main.c ./main.c
  453. *** ../mntlib35/main.c    Sun Sep 12 20:16:28 1993
  454. --- ./main.c    Tue Sep 21 09:56:28 1993
  455. ***************
  456. *** 204,210 ****
  457.                               cnt++;
  458.                           tmp++;
  459.                       }
  460. !                     _envp[i] = (char *) malloc(cnt * MAXPATHLEN);
  461.                       strncpy(_envp[i], s, len);
  462.                       _path_dos2unx(s + len, _envp[i] + len);
  463.                       _envp[i] = (char *) realloc(_envp[i], 
  464. --- 204,210 ----
  465.                               cnt++;
  466.                           tmp++;
  467.                       }
  468. !                     _envp[i] = (char *) malloc(tmp - s + cnt * 2);
  469.                       strncpy(_envp[i], s, len);
  470.                       _path_dos2unx(s + len, _envp[i] + len);
  471.                       _envp[i] = (char *) realloc(_envp[i], 
  472. ***************
  473. *** 223,229 ****
  474.               if (s[0] == 'P' && s[1] == 'A' && s[2] == 'T' &&
  475.                   s[3] == 'H' && s[4] == '=')
  476.               {
  477. !                 _envp[i] = (char *) malloc(5 + MAXPATHLEN);
  478.                   strncpy(_envp[i], s, 5);
  479.                   _path_dos2unx(s + 5, _envp[i] + 5);
  480.                   _envp[i] = (char *) realloc(_envp[i], 
  481. --- 223,238 ----
  482.               if (s[0] == 'P' && s[1] == 'A' && s[2] == 'T' &&
  483.                   s[3] == 'H' && s[4] == '=')
  484.               {
  485. !                 tmp = s + 5; /* tmp now after '=' */    
  486. !                 cnt = 1;
  487. !                 while (*tmp)
  488. !                   {
  489. !                     /* count words */
  490. !                     if (*tmp == ';' || *tmp == ',')
  491. !                       cnt++;
  492. !                     tmp++;
  493. !                   }
  494. !                 _envp[i] = (char *) malloc(tmp - s + cnt * 2);
  495.                   strncpy(_envp[i], s, 5);
  496.                   _path_dos2unx(s + 5, _envp[i] + 5);
  497.                   _envp[i] = (char *) realloc(_envp[i], 
  498. diff -cr ../mntlib35/mincl ./mincl
  499. *** ../mntlib35/mincl    Sun Jul 18 08:48:18 1993
  500. --- ./mincl    Tue Sep 21 20:38:20 1993
  501. ***************
  502. *** 27,33 ****
  503.       calloc.o clock.o ctime.o ctype.o difftime.o \
  504.       fopen.o fclose.o fdopen.o fflush.o fgetc.o fgets.o \
  505.       fputc.o fputs.o fread.o fwrite.o fseek.o fsetpos.o \
  506. !     eprintf.o fprintf.o sprintf.o \
  507.       fscanf.o scanf.o sscanf.o \
  508.       getenv.o gets.o getw.o localtim.o \
  509.       malloc.o qsort.o raise.o rand.o realloc.o \
  510. --- 27,33 ----
  511.       calloc.o clock.o ctime.o ctype.o difftime.o \
  512.       fopen.o fclose.o fdopen.o fflush.o fgetc.o fgets.o \
  513.       fputc.o fputs.o fread.o fwrite.o fseek.o fsetpos.o \
  514. !     fprintf.o vfprintf.o printf.o vprintf.o eprintf.o sprintf.o \
  515.       fscanf.o scanf.o sscanf.o \
  516.       getenv.o gets.o getw.o localtim.o \
  517.       malloc.o qsort.o raise.o rand.o realloc.o \
  518. ***************
  519. *** 35,52 ****
  520.       setlocal.o strftime.o strtol.o system.o \
  521.       tmpnam.o tmpfile.o \
  522.       ltoa.o main.o doprnt.o div.o \
  523. !     strtoul.o fungetc.o filbuf.o getbuf.o toxxx.o
  524.   
  525.   #
  526.   # other miscellaneous stuff
  527.   PORT =  a64l.o alphasor.o abs.o ctermid.o cuserid.o \
  528. !     ffs.o findfile.o fopenp.o frwbin.o \
  529. !     ftw.o getpw.o gethostn.o \
  530. !     getlogin.o getopt.o getpages.o getpass.o grp.o ident.o mktemp.o \
  531. !     regexp.o regsup.o scandir.o strlwr.o strupr.o strrev.o sync.o \
  532. !     textio.o random.o \
  533. !     obstack.o utmp.o wtmp.o \
  534. !     il.o ic.o iw.o ig.o ip.o
  535.   
  536.   #
  537.   # the string library
  538. --- 35,53 ----
  539.       setlocal.o strftime.o strtol.o system.o \
  540.       tmpnam.o tmpfile.o \
  541.       ltoa.o main.o doprnt.o div.o \
  542. !     strtoul.o fungetc.o filbuf.o getbuf.o toxxx.o wcmb.o
  543.   
  544.   #
  545.   # other miscellaneous stuff
  546.   PORT =  a64l.o alphasor.o abs.o ctermid.o cuserid.o \
  547. !     ffs.o findfile.o fopenp.o frwbin.o ftw.o \
  548. !     gethostn.o getlogin.o getopt.o getpages.o getpass.o getpw.o grp.o \
  549. !     ic.o ig.o il.o ip.o iw.o \
  550. !     ident.o mktemp.o nlist.o obstack.o\
  551. !     random.o regexp.o regsup.o \
  552. !     scandir.o strlwr.o strupr.o strrev.o sync.o \
  553. !     textio.o truncate.o \
  554. !     utmp.o wtmp.o
  555.   
  556.   #
  557.   # the string library
  558. Only in .: nlist.c
  559. diff -cr ../mntlib35/open.c ./open.c
  560. *** ../mntlib35/open.c    Thu Jul 15 08:12:26 1993
  561. --- ./open.c    Tue Sep 21 13:45:42 1993
  562. ***************
  563. *** 94,110 ****
  564.               errno = EEXIST;
  565.               return -1;
  566.           }
  567. !         if(iomode & O_TRUNC)
  568.               rv = (int)Fcreate(filename, 0x00);
  569. !         else
  570. !             rv = (int)Fopen(filename,iomode & modemask);
  571.       }
  572.       else                    /* file doesn't exist */
  573.       {
  574.           if(iomode & O_CREAT) {
  575.               rv = (int)Fcreate(filename, 0x00);
  576. !             if (rv >= 0 && __mint >= 9)
  577. !                 (void)Fchmod(filename, pmode);
  578.           }
  579.           else
  580.               rv = -ENOENT;
  581. --- 94,121 ----
  582.               errno = EEXIST;
  583.               return -1;
  584.           }
  585. !         if(iomode & O_TRUNC) {
  586.               rv = (int)Fcreate(filename, 0x00);
  587. !             if (rv >= 0) {
  588. !                 (void)Fclose(rv);
  589. !             }
  590. !             else {
  591. !                 errno = -rv;
  592. !                 return -1;
  593. !             }
  594. !         }
  595. !         rv = (int)Fopen(filename,iomode & modemask);
  596.       }
  597.       else                    /* file doesn't exist */
  598.       {
  599.           if(iomode & O_CREAT) {
  600.               rv = (int)Fcreate(filename, 0x00);
  601. !             if (rv >= 0) {
  602. !                 (void)Fclose(rv);
  603. !                 rv = (int)Fopen(filename,iomode & modemask);
  604. !                 if (rv >= 0 && __mint >= 9)
  605. !                     (void)Fchmod(filename, pmode);
  606. !             }
  607.           }
  608.           else
  609.               rv = -ENOENT;
  610. Only in .: printf.c
  611. diff -cr ../mntlib35/purec/mintlib.prj ./purec/mintlib.prj
  612. *** ../mntlib35/purec/mintlib.prj    Fri Jun 11 05:11:00 1993
  613. --- ./purec/mintlib.prj    Wed Sep 22 15:04:44 1993
  614. ***************
  615. *** 117,122 ****
  616. --- 117,123 ----
  617.   ..\pipe.c
  618.   ..\pgrp.c
  619.   ..\popen.c
  620. + ..\printf.c
  621.   ..\psignal.c
  622.   ..\putenv.c
  623.   ..\qsort.c [-S -T]
  624. ***************
  625. *** 188,193 ****
  626. --- 189,195 ----
  627.   ..\tmpfile.c
  628.   ..\tmpnam.c
  629.   ..\toxxx.c
  630. + ..\truncate.c
  631.   ..\ttyname.c
  632.   ..\uname.c
  633.   ..\unlink.c
  634. ***************
  635. *** 194,202 ****
  636. --- 196,207 ----
  637.   ..\unx2dos.c
  638.   ..\utime.c
  639.   ..\utmp.c
  640. + ..\vfprintf.c
  641. + ..\vprintf.c
  642.   ..\wait.c
  643.   ..\wait3.c
  644.   ..\waitpid.c
  645. + ..\wcmb.c
  646.   ..\write.c
  647.   ..\wtmp.c
  648.   
  649. diff -cr ../mntlib35/rename.c ./rename.c
  650. *** ../mntlib35/rename.c    Sun Oct 20 02:16:02 1991
  651. --- ./rename.c    Tue Sep 21 09:59:44 1993
  652. ***************
  653. *** 12,22 ****
  654.   {
  655.       char oldname[PATH_MAX], newname[PATH_MAX];
  656.       int rval;
  657.       if (!strcmp(_oldname, _newname)) {
  658.           rval = 0;    /* no-op */
  659.       }
  660.       if (!access(_newname, 0)) {    /* new name already exists */
  661.           if (unlink(_newname))
  662.               return -1;
  663. --- 12,22 ----
  664.   {
  665.       char oldname[PATH_MAX], newname[PATH_MAX];
  666.       int rval;
  667. ! #if 0
  668.       if (!strcmp(_oldname, _newname)) {
  669.           rval = 0;    /* no-op */
  670.       }
  671. ! #endif
  672.       if (!access(_newname, 0)) {    /* new name already exists */
  673.           if (unlink(_newname))
  674.               return -1;
  675. diff -cr ../mntlib35/sigactio.c ./sigactio.c
  676. *** ../mntlib35/sigactio.c    Sun Jul 18 08:20:38 1993
  677. --- ./sigactio.c    Tue Sep 21 10:02:28 1993
  678. ***************
  679. *** 9,16 ****
  680.   extern __Sigfunc _sig_handler[__NSIG];
  681.   
  682.   #ifdef __MSHORT__
  683. ! typedef void __CDECL (*__KerSigfunc) __PROTO((long));
  684. ! __EXTERN void __CDECL _trampoline __PROTO((long sig));
  685.   #else
  686.   typedef void __CDECL (*__KerSigfunc) __PROTO((int));
  687.   #endif
  688. --- 9,16 ----
  689.   extern __Sigfunc _sig_handler[__NSIG];
  690.   
  691.   #ifdef __MSHORT__
  692. ! typedef void __CDECL (*__KerSigfunc) __PROTO((long, long));
  693. ! __EXTERN void __CDECL _trampoline __PROTO((long sig, long code));
  694.   #else
  695.   typedef void __CDECL (*__KerSigfunc) __PROTO((int));
  696.   #endif
  697. diff -cr ../mntlib35/signal.c ./signal.c
  698. *** ../mntlib35/signal.c    Sat Sep  5 22:00:40 1992
  699. --- ./signal.c    Tue Sep 21 10:02:32 1993
  700. ***************
  701. *** 22,41 ****
  702.    * we previously established
  703.    */
  704.   
  705. ! void __CDECL _trampoline __PROTO((long));
  706.   
  707.   /* the argument is on the stack */
  708. ! void __CDECL _trampoline(sig)
  709. !     long sig;
  710.   {
  711. !     __Sigfunc func;
  712.   
  713. !     func = _sig_handler[sig];
  714.   
  715.   /* note: func should never be SIG_IGN or SIG_DFL; if it is, something
  716.    * really bad happened and we want to crash anyway!
  717.    */
  718. !     (*func)((short)sig);
  719.   }
  720.   #endif
  721.   
  722. --- 22,41 ----
  723.    * we previously established
  724.    */
  725.   
  726. ! void __CDECL _trampoline __PROTO((long, long));
  727.   
  728.   /* the argument is on the stack */
  729. ! void __CDECL _trampoline(sig, code)
  730. !     long sig, code;
  731.   {
  732. !     void (*func) __PROTO ((int, int));
  733.   
  734. !     func = (void (*) __PROTO ((int, int))) _sig_handler[sig];
  735.   
  736.   /* note: func should never be SIG_IGN or SIG_DFL; if it is, something
  737.    * really bad happened and we want to crash anyway!
  738.    */
  739. !     (*func)((int)sig, (int) code);
  740.   }
  741.   #endif
  742.   
  743. diff -cr ../mntlib35/sozobon/makefile ./sozobon/makefile
  744. *** ../mntlib35/sozobon/makefile    Mon Sep 13 06:18:44 1993
  745. --- ./sozobon/makefile    Wed Sep 22 14:54:38 1993
  746. ***************
  747. *** 47,60 ****
  748.   
  749.   # These are in alphabetical order to make it easy to find one.
  750.   OBJECTS = \
  751. !     abort.o abs.o access.o alarm.o alloca.o alphasor.o \
  752.       atexit.o atol.o \
  753.       bcmp.o bcopy.o binmode.o bsearch.o bzero.o \
  754.       calloc.o chdir.o chmod.o clock.o close.o console.o crtinit.o \
  755. !     ctermid.o ctime.o ctype.o cuserid.o\
  756.       defmode.o difftime.o dirent.o doprnt.o dup.o \
  757.       eprintf.o exec.o execp.o\
  758. !     fclose.o fcntl.o fdopen.o fflush.o ffs.o fgetc.o fgets.o filbuf.o \
  759.       findfile.o fopen.o fopenp.o fork.o fprintf.o fputc.o fputs.o \
  760.       fread.o frwbin.o fscanf.o fseek.o fsetpos.o ftw.o fungetc.o \
  761.       fwrite.o \
  762. --- 47,60 ----
  763.   
  764.   # These are in alphabetical order to make it easy to find one.
  765.   OBJECTS = \
  766. !     abort.o abs.o access.o alarm.o alloca.o alphasor.o \
  767.       atexit.o atol.o \
  768.       bcmp.o bcopy.o binmode.o bsearch.o bzero.o \
  769.       calloc.o chdir.o chmod.o clock.o close.o console.o crtinit.o \
  770. !     ctermid.o ctime.o ctype.o cuserid.o \
  771.       defmode.o difftime.o dirent.o doprnt.o dup.o \
  772.       eprintf.o exec.o execp.o\
  773. !     fclose.o fcntl.o fdopen.o fflush.o ffs.o fgetc.o fgets.o filbuf.o \
  774.       findfile.o fopen.o fopenp.o fork.o fprintf.o fputc.o fputs.o \
  775.       fread.o frwbin.o fscanf.o fseek.o fsetpos.o ftw.o fungetc.o \
  776.       fwrite.o \
  777. ***************
  778. *** 70,76 ****
  779.       mktemp.o \
  780.       nice.o \
  781.       obstack.o open.o osbind.o \
  782. !     pause.o perror.o pgrp.o pipe.o popen.o psignal.o putenv.o \
  783.       qsort.o \
  784.       raise.o rand.o random.o read.o realloc.o regexp.o regsup.o \
  785.       rename.o rmdir.o \
  786. --- 70,76 ----
  787.       mktemp.o \
  788.       nice.o \
  789.       obstack.o open.o osbind.o \
  790. !     pause.o perror.o pgrp.o pipe.o popen.o printf.o psignal.o putenv.o \
  791.       qsort.o \
  792.       raise.o rand.o random.o read.o realloc.o regexp.o regsup.o \
  793.       rename.o rmdir.o \
  794. ***************
  795. *** 84,93 ****
  796.       strspn.o strstr.o strtok.o strtol.o strtoul.o strupr.o symlink.o \
  797.       sysconf.o system.o sysvar.o \
  798.       textio.o thread.o time.o timeoday.o times.o tmpfile.o tmpnam.o \
  799. !     toxxx.o ttyname.o \
  800.       uname.o unlink.o unx2dos.o utime.o utmp.o \
  801. !     vfork.o \
  802. !     wait.o wait3.o waitpid.o write.o wtmp.o
  803.   
  804.   # Rule to handle .cpp files
  805.   .SUFFIXES: .cpp
  806. --- 84,93 ----
  807.       strspn.o strstr.o strtok.o strtol.o strtoul.o strupr.o symlink.o \
  808.       sysconf.o system.o sysvar.o \
  809.       textio.o thread.o time.o timeoday.o times.o tmpfile.o tmpnam.o \
  810. !     toxxx.o truncate.o ttyname.o \
  811.       uname.o unlink.o unx2dos.o utime.o utmp.o \
  812. !     vfork.o vfprintf.o vprintf.o \
  813. !     wait.o wait3.o waitpid.o wcmb.o write.o wtmp.o
  814.   
  815.   # Rule to handle .cpp files
  816.   .SUFFIXES: .cpp
  817. diff -cr ../mntlib35/spawn.c ./spawn.c
  818. *** ../mntlib35/spawn.c    Mon Sep 13 22:59:12 1993
  819. --- ./spawn.c    Tue Sep 21 09:50:36 1993
  820. ***************
  821. *** 29,34 ****
  822. --- 29,39 ----
  823.      using /bin/sh
  824.      Files which have i.e '#!/usr/bin/awk -f' as their first character
  825.      are interpreted with "/usr/bin/awk -f <file>"
  826. +    17 Sep 1993 schwab
  827. +    cleaned up emulation code for script execution.
  828. +    File is only interpretable if first two bytes are "#!".
  829. +    Don't modify errno if there is no error.
  830.   */
  831.   
  832.   #include    <stdarg.h>
  833. ***************
  834. *** 54,74 ****
  835.   
  836.   #ifdef HASH_BANG
  837.   
  838. ! static char *extensions[] = { "ttp", "prg", "tos", NULL };
  839.   
  840. ! static int interpret_script __PROTO((int mode, char *path, 
  841. !                     char **argv, char **envp));
  842.   
  843.   static int
  844.   interpret_script(mode, path, argv, envp)
  845.       int        mode;
  846. !     char    *path;
  847. !     char    **argv;
  848. !     char    **envp;
  849.   {
  850. -     char    shellpath[MAXPATHLEN];
  851.       char    tmppath[MAXPATHLEN];
  852. -     char    args[TOS_ARGS + 1];
  853.       char    *shell;
  854.       char    *shellargs;
  855.       char    **shellargv;
  856. --- 59,77 ----
  857.   
  858.   #ifdef HASH_BANG
  859.   
  860. ! static char *const extensions[] = { "ttp", "prg", "tos", NULL };
  861.   
  862. ! static int interpret_script __PROTO((int mode, const char *path, 
  863. !                     char *const *argv, char *const *envp));
  864.   
  865.   static int
  866.   interpret_script(mode, path, argv, envp)
  867.       int        mode;
  868. !     const char *path;
  869. !     char    *const *argv;
  870. !     char    *const *envp;
  871.   {
  872.       char    tmppath[MAXPATHLEN];
  873.       char    *shell;
  874.       char    *shellargs;
  875.       char    **shellargv;
  876. ***************
  877. *** 76,199 ****
  878.       int        fd;
  879.       int        argcount;
  880.       int        i, rv;
  881. !     char    buf;
  882. !     
  883.       /* path is already converted to dos */
  884.       if ((fd = (int)Fopen(path, 0)) < 0)
  885. !         return -fd;
  886. !     if (Fread(fd, 1L, &buf) != 1L) {
  887. !         Fclose(fd);
  888. !         return -1;
  889. !     }
  890. !     if (buf == '#') {
  891. !         if (Fread(fd, 1L, &buf) != 1L) {
  892. !             Fclose(fd);
  893. !             return -1;
  894. !         }
  895. !         if (buf == '!') {
  896. !             /* skip blanks */
  897. !             do {
  898. !                 if (Fread(fd, 1L, &buf) != 1L) {
  899. !                     Fclose(fd);
  900. !                     return -1;
  901. !                 }
  902. !             } while (buf == ' ' || buf == '\t');
  903. !             /* read filename */
  904. !             for (i = 0; i < MAXPATHLEN; i++) {
  905. !                 if (buf == ' ' || buf == '\t' ||
  906. !                         buf == '\r' || buf == '\n')
  907. !                     break;
  908. !                 shellpath[i] = buf;
  909. !                 if (Fread(fd, 1L, &buf) != 1L) {
  910. !                     Fclose(fd);
  911. !                     return -1;
  912. !                 }
  913. !             }
  914. !             shellpath[i] = '\0';
  915. !             shell = shellpath;
  916. !             /* 
  917. !              * read arguments if any
  918. !              * maximum is TOS_ARGS (only restricted for my comfort :-)
  919. !              */
  920. !             nargcount = 0;
  921. !             i = 0;
  922. !             while(i < TOS_ARGS && buf != '\r' && buf != '\n') {
  923. !                 /* skip blanks */
  924. !                 do {
  925. !                     if (Fread(fd, 1L, &buf) != 1L) {
  926. !                         Fclose(fd);
  927. !                         return -1;
  928. !                     }
  929. !                 } while (buf == ' ' || buf == '\t');
  930. !                 if (buf == '\r' || buf == '\n')
  931. !                     break;
  932. !                 
  933. !                 while ( buf != ' '  && buf != '\t' &&
  934. !                         buf != '\r' && buf != '\n' && i < TOS_ARGS) {
  935. !                     args[i++] = buf;
  936. !                     if (Fread(fd, 1L, &buf) != 1L) {
  937. !                         Fclose(fd);
  938. !                         return -1;
  939. !                     }
  940. !                 }
  941. !                 args[i++] = '\0';
  942. !                 nargcount++;
  943. !             }
  944. !             args[i] = '\0';
  945. !             shellargs    = args;
  946. !         }
  947. !         else {
  948. !             shell = "/bin/sh";
  949. !             nargcount = 0;
  950. !             args[0] = '\0';
  951. !             shellargs = args;
  952. !         }
  953. !         Fclose(fd);
  954.           
  955. !         if (*shell) {
  956. !             shell = buffindfile(shell, getenv("PATH"), extensions, tmppath);
  957. !             if (!shell) {
  958. !                 errno = ENOENT;
  959. !                 return -1;        /* file not found */
  960. !             }
  961. !             /* count old args */
  962. !             for (i = 0; argv[i] != 0; i++);
  963. !             argcount = i;
  964. !             
  965. !             shellargv = (char **)Malloc((argcount + nargcount + 2) * sizeof(char *));
  966. !             if (!shellargv) {
  967. !                 errno = ENOMEM;
  968. !                 return -1;
  969. !             }
  970. !             
  971. !             i = 0;
  972. !             shellargv[i++] = shell;
  973. !             while(*shellargs != '\0') {
  974. !                 shellargv[i++] = shellargs;
  975. !                 while (*shellargs++ != '\0');
  976. !             }
  977. !     
  978. !             while (*argv != NULL)
  979. !                 shellargv[i++] = *argv++;
  980. !             shellargv[i] = NULL;
  981. !             
  982. !             rv = _spawnve(mode, shell, shellargv, envp);
  983. !             (void)Mfree(shellargv);
  984. !             return rv;
  985. !         }
  986. !     }
  987.   
  988.       return -1;
  989.   }
  990.   
  991. --- 79,180 ----
  992.       int        fd;
  993.       int        argcount;
  994.       int        i, rv;
  995. !     char buf[1024], *bufp, *argp;
  996. !     long r;
  997.       /* path is already converted to dos */
  998.       if ((fd = (int)Fopen(path, 0)) < 0)
  999. !       {
  1000. !         errno = -fd;
  1001. !         return -1;
  1002. !       }
  1003. !     r = Fread (fd, (long) sizeof (buf) - 1L, buf);
  1004. !     Fclose (fd);
  1005. !     if (r < 0)
  1006. !       {
  1007. !         errno = -(int) r;
  1008. !         return -1;
  1009. !       }
  1010. !     buf[r] = 0;
  1011. !     if (buf[0] == '#' && buf[1] == '!')
  1012. !       {
  1013. !         /* skip blanks */
  1014. !         bufp = buf + 2;
  1015. !         while (*bufp == '\t' || *bufp == ' ')
  1016. !           bufp++;
  1017. !         /* read filename */
  1018. !         shell = bufp;
  1019. !         while (*bufp && *bufp != ' ' && *bufp != '\t'
  1020. !            && *bufp != '\r' && *bufp != '\n')
  1021. !           bufp++;
  1022. !         if (*bufp && *bufp != '\r' && *bufp != '\n')
  1023. !           *bufp++ = 0;
  1024. !         /* else the null will be added below */
  1025. !         /* 
  1026. !          * read arguments if any
  1027. !          */
  1028. !         argp = shellargs = bufp;
  1029. !         nargcount = 0;
  1030. !         i = 0;
  1031. !         while (*bufp && *bufp != '\r' && *bufp != '\n')
  1032. !           {
  1033. !         /* skip blanks */
  1034. !         while (*bufp == ' ' || *bufp == '\t')
  1035. !           bufp++;
  1036. !         if (*bufp == '\r' || *bufp == '\n')
  1037. !           break;
  1038. !         while (*bufp && *bufp != ' ' && *bufp != '\t'
  1039. !                && *bufp != '\r' && *bufp != '\n')
  1040. !           *argp++ = *bufp++;
  1041. !         *argp++ = '\0';
  1042. !         nargcount++;
  1043. !           }
  1044. !         *argp = '\0';
  1045.           
  1046. !         if (*shell)
  1047. !           {
  1048. !         shell = buffindfile (shell, getenv("PATH"), extensions, tmppath);
  1049. !         if (!shell)
  1050. !           {
  1051. !             errno = ENOENT;
  1052. !             return -1;    /* file not found */
  1053. !           }
  1054. !         /* count old args */
  1055. !         for (i = 0; argv[i] != 0; i++);
  1056. !         argcount = i;
  1057. !         shellargv = (char **)Malloc((argcount + nargcount + 2) * sizeof(char *));
  1058. !         if (!shellargv) {
  1059. !           errno = ENOMEM;
  1060. !           return -1;
  1061. !         }
  1062. !         i = 0;
  1063. !         shellargv[i++] = shell;
  1064. !         while(*shellargs != '\0') {
  1065. !           shellargv[i++] = shellargs;
  1066. !           while (*shellargs++ != '\0');
  1067. !         }
  1068. !         while (*argv != NULL)
  1069. !           shellargv[i++] = *argv++;
  1070. !         shellargv[i] = NULL;
  1071. !         rv = _spawnve(mode, shell, shellargv, envp);
  1072. !         (void)Mfree(shellargv);
  1073. !         return rv;
  1074. !           }
  1075. !       }
  1076.   
  1077. +     errno = ENOEXEC;
  1078.       return -1;
  1079.   }
  1080.   
  1081. ***************
  1082. *** 219,226 ****
  1083.       size_t len, cnt;
  1084.       int i, done;
  1085.   #ifdef HASH_BANG
  1086. !     char        **_envp;
  1087. !     char        **_argv;
  1088.   #endif
  1089.   
  1090.       if (mode != P_WAIT && mode != P_OVERLAY && mode != P_NOWAIT) {
  1091. --- 200,207 ----
  1092.       size_t len, cnt;
  1093.       int i, done;
  1094.   #ifdef HASH_BANG
  1095. !     char *const *_envp;
  1096. !     char *const *_argv;
  1097.   #endif
  1098.   
  1099.       if (mode != P_WAIT && mode != P_OVERLAY && mode != P_NOWAIT) {
  1100. ***************
  1101. *** 490,499 ****
  1102.   
  1103.       if (rval < 0)
  1104.       {
  1105. -         errno = (int) -rval;
  1106. -         rval = -1;
  1107.   #ifdef HASH_BANG
  1108. !         if (errno == ENOEXEC) {
  1109.               char    *umode;
  1110.   
  1111.                /* try to find UNIXMODE in environment */
  1112. --- 471,478 ----
  1113.   
  1114.       if (rval < 0)
  1115.       {
  1116.   #ifdef HASH_BANG
  1117. !         if (rval == -ENOEXEC) {
  1118.               char    *umode;
  1119.   
  1120.                /* try to find UNIXMODE in environment */
  1121. ***************
  1122. *** 504,509 ****
  1123. --- 483,490 ----
  1124.               }
  1125.           }
  1126.   #endif
  1127. +         errno = (int) -rval;
  1128. +         rval = -1;
  1129.       }
  1130.       else if (mode == P_OVERLAY)
  1131.       /* note that we get here only if MiNT is not active! */
  1132. Only in .: truncate.c
  1133. diff -cr ../mntlib35/ttyname.c ./ttyname.c
  1134. *** ../mntlib35/ttyname.c    Sat Jun 19 10:39:30 1993
  1135. --- ./ttyname.c    Tue Sep 21 10:05:46 1993
  1136. ***************
  1137. *** 8,16 ****
  1138.   #include <stdio.h>
  1139.   #include <types.h>
  1140.   #include <stat.h>
  1141. - #include <dirent.h>
  1142.   #include <string.h>
  1143.   #include <unistd.h>
  1144.   
  1145.   extern int __mint;
  1146.   
  1147. --- 8,20 ----
  1148.   #include <stdio.h>
  1149.   #include <types.h>
  1150.   #include <stat.h>
  1151.   #include <string.h>
  1152.   #include <unistd.h>
  1153. + #include <mintbind.h>
  1154. + #include <limits.h>
  1155. + #include <errno.h>
  1156. + #include <ioctl.h>
  1157. + #include "lib.h"
  1158.   
  1159.   extern int __mint;
  1160.   
  1161. ***************
  1162. *** 20,26 ****
  1163.   
  1164.   /* Find the file in directory "dir" that matches "sbuf". Returns 1
  1165.    * on success, 0 on failure. Note that "dir" is a prefix, i.e. it
  1166. !  * should end with "/".
  1167.    */
  1168.   
  1169.   static int
  1170. --- 24,30 ----
  1171.   
  1172.   /* Find the file in directory "dir" that matches "sbuf". Returns 1
  1173.    * on success, 0 on failure. Note that "dir" is a prefix, i.e. it
  1174. !  * should end with "\\".
  1175.    */
  1176.   
  1177.   static int
  1178. ***************
  1179. *** 29,57 ****
  1180.       struct stat *sb;
  1181.       char *name;
  1182.   {
  1183. !     char *where = name;
  1184. !     DIR *drv;
  1185. !     struct dirent *next;
  1186.       struct stat testsb;
  1187.   
  1188. !     drv = opendir(dir);
  1189. !     if (!drv) return 0;
  1190.   
  1191.       while (*dir) {
  1192.           *where++ = *dir++;
  1193.       }
  1194.   
  1195. !     while ((next = readdir(drv)) != NULL) {
  1196. !         strcpy(where, next->d_name);
  1197. !         if (stat(name, &testsb))
  1198.               continue;
  1199.           if (testsb.st_dev == sb->st_dev &&
  1200.               testsb.st_ino == sb->st_ino) {
  1201. !             closedir(drv);
  1202.               return 1;
  1203.           }
  1204.       }
  1205. !     closedir(drv);
  1206.       return 0;
  1207.   }
  1208.   
  1209. --- 33,66 ----
  1210.       struct stat *sb;
  1211.       char *name;
  1212.   {
  1213. !     char _name[PATH_MAX];
  1214. !     char *where = _name;
  1215. !     long drv;
  1216.       struct stat testsb;
  1217. +     struct dbuf {
  1218. +         long ino;
  1219. +         char name[NAME_MAX + 1];
  1220. +     } dbuf;
  1221.   
  1222. !     drv = Dopendir (dir, 0);
  1223. !     if ((drv & 0xff000000L) == 0xff000000L) return 0;
  1224.   
  1225.       while (*dir) {
  1226.           *where++ = *dir++;
  1227.       }
  1228.   
  1229. !     while (Dreaddir((int) sizeof (dbuf), drv, &dbuf) == 0) {
  1230. !         strcpy(where, dbuf.name);
  1231. !         if (Fxattr(0, _name, &testsb))
  1232.               continue;
  1233.           if (testsb.st_dev == sb->st_dev &&
  1234.               testsb.st_ino == sb->st_ino) {
  1235. !             Dclosedir(drv);
  1236. !             _dos2unx (_name, name);
  1237.               return 1;
  1238.           }
  1239.       }
  1240. !     Dclosedir(drv);
  1241.       return 0;
  1242.   }
  1243.   
  1244. ***************
  1245. *** 74,88 ****
  1246.           return tname;
  1247.       }
  1248.   
  1249. !     if (fstat(fd, &sb))
  1250.           return (char *)0;
  1251.   
  1252.       /* try the devices first */
  1253. !     if (find_ino("/dev/", &sb, tname))
  1254.           return tname;
  1255.   
  1256.       /* hmmm, maybe we're a pseudo-tty */
  1257. !     if (find_ino("u:/pipe/", &sb, tname))
  1258.           return tname;
  1259.   
  1260.       /* I give up */
  1261. --- 83,97 ----
  1262.           return tname;
  1263.       }
  1264.   
  1265. !     if (Fcntl(fd, &sb, FSTAT))
  1266.           return (char *)0;
  1267.   
  1268.       /* try the devices first */
  1269. !     if (find_ino("u:\\dev\\", &sb, tname))
  1270.           return tname;
  1271.   
  1272.       /* hmmm, maybe we're a pseudo-tty */
  1273. !     if (find_ino("u:\\pipe\\", &sb, tname))
  1274.           return tname;
  1275.   
  1276.       /* I give up */
  1277. diff -cr ../mntlib35/utime.c ./utime.c
  1278. *** ../mntlib35/utime.c    Wed Sep  8 14:57:32 1993
  1279. --- ./utime.c    Tue Sep 21 10:10:06 1993
  1280. ***************
  1281. *** 55,61 ****
  1282.         const struct utimbuf *tset;
  1283.   {
  1284.       int fh;
  1285. !     time_t actime, modtime;
  1286.       unsigned long dtime;    /* dos time equivalent */
  1287.       
  1288.       char filename[PATH_MAX];
  1289. --- 55,61 ----
  1290.         const struct utimbuf *tset;
  1291.   {
  1292.       int fh;
  1293. !     unsigned long actime, modtime;
  1294.       unsigned long dtime;    /* dos time equivalent */
  1295.       
  1296.       char filename[PATH_MAX];
  1297. ***************
  1298. *** 64,86 ****
  1299.   
  1300.       if (tset)
  1301.       {
  1302. !         modtime = tset->modtime;
  1303. !         actime = tset->actime;
  1304.       }
  1305.       else
  1306.       {
  1307. !         time(&actime);
  1308.           modtime = actime;
  1309.       }
  1310.   
  1311.       (void)_unx2dos(_filename, filename);
  1312.   
  1313. !     dtime = _dostime(actime);
  1314. !     settime.actime = (unsigned short) ((dtime >> 16) & 0xFFFF);
  1315. !     settime.acdate = (unsigned short) (dtime & 0xFFFF);
  1316. !     dtime = _dostime(modtime);
  1317. !     settime.modtime = (unsigned short) ((dtime >> 16) & 0xFFFF);
  1318. !     settime.moddate = (unsigned short) (dtime & 0xFFFF);
  1319.       fh = (int) Fopen(filename, 2);
  1320.       if (fh < 0) {
  1321.           errno = -fh;
  1322. --- 64,84 ----
  1323.   
  1324.       if (tset)
  1325.       {
  1326. !         modtime = _dostime (tset->modtime);
  1327. !         actime = _dostime (tset->actime);
  1328.       }
  1329.       else
  1330.       {
  1331. !         actime = ((long) Tgettime () << 16) | (Tgetdate () & 0xFFFF);
  1332.           modtime = actime;
  1333.       }
  1334.   
  1335.       (void)_unx2dos(_filename, filename);
  1336.   
  1337. !     settime.actime = (unsigned short) ((actime >> 16) & 0xFFFF);
  1338. !     settime.acdate = (unsigned short) (actime & 0xFFFF);
  1339. !     settime.modtime = (unsigned short) ((modtime >> 16) & 0xFFFF);
  1340. !     settime.moddate = (unsigned short) (modtime & 0xFFFF);
  1341.       fh = (int) Fopen(filename, 2);
  1342.       if (fh < 0) {
  1343.           errno = -fh;
  1344. ***************
  1345. *** 95,101 ****
  1346. --- 93,102 ----
  1347.               res = Fcntl(fh, (long)0, FUTIME);
  1348.       }
  1349.       if (res == -EINVAL)
  1350. +           {
  1351. +         dtime = modtime;
  1352.           (void)Fdatime((_DOSTIME *) &dtime, fh, 1);
  1353. +           }
  1354.   
  1355.       if ((fh = Fclose(fh)) != 0) {
  1356.           errno = -fh;
  1357. ***************
  1358. *** 109,114 ****
  1359. --- 110,116 ----
  1360.   {
  1361.       unsigned long dtime;
  1362.       unsigned date, time;
  1363. +     long r;
  1364.   
  1365.       assert(t != 0);
  1366.       dtime = _dostime(*t);
  1367. ***************
  1368. *** 115,122 ****
  1369.       date = (int) (dtime & 0xffff);
  1370.       time = (int) (dtime >> 16) & 0xffff;
  1371.   
  1372. !     if (Tsetdate(date) || Tsettime(time)) {
  1373. !         errno = EBADARG;
  1374.           return -1;
  1375.       }
  1376.       return 0;
  1377. --- 117,124 ----
  1378.       date = (int) (dtime & 0xffff);
  1379.       time = (int) (dtime >> 16) & 0xffff;
  1380.   
  1381. !     if ((r = Tsetdate(date)) || (r = Tsettime(time))) {
  1382. !         errno = r == -1 ? EBADARG : (int) -r;
  1383.           return -1;
  1384.       }
  1385.       return 0;
  1386. Only in .: vfprintf.c
  1387. Only in .: vprintf.c
  1388. diff -cr ../mntlib35/waitpid.c ./waitpid.c
  1389. *** ../mntlib35/waitpid.c    Mon Sep 13 06:58:12 1993
  1390. --- ./waitpid.c    Sat Sep 18 02:47:54 1993
  1391. ***************
  1392. *** 22,29 ****
  1393.       long r;
  1394.       int exit_status, sig_term;
  1395.       union wait *statwait;
  1396.       int *status = _status.__wi;
  1397. !     
  1398.       statwait = (union wait *) status;
  1399.       if (__mint == 0) {
  1400.           r = __waitval;
  1401. --- 22,33 ----
  1402.       long r;
  1403.       int exit_status, sig_term;
  1404.       union wait *statwait;
  1405. + #ifdef __GNUC__
  1406.       int *status = _status.__wi;
  1407. ! #else
  1408. !     int *status = _status;
  1409. ! #endif    
  1410.       statwait = (union wait *) status;
  1411.       if (__mint == 0) {
  1412.           r = __waitval;
  1413. Only in .: wcmb.c
  1414. *** /dev/null    Wed Sep 22 15:23:54 1993
  1415. --- nlist.c    Sun Jul 18 15:00:32 1993
  1416. ***************
  1417. *** 0 ****
  1418. --- 1,153 ----
  1419. + /* nlist for mintlib/toslib.
  1420. +  * Written by S.N. Henson and released into the public domain.
  1421. +  *
  1422. +  * Currently uses just standard and GST extended symbol formats.
  1423. +  */
  1424. + #include <st-out.h>
  1425. + #include <fcntl.h>
  1426. + #include <unistd.h>
  1427. + #include <errno.h>
  1428. + #include <macros.h>
  1429. + #include <nlist.h>
  1430. + #include <string.h>
  1431. + #define SYM_BUFSIZE 100
  1432. + #define SYMSIZE sizeof(struct asym)
  1433. + #define GSYM_SIZE 23
  1434. + static int sym_fd;
  1435. + static long symcount;
  1436. + static int getsym __PROTO((struct asym *sptr));
  1437. + /* Read a symbol from a file and put it in sptr */
  1438. + static int getsym(sptr)
  1439. + struct asym *sptr;
  1440. + {
  1441. +     static struct asym symbuf[SYM_BUFSIZE],*symptr;
  1442. +     static long symread;
  1443. +     if( !symread )
  1444. +     {
  1445. +         symread=min(sizeof(symbuf),symcount);
  1446. +         if(symread!=read(sym_fd,symbuf,symread))
  1447. +         {
  1448. +             close(sym_fd);
  1449. +                         symread=0;
  1450. +             errno=EREAD; /* Premature EOF */
  1451. +             return -1;
  1452. +         }
  1453. +         symptr=symbuf;
  1454. +     }
  1455. +     *sptr=*symptr++;
  1456. +     symread-=SYMSIZE;
  1457. +         if( symread < 0 )
  1458. +         {
  1459. +                 symread=0;
  1460. +                 errno=EREAD;
  1461. +                 return -1;
  1462. +         }
  1463. +     return 0;
  1464. + }
  1465. + int nlist(file,nl)
  1466. + char *file;
  1467. + struct nlist *nl;
  1468. + {
  1469. +     struct nlist *p;
  1470. +     struct aexec hbuf;
  1471. +     struct asym sym;
  1472. +     long nl_count;
  1473. +     if(!file || !nl)
  1474. +     {
  1475. +         errno=EFAULT;
  1476. +         return -1;
  1477. +     }
  1478. +     if( ( sym_fd=open(file,O_RDONLY) ) == -1 ) return -1;            
  1479. +     /* Read in file header */
  1480. +     read(sym_fd,&hbuf,sizeof(hbuf));
  1481. +     /* Executable file ? */
  1482. +     if(A_BADMAG(hbuf)) 
  1483. +     {
  1484. +         close(sym_fd);
  1485. +         errno=ENOEXEC;
  1486. +         return -1;
  1487. +     }
  1488. +     /* Any symbols? */
  1489. +     if( !(symcount=hbuf.a_syms) )
  1490. +     {
  1491. +         errno=EDOM;
  1492. +         return -1;
  1493. +     }
  1494. +     if( symcount < sizeof(struct asym) )
  1495. +     {
  1496. +         close(sym_fd);
  1497. +         errno=EREAD;
  1498. +         return -1;
  1499. +     }
  1500. +     /* Seek to symbol table */
  1501. +     if( A_SYMOFF(hbuf)!=lseek(sym_fd,A_SYMOFF(hbuf),SEEK_SET) )
  1502. +     {
  1503. +         close(sym_fd);
  1504. +         errno=EREAD;
  1505. +         return -1;
  1506. +     }
  1507. +     /* Count number of symbols to match */
  1508. +     for(p=nl,nl_count=0;p->n_name;p++)
  1509. +     {
  1510. +         nl_count++;
  1511. +         p->n_value=p->n_type=0;
  1512. +     }
  1513. +     if(!nl_count) return 0;
  1514. +     do
  1515. +     {
  1516. +         char name[GSYM_SIZE];
  1517. +         /* Get one symbol from file */
  1518. +         if(getsym(&sym)) return -1;
  1519. +         symcount-=SYMSIZE;
  1520. +         strncpy(name,sym.a_name,8);
  1521. +         /* If extended symbol, get rest of name */
  1522. +         if( (sym.a_type & A_LNAM) == A_LNAM)
  1523. +         {
  1524. +             if( (symcount <= 0) || getsym((struct asym *)(name+8)))
  1525. +                                       return -1;
  1526. +             symcount-=SYMSIZE;
  1527. +             name[22]=0;
  1528. +         }
  1529. +         else name[8]=0;
  1530. +         /* Check for match */
  1531. +         for(p=nl;p->n_name;p++)
  1532. +         {
  1533. +             if(p->n_type || strcmp(name,p->n_name)) continue;
  1534. +             p->n_value=sym.a_value;
  1535. +             p->n_type=sym.a_type;
  1536. +             if(--nl_count==0) return 0;
  1537. +         }
  1538. +     }
  1539. +     while(symcount > 0);
  1540. +     return nl_count;
  1541. + }
  1542. *** /dev/null    Wed Sep 22 15:24:08 1993
  1543. --- printf.c    Thu Sep 16 02:35:34 1993
  1544. ***************
  1545. *** 0 ****
  1546. --- 1,18 ----
  1547. + #include <stdio.h>
  1548. + #include <stdarg.h>
  1549. + #include "lib.h"
  1550. + #if __STDC__
  1551. + int printf(const char *fmt, ...)
  1552. + #else
  1553. + int printf(fmt) const char *fmt;
  1554. + #endif
  1555. + {
  1556. +     va_list args;
  1557. +     int r;
  1558. +     va_start(args, fmt);
  1559. +     r = _doprnt(stdout, fmt, args);
  1560. +     va_end(args);
  1561. +     return r;
  1562. + }
  1563. *** /dev/null    Wed Sep 22 15:24:18 1993
  1564. --- truncate.c    Tue Sep 21 20:24:34 1993
  1565. ***************
  1566. *** 0 ****
  1567. --- 1,80 ----
  1568. + /*
  1569. + Here is an implementation of truncate/ftruncate for the MiNTlib. There
  1570. + is a special case for truncate, if the filesystem does not recognize
  1571. + FTRUNCATE and the length is zero, Fcreate is used to truncate the
  1572. + file. This only works for tosfs if the file isn't already open. The
  1573. + rest is quite straight forward.
  1574. + Andreas.
  1575. + Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
  1576. + */
  1577. + #include <compiler.h>
  1578. + #include <limits.h>
  1579. + #include <errno.h>
  1580. + #include <mintbind.h>
  1581. + #include <ioctl.h>
  1582. + #ifdef __TURBOC__
  1583. + #include <sys\types.h>
  1584. + #else
  1585. + #include <sys/types.h>
  1586. + #endif
  1587. + #include "lib.h"
  1588. + extern int __mint;
  1589. + int
  1590. + truncate (_filename, length)
  1591. +      const char *_filename;
  1592. +      off_t length;
  1593. + {
  1594. +   int fh, res;
  1595. +   char filename[PATH_MAX];
  1596. +   (void) _unx2dos (_filename, filename);
  1597. +   fh = Fopen (filename, 2);
  1598. +   if (fh < 0)
  1599. +     {
  1600. +       errno = -fh;
  1601. +       return -1;
  1602. +     }
  1603. +   res = -EINVAL;
  1604. +   if (__mint > 90)
  1605. +     res = Fcntl (fh, (long) &length, FTRUNCATE);
  1606. +   Fclose (fh);
  1607. +   if (res == -EINVAL && length == 0)
  1608. +     {
  1609. +       res = Fcreate (filename, 0);
  1610. +       if (res >= 0)
  1611. +     Fclose (res);
  1612. +     }
  1613. +   if (res < 0)
  1614. +     {
  1615. +       errno = -res;
  1616. +       return -1;
  1617. +     }
  1618. +   return 0;
  1619. + }
  1620. + int
  1621. + ftruncate (fd, length)
  1622. +      int fd;
  1623. +      off_t length;
  1624. + {
  1625. +   int res;
  1626. +   if (__mint > 90)
  1627. +     res = Fcntl (fd, (long) &length, FTRUNCATE);
  1628. +   else
  1629. +     res = -EINVAL;
  1630. +   if (res < 0)
  1631. +     {
  1632. +       errno = -res;
  1633. +       return -1;
  1634. +     }
  1635. +   return 0;
  1636. + }
  1637. *** /dev/null    Wed Sep 22 15:24:30 1993
  1638. --- vfprintf.c    Thu Sep 16 02:35:34 1993
  1639. ***************
  1640. *** 0 ****
  1641. --- 1,13 ----
  1642. + #include <stdio.h>
  1643. + #include <stdarg.h>
  1644. + #include "lib.h"
  1645. + int
  1646. + vfprintf(fp, fmt, args)
  1647. +     FILE *fp;
  1648. +     const char *fmt;
  1649. +     va_list args;
  1650. + {
  1651. +     return(_doprnt(fp, fmt, args));
  1652. + }
  1653. *** /dev/null    Wed Sep 22 15:24:54 1993
  1654. --- vprintf.c    Thu Sep 16 02:35:34 1993
  1655. ***************
  1656. *** 0 ****
  1657. --- 1,10 ----
  1658. + #include <stdio.h>
  1659. + #include <stdarg.h>
  1660. + #include "lib.h"
  1661. + int
  1662. + vprintf(fmt, args)
  1663. +     const char *fmt;
  1664. +     va_list args;
  1665. + {
  1666. +     return(_doprnt(stdout, fmt, args));
  1667. + }
  1668. *** /dev/null    Wed Sep 22 15:24:40 1993
  1669. --- wcmb.c    Tue Sep 21 09:04:18 1993
  1670. ***************
  1671. *** 0 ****
  1672. --- 1,79 ----
  1673. + /* This implements the wc* and mb* ANSI/ISO functions.
  1674. +    They're in the "DUMB" locale ;), and in the public domain.
  1675. + */
  1676. + #include <stdlib.h>
  1677. + #include <stddef.h>
  1678. + int
  1679. + mblen(mbstr, n)
  1680. + const char *mbstr;
  1681. + size_t n;
  1682. + {
  1683. +     /* Locale test: no shift states. */
  1684. +     if(mbstr == NULL) return 0;
  1685. +     
  1686. +     if(*mbstr == '\0' || n == 0) return 0;
  1687. +     
  1688. +     /* There are no multibytesequences... */
  1689. +     return 1;
  1690. + }
  1691. + size_t
  1692. + mbstowcs(wstr, mbstr, maxlen)
  1693. + wchar_t *wstr;
  1694. + const char *mbstr;
  1695. + size_t maxlen;
  1696. + {
  1697. +     size_t revcnt = maxlen;
  1698. +     
  1699. +     if(mbstr == NULL) mbstr = "";
  1700. +     
  1701. +     while(revcnt && (*wstr++ = *mbstr++)) revcnt--;
  1702. +     
  1703. +     return maxlen - revcnt;
  1704. + }
  1705. + int
  1706. + mbtowc(wstr, mbstr, n)
  1707. + wchar_t *wstr;
  1708. + const char *mbstr;
  1709. + size_t n;
  1710. + {
  1711. +     /* Locale test: no shift states. */
  1712. +     if(mbstr == NULL) return 0;
  1713. +     
  1714. +     if(*mbstr == '\0' || n == 0) return 0;
  1715. +     
  1716. +     if(wstr != NULL) *wstr = *mbstr;
  1717. +     return 1;
  1718. + }
  1719. + size_t
  1720. + wcstombs(mbstr, wstr, maxlen)
  1721. + char *mbstr;
  1722. + const wchar_t *wstr;
  1723. + size_t maxlen;
  1724. + {
  1725. +     size_t revcnt = maxlen;
  1726. +     static const wchar_t wnull[1] = { 0 };
  1727. +     
  1728. +     if(wstr == NULL) wstr = wnull; /* Better avoid L"". */
  1729. +     
  1730. +     while(revcnt && (*mbstr++ = (char) *wstr++)) revcnt--;
  1731. +     
  1732. +     return maxlen - revcnt;
  1733. + }
  1734. + int
  1735. + wctomb(mbstr, wchar)
  1736. + char *mbstr;
  1737. + wchar_t wchar;
  1738. + {
  1739. +     /* Nope, still no statedependencies. */
  1740. +     if(mbstr == NULL) return 0;
  1741. +     
  1742. +     *mbstr = (char) wchar;
  1743. +     return 1;
  1744. + }
  1745.