[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patches for MINTLIB46 and GEMLIB31
Hello,
once again I try to get your attention. In December a posted a patch, which removes the __mint
dependencies from about 40 files of the MINTLIB46. Now I have a new patch with fixes some problems
of the old one:
- isatty.c got broken.
- mktemp.c and buffindf.c, too.
- a new patch for open.c, which allows to open pipes with mode (... | O_CREAT) on MagiC.
- there is a second patch attached, which fixes the broken appl_search call in GEMLIB31.
I hope somebody will test the library now, if you would like to I can make the binaries
available for ftp.
Dirk
********************************* Patch for MINTLIB *************************************
diff -u 46.orig/libsrc/abort.c 46/libsrc/abort.c
--- 46.orig/libsrc/abort.c Tue Mar 1 22:54:40 1994
+++ 46/libsrc/abort.c Fri Dec 8 16:48:11 1995
@@ -4,21 +4,18 @@
#include <stdlib.h>
#include <unistd.h>
#include <mintbind.h>
+#include <errno.h>
#include "lib.h"
#ifndef SIGABRT
#define SIGABRT SIGIOT
#endif
-extern int __mint;
-
__EXITING
abort()
{
#ifdef __MINT__
- if (__mint)
- {
- (void) Pkill(Pgetpid(), SIGABRT);
+ if (Pkill(Pgetpid(), SIGABRT) != -EINVAL) {
/* process still alive, maybe SIGABRT was blocked */
(void) Psigsetmask(Psigblock(0) & ~(sigmask(SIGABRT)));
/* process still alive, maybe SIGABRT was ignored */
Only in 46.orig/libsrc: access.c.orig
diff -u 46.orig/libsrc/alarm.c 46/libsrc/alarm.c
--- 46.orig/libsrc/alarm.c Wed Jul 7 01:39:24 1993
+++ 46/libsrc/alarm.c Tue Dec 5 18:28:32 1995
@@ -7,21 +7,24 @@
#include <limits.h>
#include <unistd.h>
-extern int __mint;
-
unsigned int
alarm(secs)
unsigned secs;
{
long r;
+ static short have_talarm = 1;
- if (__mint == 0)
- return 0;
+ if (have_talarm) {
#ifndef __MSHORT__
- if (secs > ((unsigned int) (LONG_MAX/1000)))
- secs = ((unsigned int) (LONG_MAX/1000));
+ if (secs > ((unsigned int) (LONG_MAX/1000)))
+ secs = ((unsigned int) (LONG_MAX/1000));
#endif
- r = Talarm((long) secs);
+ r = Talarm((long) secs);
+ if (r == -EINVAL)
+ have_talarm = 0;
+ else
+ return (unsigned int) r;
+ }
+ return 0;
- return (unsigned int) r;
}
Only in 46.orig/libsrc: bblink.c.orig
diff -u 46.orig/libsrc/buffindf.c 46/libsrc/buffindf.c
--- 46.orig/libsrc/buffindf.c Tue Mar 14 21:01:02 1995
+++ 46/libsrc/buffindf.c Wed Jan 24 10:25:09 1996
@@ -120,6 +120,7 @@
}
if (c)
fpath++;
+
*s++ = DIRSEP1;
t = fname;
while ((*s++ = *t++) != 0)
Only in 46.orig/libsrc: chdir.c.orig
Only in 46.orig/libsrc: chmod.c.orig
Only in 46.orig/libsrc: chown.c.orig
diff -u 46.orig/libsrc/console.c 46/libsrc/console.c
--- 46.orig/libsrc/console.c Wed Jul 7 01:39:26 1993
+++ 46/libsrc/console.c Fri Dec 8 16:36:31 1995
@@ -8,21 +8,21 @@
#include <osbind.h>
#include <mintbind.h>
#include <support.h>
+#include <errno.h>
#define CTRL(x) (x & 0x1f)
#define CBUFSIZ 80
-extern int __mint;
-
int
_console_read_byte(fd)
int fd;
{
short f;
+ int retvalue;
+
+ if ((retvalue = (int)Fgetchar(fd, 0)) != -EINVAL)
+ return retvalue;
- if (__mint) {
- return (int)Fgetchar(fd, 0);
- }
if (fd == 0)
return (int)Crawcin();
if (fd == 2)
Common subdirectories: 46.orig/libsrc/crlf and 46/libsrc/crlf
diff -u 46.orig/libsrc/do_lock.c 46/libsrc/do_lock.c
--- 46.orig/libsrc/do_lock.c Tue Mar 14 21:01:45 1995
+++ 46/libsrc/do_lock.c Fri Dec 8 16:37:38 1995
@@ -10,6 +10,8 @@
#include <file.h>
#include "lib.h"
+extern int __mint;
+
int
_do_lock(fd, cmd, size, whence)
int fd;
@@ -20,12 +22,7 @@
struct flock lock;
int fcmd;
long r;
- extern int __mint;
- if (!__mint) {
- errno = EINVAL;
- return -1;
- }
lock.l_whence = whence;
lock.l_start = 0;
lock.l_len = size;
Only in 46.orig/libsrc: do_stat.c.orig
diff -u 46.orig/libsrc/dup.c 46/libsrc/dup.c
--- 46.orig/libsrc/dup.c Tue Mar 1 22:54:54 1994
+++ 46/libsrc/dup.c Tue Jan 23 12:20:39 1996
@@ -10,8 +10,6 @@
#include <unistd.h>
#include "lib.h"
-extern int __mint;
-
int
dup(handle)
int handle;
@@ -19,9 +17,7 @@
register int rv;
long flags;
- if (__mint)
- rv = (int)Fcntl(handle, (long)0, F_DUPFD);
- else
+ if ((rv = (int)Fcntl(handle, (long)0, F_DUPFD)) == -EINVAL)
rv = (int)Fdup(handle);
if (rv < (__SMALLEST_VALID_HANDLE)) {
@@ -34,10 +30,9 @@
__open_stat[__OPEN_INDEX(rv)] =
__open_stat[__OPEN_INDEX(handle)];
}
- if (__mint) {
- flags = (long)Fcntl(rv, (long)0, F_GETFD);
+
+ if ((flags = (long)Fcntl(rv, (long)0, F_GETFD)) != -EINVAL)
(void)Fcntl(rv, flags & ~FD_CLOEXEC, F_SETFD);
- }
}
return(rv);
}
diff -u 46.orig/libsrc/dup2.c 46/libsrc/dup2.c
--- 46.orig/libsrc/dup2.c Tue Mar 1 22:54:54 1994
+++ 46/libsrc/dup2.c Tue Dec 5 13:25:38 1995
@@ -10,8 +10,6 @@
#include <unistd.h>
#include "lib.h"
-extern int __mint;
-
int
dup2(handle1, handle2)
int handle1, handle2;
@@ -28,10 +26,9 @@
if (__OPEN_INDEX(handle2) < __NHANDLES)
__open_stat[__OPEN_INDEX(handle2)] =
__open_stat[__OPEN_INDEX(handle1)];
- if (__mint) {
- flags = (long)Fcntl(handle2, (long)0, F_GETFD);
+
+ if ((flags = (long)Fcntl(handle2, (long)0, F_GETFD)) != -EINVAL)
(void)Fcntl(handle2, flags & ~FD_CLOEXEC, F_SETFD);
- }
}
return (rv < 0) ? -1 : handle2;
}
diff -u 46.orig/libsrc/enoent.c 46/libsrc/enoent.c
--- 46.orig/libsrc/enoent.c Tue Mar 1 22:54:56 1994
+++ 46/libsrc/enoent.c Fri Dec 8 11:21:58 1995
@@ -4,8 +4,6 @@
#include <mintbind.h>
#include "lib.h"
-extern int __mint;
-
/*
Given a pathname for which some system call returned EPATH, this function
decides if UNIX would have returned ENOENT instead.
@@ -18,21 +16,22 @@
{
register char *s;
struct stat st;
- long oldmask;
+ long oldmask, xattr;
- if (__mint < 9)
- {
- return 0; /* don't bother... */
- }
for (s = path; *s; s++)
/* nop */;
oldmask = Psigblock(~0L);
+
for ( ; s != path; s--)
{
if (*s == '\\')
{
*s = '\0';
- if ((Fxattr(0, path, &st) == 0) && ((st.st_mode & S_IFMT) != S_IFDIR))
+ if ((xattr = Fxattr(0, path, &st)) == -EINVAL) {
+ (void) Psigsetmask(oldmask);
+ return 0;
+ }
+ if ((xattr == 0) && ((st.st_mode & S_IFMT) != S_IFDIR))
{
*s = '\\';
(void) Psigsetmask(oldmask);
diff -u 46.orig/libsrc/execp.c 46/libsrc/execp.c
--- 46.orig/libsrc/execp.c Fri Dec 8 17:13:29 1995
+++ 46/libsrc/execp.c Mon Nov 6 11:07:01 1995
@@ -30,8 +30,7 @@
{
const char *execname;
char buffer[PATH_MAX];
- execname = _buffindfile(name, getenv("PATH"), extensions,buffer,
- sizeof (buffer));
+ execname = _buffindfile(name, getenv("PATH"), extensions,buffer);
if (!execname) {
errno = ENOENT;
return -1; /* file not found */
Only in 46.orig/libsrc: execp.c.orig
diff -u 46.orig/libsrc/fcntl.c 46/libsrc/fcntl.c
--- 46.orig/libsrc/fcntl.c Sat Jul 10 04:53:26 1993
+++ 46/libsrc/fcntl.c Tue Dec 5 13:45:46 1995
@@ -9,8 +9,6 @@
#include <stdarg.h>
#include <unistd.h>
-extern int __mint; /* MiNT version */
-
#ifdef __STDC__
int fcntl (int f, int cmd, ...)
#else
@@ -24,13 +22,9 @@
va_start(argp, cmd);
- if (__mint) {
- r = Fcntl(f, va_arg(argp, void *), cmd);
- if (r == -ELOCKED)
- r = -EACCES;
- }
- else
- r = -EINVAL;
+ r = Fcntl(f, va_arg(argp, void *), cmd);
+ if (r == -ELOCKED)
+ r = -EACCES;
if (r < 0) {
errno = (int) -r;
r = -1L;
Only in 46.orig/libsrc: findfile.c.orig
Only in 46.orig/libsrc: fopen_i.c.orig
diff -u 46.orig/libsrc/fstat.c 46/libsrc/fstat.c
--- 46.orig/libsrc/fstat.c Tue Mar 14 21:01:46 1995
+++ 46/libsrc/fstat.c Tue Dec 5 14:04:03 1995
@@ -12,8 +12,6 @@
#include <ioctl.h> /* for FSTAT */
#include "lib.h"
-extern int __mint;
-
extern ino_t __inode;
__EXTERN int _do_stat __PROTO((const char *_path, struct stat *st, int lflag));
@@ -37,8 +35,7 @@
_DOSTIME timeptr;
short magic;
- if (__mint >= 9) { /* use FSTAT Fcntl */
- r = Fcntl(fd, (long)st, FSTAT);
+ if ((r = Fcntl(fd, (long)st, FSTAT)) != -EINVAL) {
if (r) {
errno = (int) -r;
return -1;
diff -u 46.orig/libsrc/getcwd.c 46/libsrc/getcwd.c
--- 46.orig/libsrc/getcwd.c Fri Dec 8 17:13:29 1995
+++ 46/libsrc/getcwd.c Tue Dec 5 14:17:46 1995
@@ -14,7 +14,6 @@
This routine is in the public domain.
********************************************************************/
-extern int __mint;
extern char _rootdir; /* in main.c: user's preferred root directory */
char *getcwd(buf, size)
@@ -37,14 +36,15 @@
_path[1] = ':';
_path[2] = '\0';
path = _path + 2;
- if (__mint >= 96) {
- if ((r = (int) Dgetcwd(path, 0, size - 2)) != 0) {
+
+ r = (int) Dgetcwd(path, 0, size - 2);
+
+ if (r != 0 && r != -EINVAL) {
if (buf_malloced)
free(buf);
errno = -r;
return NULL;
- }
- } else {
+ } else if (r == -EINVAL) {
(void)Dgetpath(path, 0);
}
Only in 46.orig/libsrc: getcwd.c.orig
diff -u 46.orig/libsrc/getdtabl.c 46/libsrc/getdtabl.c
--- 46.orig/libsrc/getdtabl.c Tue Oct 12 08:18:54 1993
+++ 46/libsrc/getdtabl.c Fri Dec 8 16:38:25 1995
@@ -2,14 +2,16 @@
#include <mintbind.h>
#include <support.h>
#include <unistd.h>
-
-extern int __mint;
+#include <errno.h>
int
getdtablesize()
{
- if (__mint < 7)
- return FOPEN_MAX;
+ int r;
- return (int)Sysconf(_SC_OPEN_MAX);
+ r = (int)Sysconf(_SC_OPEN_MAX);
+
+ if (r == -EINVAL)
+ return FOPEN_MAX;
+ return r;
}
diff -u 46.orig/libsrc/getegid.c 46/libsrc/getegid.c
--- 46.orig/libsrc/getegid.c Tue Mar 1 22:54:44 1994
+++ 46/libsrc/getegid.c Fri Dec 8 16:39:02 1995
@@ -1,12 +1,21 @@
#include <types.h>
#include <unistd.h>
#include <mintbind.h>
-
-extern int __mint;
+#include <errno.h>
gid_t
getegid()
{
- return __mint >= 95 ? Pgetegid() : getgid();
+ long r;
+ static short have_getegid = 1;
+
+ if (have_getegid) {
+ r = Pgetegid();
+ if (r == -EINVAL)
+ have_getegid = 0;
+ else
+ return (gid_t)r;
+ }
+ return getgid();
}
diff -u 46.orig/libsrc/geteuid.c 46/libsrc/geteuid.c
--- 46.orig/libsrc/geteuid.c Tue Mar 1 22:54:44 1994
+++ 46/libsrc/geteuid.c Fri Dec 8 16:39:27 1995
@@ -1,11 +1,20 @@
#include <types.h>
#include <unistd.h>
#include <mintbind.h>
-
-extern int __mint;
+#include <errno.h>
uid_t
geteuid()
{
- return __mint >= 95 ? Pgeteuid() : getuid();
+ long r;
+ static short have_geteuid = 1;
+
+ if (have_geteuid) {
+ r = Pgeteuid();
+ if (r == -EINVAL)
+ have_geteuid = 0;
+ else
+ return (uid_t)r;
+ }
+ return getuid();
}
diff -u 46.orig/libsrc/getgroup.c 46/libsrc/getgroup.c
--- 46.orig/libsrc/getgroup.c Tue Mar 14 21:03:46 1995
+++ 46/libsrc/getgroup.c Fri Dec 8 16:07:38 1995
@@ -27,8 +27,6 @@
#include <stdlib.h> /* for calloc() */
#endif
-extern int __mint;
-
int
getgroups(gsetlen, grpset)
int gsetlen;
@@ -39,24 +37,22 @@
struct passwd *userpw;
int i;
gid_t currgid;
+ long r;
- if (!__mint)
- return 0;
-
- if (__mint >= 0x10b)
- {
- long r;
+ r = Pgetgroups (gsetlen, grpset);
- r = Pgetgroups (gsetlen, grpset);
+ if (r != EINVAL) {
if (r < 0)
{
errno = -r;
return -1;
}
return r;
- }
+ }
- currgid = getgid();
+ currgid = (gid_t)Pgetgid();
+ if (currgid == (gid_t)(-EINVAL)) return 0;
+
if (gsetlen) {
if (gsetlen < 0 || !grpset) {
errno = EINVAL;
Only in 46.orig/libsrc: getitimer.c.orig
diff -u 46.orig/libsrc/getloadavg.c 46/libsrc/getloadavg.c
--- 46.orig/libsrc/getloadavg.c Fri Dec 8 17:06:02 1995
+++ 46/libsrc/getloadavg.c Tue Dec 5 14:53:16 1995
@@ -8,8 +8,6 @@
#include <errno.h>
#include <mintbind.h>
-extern int __mint;
-
int
getloadavg (loadavg, nelem)
double *loadavg;
@@ -17,12 +15,6 @@
{
long uptime, avenrun[3], r;
int i;
-
- if (!__mint)
- {
- errno = EINVAL;
- return -1;
- }
r = Suptime (&uptime, avenrun);
if (r < 0)
Only in 46.orig/libsrc: getloadavg.c.orig
Only in 46.orig/libsrc: getpass.c.orig
diff -u 46.orig/libsrc/getpid.c 46/libsrc/getpid.c
--- 46.orig/libsrc/getpid.c Tue Mar 14 21:03:48 1995
+++ 46/libsrc/getpid.c Tue Dec 5 15:10:35 1995
@@ -4,10 +4,18 @@
#include <mintbind.h>
#include <errno.h>
-extern int __mint;
-
int
getpid()
{
- return __mint ? Pgetpid() : (int) ( ((long)_base) >> 8 );
+ int r;
+ static short have_getpid = 1;
+
+ if (have_getpid) {
+ r = (int)Pgetpid();
+ if (r == -EINVAL)
+ have_getpid = 0;
+ else
+ return r;
+ }
+ return ((int) ( ((long)_base) >> 8 ));
}
diff -u 46.orig/libsrc/getrusag.c 46/libsrc/getrusag.c
--- 46.orig/libsrc/getrusag.c Tue Oct 12 08:18:56 1993
+++ 46/libsrc/getrusag.c Tue Dec 5 15:17:19 1995
@@ -7,7 +7,6 @@
#include <resource.h>
#include <errno.h>
-extern int __mint;
extern long _childtime;
__EXTERN void _bzero __PROTO((void *, unsigned long));
@@ -48,13 +47,13 @@
long usage[8];
_bzero(data, (unsigned long) (sizeof (struct rusage)));
- if (__mint) {
- r = Prusage(usage);
- if (r < 0) {
- errno = (int) -r;
- return -1;
- }
- } else {
+
+ r = Prusage(usage);
+
+ if (r < 0 && r != -EINVAL) {
+ errno = (int) -r;
+ return -1;
+ } else if (r == -EINVAL) {
usage[0] = usage[2] = usage[4] = 0;
usage[1] = _clock() - _childtime;
usage[3] = _childtime;
Only in 46.orig/libsrc: initgroups.c.orig
diff -u 46.orig/libsrc/isatty.c 46/libsrc/isatty.c
--- 46.orig/libsrc/isatty.c Tue Mar 14 21:01:48 1995
+++ 46/libsrc/isatty.c Wed Jan 24 10:24:17 1996
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <unistd.h>
#include <mintbind.h>
+#include <errno.h>
#include "lib.h"
struct __open_file __open_stat[__NHANDLES];
@@ -14,19 +15,19 @@
isatty(fd)
int fd;
{
- int rc;
+ int rc, retval;
long oldloc;
int handle = __OPEN_INDEX(fd);
- extern int __mint;
+ long dummy;
if (handle < __NHANDLES)
if (__open_stat[handle].status != FH_UNKNOWN)
return(__open_stat[handle].status == FH_ISATTY);
- if (__mint) {
- /* save 1 or 2 system calls (isatty gets called on every open...) */
- long dummy;
- rc = (Fcntl(fd, &dummy, TIOCGPGRP) == 0);
- } else {
+
+ /* save 1 or 2 system calls (isatty gets called on every open...) */
+
+ retval = Fcntl(fd, &dummy, TIOCGPGRP);
+ if (retval == -EINVAL) {
oldloc = Fseek(0L, fd, SEEK_CUR); /* save current location */
if (Fseek(1L, fd, SEEK_CUR) != 0) { /* try to seek ahead one byte */
/* got either a file position or an error (usually EBADARG indicating
@@ -37,6 +38,8 @@
else
rc = 1; /* yes, tty */
}
+ else
+ rc = (retval == 0);
if (handle < __NHANDLES)
if (rc) {
__open_stat[handle].status = FH_ISATTY;
diff -u 46.orig/libsrc/killpg.c 46/libsrc/killpg.c
--- 46.orig/libsrc/killpg.c Tue Mar 14 21:03:50 1995
+++ 46/libsrc/killpg.c Fri Dec 8 16:15:37 1995
@@ -7,8 +7,6 @@
#include <unistd.h>
#include <mintbind.h>
-extern int __mint;
-
/* vector of signal handlers (for TOS) */
extern __Sigfunc _sig_handler[]; /* in signal.c */
@@ -26,22 +24,13 @@
{
long r;
-#if 0
- if (__mint == 0) {
- if (pgrp == 0 || pgrp == getpgrp())
- return kill(getpid(), sig);
- errno = EINVAL;
- return -1;
- }
-#endif
if (pgrp < 0) {
errno = ERANGE;
return -1;
}
r = Pkill(-pgrp, sig);
- if (__mint < 7) { /* compensate for a bug in MiNT 0.6 */
- (void)Syield();
- }
+ /* (void)Syield(); */
+
if (r == -EINVAL)
{
_have_pkill = 0;
Common subdirectories: 46.orig/libsrc/lattice and 46/libsrc/lattice
Only in 46.orig/libsrc: lib.h.orig
Only in 46/libsrc: libinst
Only in 46/libsrc: linea.h
diff -u 46.orig/libsrc/link.c 46/libsrc/link.c
--- 46.orig/libsrc/link.c Fri Dec 8 17:13:29 1995
+++ 46/libsrc/link.c Tue Dec 5 15:38:31 1995
@@ -7,8 +7,6 @@
#include <stat.h>
#include "lib.h"
-extern int __mint;
-
/*
* if MiNT is not active, we try to fail gracefully
*/
@@ -20,15 +18,11 @@
long r;
char old[MAXPATHLEN], new[MAXPATHLEN];
- if (__mint < 9) {
- errno = EXDEV;
- return -1;
- }
_unx2dos(_old, old, sizeof (old));
_unx2dos(_new, new, sizeof (new));
r = Flink(old, new);
- if (r < 0) {
+ if (r < 0 && r != -EINVAL) {
struct stat sb;
if ((r == -EPATH)) {
@@ -39,5 +33,9 @@
errno = (int) -r;
return -1;
}
+ else if (r == -EINVAL) {
+ errno = EXDEV;
+ return -1;
+ }
return 0;
}
Only in 46.orig/libsrc: link.c.orig
diff -u 46.orig/libsrc/main.c 46/libsrc/main.c
--- 46.orig/libsrc/main.c Fri Dec 8 17:13:30 1995
+++ 46/libsrc/main.c Fri Nov 10 15:05:40 1995
@@ -17,6 +17,7 @@
int errno;
int __mint; /* 0 for TOS, MiNT version number otherwise */
+int _pdomain; /* errorcode of Pdomain call */
char _rootdir; /* user's preferred root directory */
@@ -103,8 +104,8 @@
* check for MiNT
*/
(void)Supexec(getMiNT);
- if (__mint && _app)
- (void)Pdomain(1); /* set MiNT domain */
+ if (_app)
+ _pdomain = Pdomain(1); /* set MiNT domain */
/*
* initialize UNIXMODE stuff. Note that this library supports only
Only in 46.orig/libsrc: main.c.orig
Only in 46.orig/libsrc: mincl.orig
Only in 46/libsrc: mint.dat
diff -u 46.orig/libsrc/mkdir.c 46/libsrc/mkdir.c
--- 46.orig/libsrc/mkdir.c Fri Dec 8 17:13:30 1995
+++ 46/libsrc/mkdir.c Tue Dec 5 18:11:44 1995
@@ -13,14 +13,13 @@
#include "lib.h"
extern int errno;
-extern int __mint;
int mkdir(_path, mode)
const char *_path;
mode_t mode;
{
struct stat statbuf;
- int rv;
+ int rv, umask;
char path[PATH_MAX];
_unx2dos(_path, path, sizeof (path));
@@ -43,8 +42,8 @@
errno = -rv;
return -1;
}
- if (__mint >= 9) {
- int umask = Pumask (0);
+
+ if ((umask = Pumask (0)) != -EINVAL) {
(void) Pumask (umask);
(void)Fchmod(path, mode & ~umask);
}
Only in 46.orig/libsrc: mkdir.c.orig
diff -u 46.orig/libsrc/mkfifo.c 46/libsrc/mkfifo.c
--- 46.orig/libsrc/mkfifo.c Fri Dec 8 17:13:30 1995
+++ 46/libsrc/mkfifo.c Tue Jan 23 13:22:55 1996
@@ -6,6 +6,8 @@
#include <types.h>
#include <limits.h>
#include <stat.h>
+#include <unistd.h>
+#include "lib.h"
int
mkfifo(_path, mode)
@@ -18,12 +20,7 @@
unsigned short x;
long r;
int i;
- extern int __mint;
- if (__mint < 9) {
- errno = EINVAL;
- return -1;
- }
/* create symlink to /pipe/n$ mode id (see open.c)
for id code pid&0x7fff and time>>1 in base-36, this just fits
in pipefs' limit of 14 chars... */
@@ -38,7 +35,7 @@
*s++ = ((FMODE & 0xf0) >> 4) + '@';
*s++ = (FMODE & 0xf) + '@';
#endif
- x = 36 * 36 * 36 - 1 - (Pgetpid () & 0x7fff);
+ x = (unsigned short)36 * (unsigned short)36 * (unsigned short)36 - 1 - (unsigned short)(getpid () & 0x7fff);
c = x % 36;
if (c > 9)
c += 'a' - '9' - 1;
@@ -73,6 +70,10 @@
}
*s = 0;
r = Fsymlink(linkf, path);
+ if (r == -EINVAL) {
+ errno = EINVAL;
+ return -1;
+ }
if (r) {
struct stat sb;
Only in 46.orig/libsrc: mkfifo.c.orig
Only in 46.orig/libsrc: mknod.c.orig
diff -u 46.orig/libsrc/mktemp.c 46/libsrc/mktemp.c
--- 46.orig/libsrc/mktemp.c Wed Sep 15 14:08:32 1993
+++ 46/libsrc/mktemp.c Mon Jan 22 14:59:31 1996
@@ -9,10 +9,9 @@
#include <unistd.h>
#include <assert.h>
#include <errno.h>
+#include <mintbind.h>
#include "lib.h"
-extern int __mint; /* 0 for TOS, MiNT version number otherwise */
-
#define TEN_MUL(X) ((((X) << 2) + (X)) << 1)
char * mktemp(pattern)
@@ -21,7 +20,7 @@
char * p, * q;
long tempnum, nx;
static int startat = 0;
- int save_errno;
+ int save_errno, pid;
assert((pattern != NULL));
@@ -31,11 +30,14 @@
if((nx = p - q) == 0) /* # of X's */
return NULL;
+ pid = Pgetpid();
+
/* if MiNT is active and there's room, put in the pid */
/* we need 5 X's for this: up to 3 for the pid, and up to 2 for the
extra number */
- if (__mint && nx > 4 && startat < 256) {
- (void) _itoa(getpid(), q, 10);
+
+ if ((pid != -EINVAL) && nx > 4 && startat < 256) {
+ (void) _itoa(pid, q, 10);
while (*q) q++;
/* be sure to generate each name only once */
if (startat < 16) *q++ = '0';
Only in 46.orig/libsrc: n.rej.orig
diff -u 46.orig/libsrc/nice.c 46/libsrc/nice.c
--- 46.orig/libsrc/nice.c Wed Sep 15 14:08:32 1993
+++ 46/libsrc/nice.c Tue Dec 5 18:27:41 1995
@@ -8,16 +8,20 @@
#include <mintbind.h>
#include <support.h>
-extern long __mint;
-
int
nice(p)
int p;
{
- if (__mint)
- return Pnice(p);
- else {
- errno = EINVAL;
- return -1;
+ int r;
+ static short have_pnice = 1;
+
+ if (have_pnice) {
+ r = Pnice(p);
+ if (r == -EINVAL)
+ have_pnice = 0;
+ else
+ return r;
}
+ errno = EINVAL;
+ return -1;
}
diff -u 46.orig/libsrc/open.c 46/libsrc/open.c
--- 46.orig/libsrc/open.c Fri Dec 8 17:13:31 1995
+++ 46/libsrc/open.c Mon Jan 22 11:00:15 1996
@@ -151,10 +151,13 @@
if (__mint >= 9)
rv = (int) Fopen (filename, iomode & modemask);
else {
- rv = (int)Fcreate(filename, 0x00);
+ rv = (int)Fcreate(filename, 0x00);
if (rv >= 0) {
- (void)Fclose(rv);
- rv = (int)Fopen(filename,iomode & modemask);
+ sb.st_mode = 0;
+ if (fstat(rv,&sb) != 0 || !S_ISFIFO(sb.st_mode)) {
+ (void)Fclose(rv);
+ rv = (int)Fopen(filename,iomode & modemask);
+ }
}
}
if (rv >= 0 && __mint >= 9)
Only in 46.orig/libsrc: open.c.orig
Only in 46.orig/libsrc: opendir.c.orig
Only in 46.orig/libsrc: osbind.cpp.orig
diff -u 46.orig/libsrc/pause.c 46/libsrc/pause.c
--- 46.orig/libsrc/pause.c Wed Jul 7 01:39:36 1993
+++ 46/libsrc/pause.c Tue Jan 23 13:24:41 1996
@@ -5,16 +5,15 @@
#include <errno.h>
#include <unistd.h>
-extern int __mint;
-
int
pause()
{
- if (__mint)
- (void)Pause();
- /* do nothing for TOS */
- errno = EINTR;
- return -1;
+ if (Pause() == -EINVAL) {
+ /* do nothing for TOS */
+ errno = EINTR;
+ return -1;
+ }
+ return 0;
}
/* Public domain sigpause() - AGK */
@@ -24,19 +23,16 @@
long mask;
{
long oldmask;
-
- if (__mint == 0) {
- /* for TOS, we just toggle the signal mask -- maybe
- * there's a pending signal that we can receive.
- */
- oldmask = sigsetmask(mask);
- sigsetmask(oldmask);
- }
- else if (__mint <= 94) {
- oldmask = Psigsetmask(mask);
- (void)Pause();
- (void)Psigsetmask(oldmask);
+
+ if (Psigpause(mask) == -EINVAL) {
+ if ((oldmask = Psigsetmask(mask)) == -EINVAL) {
+ oldmask = sigsetmask(mask);
+ sigsetmask(oldmask);
+ }
+ else {
+ (void)Pause();
+ (void)Psigsetmask(oldmask);
+ }
}
- else
- (void)Psigpause(mask);
+
}
diff -u 46.orig/libsrc/pgrp.c 46/libsrc/pgrp.c
--- 46.orig/libsrc/pgrp.c Tue Mar 14 21:01:19 1995
+++ 46/libsrc/pgrp.c Wed Dec 6 13:23:18 1995
@@ -11,86 +11,104 @@
#include <fcntl.h>
#include "lib.h"
-extern int __mint;
+static short have_pgrp = 1;
pid_t
getpgrp()
{
- return __mint ? Pgetpgrp() : 0;
+ int r;
+
+ if (have_pgrp) {
+ r = Pgetpgrp();
+ if (r == -EINVAL)
+ have_pgrp = 0;
+ else
+ return (pid_t)r;
+ }
+ return 0;
}
int
-_bsd_setpgrp(pid, grp)
- int pid, grp;
+setpgrp()
{
- int r = 0;
-
- if (__mint) {
- r = Psetpgrp(pid, grp);
- if (r < 0) {
- errno = -r;
- r = -1;
- }
- }
- return r;
+ int r;
+
+ if (have_pgrp) {
+ r = Psetpgrp(0, 0);
+ if (r == -EINVAL)
+ have_pgrp = 0;
+ else
+ return r;
+ }
+ return 0;
}
int
-setpgrp()
+_bsd_setpgrp(pid, grp)
+ int pid, grp;
{
- return __mint ? Psetpgrp(0, 0) : 0;
+ int r = 0;
+
+ if (have_pgrp) {
+ r = Psetpgrp(pid, grp);
+ if (r == -EINVAL) {
+ if (grp != -1) have_pgrp = 0;
+ r = 0;
+ }
+ else if (r < 0) {
+ errno = -r;
+ r = -1;
+ }
+ }
+ return r;
}
int
_bsd_getpgrp(pid)
int pid;
{
- if (__mint >= 0x103) return _bsd_setpgrp(pid, -1);
- return 0;
+ return _bsd_setpgrp(pid, -1);
}
int
setpgid(pid, pgid)
pid_t pid, pgid;
{
- int r = 0;
-
- if (__mint) {
- r = Psetpgrp((int) pid, (int) pgid);
- if (r < 0) {
- errno = -r;
- r = -1;
- }
- }
- return r;
+ return (_bsd_setpgrp((int) pid, (int) pgid));
}
pid_t
setsid()
{
- long prc_pgrp;
- int tty_fd;
- int rc;
-
- if (!__mint) {
- errno = EINVAL;
- return (pid_t) -1;
- }
- prc_pgrp = Pgetpgrp();
- if (prc_pgrp != Pgetpid()) {
- if (isatty(-1)) {
- tty_fd = open("/dev/tty", O_RDWR | O_NOCTTY);
- if (tty_fd < __SMALLEST_VALID_HANDLE) {
- return (pid_t) -1;
- }
- if (ioctl(tty_fd, TIOCNOTTY, 0) < 0) return -1;
- (void) close(tty_fd);
- }
- }
- rc = (int) Psetpgrp(0, 0);
- if (rc < 0) {
- errno = -rc;
- rc = -1;
- }
- return (pid_t) rc;
+ long prc_pgrp;
+ int tty_fd;
+ int rc = -1;
+
+ if (have_pgrp) {
+ prc_pgrp = Pgetpgrp();
+ if (prc_pgrp == -EINVAL) {
+ have_pgrp = 0;
+ errno = EINVAL;
+ }
+ else {
+ if (prc_pgrp != Pgetpid()) {
+ if (isatty(-1)) {
+ tty_fd = open("/dev/tty", O_RDWR | O_NOCTTY);
+ if (tty_fd < __SMALLEST_VALID_HANDLE)
+ return (pid_t) -1;
+ if (ioctl(tty_fd, TIOCNOTTY, 0) < 0) return -1;
+ (void) close(tty_fd);
+ }
+ }
+ rc = (int) Psetpgrp(0, 0);
+ if (rc < 0) {
+ errno = -rc;
+ rc = -1;
+ }
+ }
+ }
+ else
+ errno = EINVAL;
+
+ return (pid_t) rc;
}
Common subdirectories: 46.orig/libsrc/purec and 46/libsrc/purec
Only in 46.orig/libsrc: readdir.c.orig
diff -u 46.orig/libsrc/rename.c 46/libsrc/rename.c
--- 46.orig/libsrc/rename.c Fri Dec 8 17:13:31 1995
+++ 46/libsrc/rename.c Wed Dec 6 14:00:48 1995
@@ -9,20 +9,20 @@
#include <mintbind.h>
#include "lib.h"
-extern int __mint;
-
int rename(_oldname, _newname)
const char *_oldname, *_newname;
{
char oldname[PATH_MAX], newname[PATH_MAX];
int rval, r;
+ long xattr;
struct stat oldstat;
struct stat newstat;
_unx2dos(_oldname, oldname, sizeof (oldname));
_unx2dos(_newname, newname, sizeof (newname));
-
- if (__mint
+
+ if (((xattr = Fxattr(1, newname, &newstat)) != -EINVAL)
+ && (xattr == 0)
&& (Fxattr(1, newname, &newstat) == 0)
&& (Fxattr(1, oldname, &oldstat) == 0)
&& (newstat.st_dev == oldstat.st_dev)
@@ -64,7 +64,7 @@
}
if (rval < 0) {
- if ((rval == -EPATH) && __mint >= 9 &&
+ if ((rval == -EPATH) && (xattr != -EINVAL) &&
(_enoent(Fxattr(1, oldname, &oldstat) ? oldname : newname)))
rval = -ENOENT;
errno = -rval;
Only in 46.orig/libsrc: rename.c.orig
diff -u 46.orig/libsrc/rmdir.c 46/libsrc/rmdir.c
--- 46.orig/libsrc/rmdir.c Fri Dec 8 17:13:31 1995
+++ 46/libsrc/rmdir.c Wed Dec 6 14:44:54 1995
@@ -7,8 +7,6 @@
#include <unistd.h>
#include "lib.h"
-extern int __mint;
-
int rmdir(_path)
const char *_path;
{
@@ -23,7 +21,7 @@
if ((r == -EPATH)) {
if (_enoent(path))
r = -ENOENT;
- } else if ((r == -EACCESS) && __mint >= 9 &&
+ } else if ((r == -EACCESS) &&
(((d = Dopendir(path, 0)) & 0xff000000L) != 0xff000000L)) {
char *name;
int rd;
Only in 46.orig/libsrc: rmdir.c.orig
diff -u 46.orig/libsrc/seekdir.c 46/libsrc/seekdir.c
--- 46.orig/libsrc/seekdir.c Tue Mar 1 22:55:00 1994
+++ 46/libsrc/seekdir.c Wed Dec 6 14:45:55 1995
@@ -11,8 +11,6 @@
#include <dirent.h>
#include "lib.h"
-extern int __mint;
-
/* not POSIX */
void
diff -u 46.orig/libsrc/setegid.c 46/libsrc/setegid.c
--- 46.orig/libsrc/setegid.c Tue Mar 14 21:04:08 1995
+++ 46/libsrc/setegid.c Wed Dec 6 15:19:41 1995
@@ -4,24 +4,24 @@
#include <mintbind.h>
#include <errno.h>
-extern int __mint;
-
int
setegid(x)
int x;
{
- long r;
+ long r;
+ static short have_setegid = 1;
- if (__mint) {
- if (__mint >= 0x10B) {
- r = Psetegid(x);
- if (r < 0) {
- errno = (int) -r;
- return -1;
- }
- } else {
- return (setgid (x));
- }
- }
- return 0;
+ if (have_setegid) {
+ r = Psetegid(x);
+ if (r == -EINVAL)
+ have_setegid = 0;
+ else if (r < 0) {
+ errno = (int) -r;
+ return -1;
+ }
+ else
+ return 0;
+
+ }
+ return setgid(x);
}
diff -u 46.orig/libsrc/seteuid.c 46/libsrc/seteuid.c
--- 46.orig/libsrc/seteuid.c Tue Mar 14 21:04:09 1995
+++ 46/libsrc/seteuid.c Wed Dec 6 15:26:30 1995
@@ -4,24 +4,24 @@
#include <mintbind.h>
#include <errno.h>
-extern int __mint;
-
int
seteuid(x)
int x;
{
- long r;
+ long r;
+ static short have_seteuid = 1;
- if (__mint) {
- if (__mint >= 0x10B) {
- r = Pseteuid(x);
- if (r < 0) {
- errno = (int) -r;
- return -1;
- }
- } else {
- return (setuid (x));
- }
- }
- return 0;
+ if (have_seteuid) {
+ r = Pseteuid(x);
+ if (r == -EINVAL)
+ have_seteuid = 0;
+ else if (r < 0) {
+ errno = (int) -r;
+ return -1;
+ }
+ else
+ return 0;
+
+ }
+ return setuid(x);
}
diff -u 46.orig/libsrc/setgid.c 46/libsrc/setgid.c
--- 46.orig/libsrc/setgid.c Tue Mar 1 22:54:50 1994
+++ 46/libsrc/setgid.c Wed Dec 6 15:16:56 1995
@@ -4,24 +4,28 @@
#include <mintbind.h>
#include <errno.h>
-extern int __mint;
extern gid_t __gid;
int
setgid(x)
int x;
{
- long r;
+ long r;
+ static short have_setgid = 1;
- if (__mint) {
- r = Psetgid(x);
- if (r < 0) {
- errno = (int) -r;
- return -1;
- }
- return 0;
- }
- __gid = x;
- return 0;
+ if (have_setgid) {
+ r = Psetgid(x);
+ if (r == -EINVAL) {
+ __gid = x;
+ have_setgid = 0;
+ }
+ else if (r < 0) {
+ errno = (int) -r;
+ return -1;
+ }
+ return 0;
+ }
+ __gid = x;
+ return 0;
}
Only in 46.orig/libsrc: setitimer.c.orig
diff -u 46.orig/libsrc/setregid.c 46/libsrc/setregid.c
--- 46.orig/libsrc/setregid.c Tue Mar 14 21:04:10 1995
+++ 46/libsrc/setregid.c Wed Dec 6 15:36:49 1995
@@ -4,25 +4,26 @@
#include <mintbind.h>
#include <errno.h>
-extern int __mint;
-
int
setregid(rgid,egid)
int rgid, egid;
+
{
- long r;
+ long r;
+ static short have_setregid = 1;
- if (__mint) {
- if (__mint >= 0x10B) {
- r = Psetregid(rgid, egid);
- if (r < 0) {
- errno = (int) -r;
- return -1;
- }
- } else {
- return (setgid (egid));
- }
- }
- return 0;
+ if (have_setregid) {
+ r = Psetregid(rgid, egid);
+ if (r == -EINVAL)
+ have_setregid = 0;
+ else if (r < 0) {
+ errno = (int) -r;
+ return -1;
+ }
+ else
+ return 0;
+
+ }
+ return setgid(egid);
}
diff -u 46.orig/libsrc/setreuid.c 46/libsrc/setreuid.c
--- 46.orig/libsrc/setreuid.c Tue Mar 14 21:04:11 1995
+++ 46/libsrc/setreuid.c Wed Dec 6 15:54:33 1995
@@ -4,25 +4,25 @@
#include <mintbind.h>
#include <errno.h>
-extern int __mint;
-
int
setreuid(ruid,euid)
int ruid, euid;
{
- long r;
+ long r;
+ static short have_setreuid = 1;
- if (__mint) {
- if (__mint >= 0x10B) {
- r = Psetreuid(ruid, euid);
- if (r < 0) {
- errno = (int) -r;
- return -1;
- }
- } else {
- return (setuid (euid));
- }
- }
- return 0;
+ if (have_setreuid) {
+ r = Psetreuid(ruid, euid);
+ if (r == -EINVAL)
+ have_setreuid = 0;
+ else if (r < 0) {
+ errno = (int) -r;
+ return -1;
+ }
+ else
+ return 0;
+
+ }
+ return setuid(euid);
}
diff -u 46.orig/libsrc/setrlimi.c 46/libsrc/setrlimi.c
--- 46.orig/libsrc/setrlimi.c Sun Sep 6 04:00:30 1992
+++ 46/libsrc/setrlimi.c Fri Dec 8 11:00:14 1995
@@ -7,8 +7,6 @@
#include <mintbind.h>
#include <errno.h>
-extern int __mint;
-
int
setrlimit(kind, rl)
int kind;
@@ -17,12 +15,7 @@
unsigned long limit;
long r;
int mode;
-
- if (!__mint) {
- errno = EINVAL;
- return -1;
- }
-
+
limit = rl->rlim_cur;
if (limit >= RLIM_INFINITY)
@@ -42,6 +35,7 @@
return -1;
}
r = Psetlimit(mode, limit);
+
if (r < 0) {
errno = (int) -r;
return -1;
@@ -57,11 +51,7 @@
long limit;
int mode;
- if (!__mint) {
- errno = EINVAL;
- return -1;
- }
-
+
switch(kind) {
case RLIMIT_CPU:
mode = 1;
@@ -77,10 +67,12 @@
return -1;
}
limit = Psetlimit(mode, -1L);
+
if (limit < 0) {
errno = (int ) -limit;
return -1;
}
+
if (limit == 0)
limit = RLIM_INFINITY;
diff -u 46.orig/libsrc/setuid.c 46/libsrc/setuid.c
--- 46.orig/libsrc/setuid.c Tue Mar 1 22:54:50 1994
+++ 46/libsrc/setuid.c Wed Dec 6 15:54:56 1995
@@ -4,23 +4,27 @@
#include <mintbind.h>
#include <errno.h>
-extern int __mint;
extern uid_t __uid;
int
setuid(x)
int x;
{
- long r;
+ long r;
+ static short have_setuid = 1;
- if (__mint) {
- r = Psetuid(x);
- if (r < 0) {
- errno = (int) -r;
- return -1;
- }
- return 0;
- }
- __uid = x;
- return 0;
+ if (have_setuid) {
+ r = Psetuid(x);
+ if (r == -EINVAL) {
+ __uid = x;
+ have_setuid = 0;
+ }
+ else if (r < 0) {
+ errno = (int) -r;
+ return -1;
+ }
+ return 0;
+ }
+ __uid = x;
+ return 0;
}
diff -u 46.orig/libsrc/sigactio.c 46/libsrc/sigactio.c
--- 46.orig/libsrc/sigactio.c Wed Sep 22 22:16:20 1993
+++ 46/libsrc/sigactio.c Fri Dec 8 16:46:44 1995
@@ -4,6 +4,7 @@
#include <osbind.h>
#include <mintbind.h>
#include <signal.h>
+#include <stddef.h>
/* vector of signal handlers (for TOS, or for MiNT with -mshort) */
extern __Sigfunc _sig_handler[__NSIG];
@@ -22,10 +23,15 @@
struct sigaction *oact;
{
long r;
- extern int __mint;
__Sigfunc oldfunc;
+ static short have_psigaction = 1;
- if (__mint >= 95) {
+ if (have_psigaction) {
+ if (Psigaction(-1,NULL,NULL) == -EINVAL)
+ have_psigaction = 0;
+ }
+
+ if (have_psigaction) {
struct ksigact {
__KerSigfunc sa_handler; /* pointer to signal handler */
long sa_mask; /* additional signals masked during delivery */
diff -u 46.orig/libsrc/sigblock.c 46/libsrc/sigblock.c
--- 46.orig/libsrc/sigblock.c Tue Mar 14 21:01:52 1995
+++ 46/libsrc/sigblock.c Wed Dec 6 16:03:14 1995
@@ -5,7 +5,6 @@
#include <mintbind.h>
#include <unistd.h>
-extern int __mint;
extern long _sigpending, _sigmask;
static void checksigs __PROTO((void));
@@ -37,9 +36,10 @@
long mask;
{
register long omask;
+ long r;
- if (__mint)
- return Psigsetmask(mask);
+ if ((r = Psigsetmask(mask)) != -EINVAL)
+ return r;
omask = _sigmask;
_sigmask = mask;
@@ -56,9 +56,10 @@
long mask;
{
register long omask;
+ long r;
- if (__mint)
- return Psigblock(mask);
+ if ((r = Psigblock(mask)) != -EINVAL)
+ return r;
omask = _sigmask;
_sigmask |= mask;
diff -u 46.orig/libsrc/signal.c 46/libsrc/signal.c
--- 46.orig/libsrc/signal.c Wed Sep 22 22:16:20 1993
+++ 46/libsrc/signal.c Tue Dec 5 18:33:33 1995
@@ -15,7 +15,6 @@
/* vector giving an indication of which signals are currently pending (for TOS) */
extern long _sigpending;
-
#ifdef __MSHORT__
/* trampoline code: for any caught signal, converts the 32 bit signal
* number MiNT passed us into a 16 bit one, and jumps to the handler
@@ -45,19 +44,9 @@
__Sigfunc func;
{
long old;
- extern int __mint;
__Sigfunc oldfunc;
-
- if (__mint == 0) {
- if (sig < 0 || sig >= NSIG) {
- errno = ERANGE;
- return SIG_ERR;
- }
- oldfunc = _sig_handler[sig];
- _sig_handler[sig] = func;
- return oldfunc;
- }
-
+ static short have_psignal = 1;
+
#ifdef __MSHORT__
/* NOTE: MiNT passes 32 bit numbers for signals, so we want our
* own signal dispatcher to switch these to 16 bit ints
@@ -68,18 +57,33 @@
}
oldfunc = _sig_handler[sig];
_sig_handler[sig] = func;
- if (func != SIG_DFL && func != SIG_IGN) {
+ if (func != SIG_DFL && func != SIG_IGN)
func = (__Sigfunc) _trampoline;
- }
#endif
- old = Psignal((short)sig, (long)func);
- if (old < 0) {
- errno = (int) -old;
+ if (have_psignal) {
+ old = Psignal((short)sig, (long)func);
+ if (old == -EINVAL)
+ have_psignal = 0;
+ else if (old < 0) {
+ errno = (int) -old;
+ return SIG_ERR;
+ }
+ else {
+ func = (__Sigfunc) old;
+#ifdef __MSHORT__
+ if (func == (__Sigfunc) _trampoline) func = oldfunc;
+#endif
+ return func;
+ }
+ }
+
+#ifndef __MSHORT__
+ if (sig < 0 || sig >= NSIG) {
+ errno = ERANGE;
return SIG_ERR;
}
- func = (__Sigfunc) old;
-#ifdef __MSHORT__
- if (func == (__Sigfunc) _trampoline) func = oldfunc;
+ oldfunc = _sig_handler[sig];
+ _sig_handler[sig] = func;
#endif
- return func;
+ return oldfunc;
}
Common subdirectories: 46.orig/libsrc/sozobon and 46/libsrc/sozobon
Only in 46.orig/libsrc: spawn.c.orig
Only in 46.orig/libsrc: statfs.c.orig
diff -u 46.orig/libsrc/strerror.c 46/libsrc/strerror.c
--- 46.orig/libsrc/strerror.c Fri Dec 8 17:06:03 1995
+++ 46/libsrc/strerror.c Mon Nov 6 11:19:26 1995
@@ -169,7 +169,12 @@
int errnum;
{
extern int sys_nerr;
- extern char *sys_errlist[];
+ /* extern char *sys_errlist[]; */
+#ifndef __MBASE__
+ extern char const *const sys_errlist[];
+#else
+ extern char const *sys_errlist[];
+#endif
if (errnum >= 0 && errnum < sys_nerr)
return(sys_errlist[errnum]);
Only in 46.orig/libsrc: strerror.c.orig
diff -u 46.orig/libsrc/symlink.c 46/libsrc/symlink.c
--- 46.orig/libsrc/symlink.c Fri Dec 8 17:13:32 1995
+++ 46/libsrc/symlink.c Fri Dec 8 11:56:33 1995
@@ -8,7 +8,6 @@
#include <stat.h>
#include "lib.h"
-extern int __mint;
/*
* If MiNT 0.9 or later is active, use the kernel routines for these;
@@ -24,25 +23,21 @@
char path[PATH_MAX];
long r;
- if (__mint >= 9) {
- _unx2dos(old, linkname, sizeof (linkname));
- _unx2dos(new, path, sizeof (path));
- r = Fsymlink(linkname, path);
- if (r) {
- struct stat sb;
-
- if ((r == -EPATH)) {
- if (_enoent(path))
- r = -ENOENT;
- } else if ((r == -EACCESS) && (!Fxattr(1, path, &sb)))
- r = -EEXIST;
- errno = (int) -r;
- return -1;
- }
- return (int) r;
+ _unx2dos(old, linkname, sizeof (linkname));
+ _unx2dos(new, path, sizeof (path));
+ r = Fsymlink(linkname, path);
+ if (r) {
+ struct stat sb;
+
+ if ((r == -EPATH)) {
+ if (_enoent(path))
+ r = -ENOENT;
+ } else if ((r == -EACCESS) && (!Fxattr(1, path, &sb)))
+ r = -EEXIST;
+ errno = (int) -r;
+ return -1;
}
- errno = EINVAL;
- return -1;
+ return (int) r;
}
int
@@ -55,10 +50,6 @@
char filename[PATH_MAX];
char linkto[PATH_MAX+1];
- if (__mint < 9) {
- errno = EINVAL;
- return -1;
- }
_unx2dos(unxname, filename, sizeof (filename));
r = Freadlink(PATH_MAX, linkto, filename);
if (r < 0) {
Only in 46.orig/libsrc: symlink.c.orig
diff -u 46.orig/libsrc/sysconf.c 46/libsrc/sysconf.c
--- 46.orig/libsrc/sysconf.c Fri Dec 8 17:13:32 1995
+++ 46/libsrc/sysconf.c Fri Dec 8 11:14:38 1995
@@ -16,16 +16,16 @@
#endif
#include "lib.h"
-extern int __mint;
-
#define UNLIMITED (0x7fffffffL)
long
sysconf(var)
int var;
{
- if(__mint)
- return Sysconf(var);
+ long r;
+
+ if ((r = Sysconf(var)) != -EINVAL)
+ return (r);
switch(var) {
case _SC_LAST:
@@ -53,13 +53,14 @@
long r;
char path[PATH_MAX];
- if(__mint) {
- _unx2dos (_path, path, sizeof (path));
- r = Dpathconf(path, var);
+ _unx2dos (_path, path, sizeof (path));
+
+ if ((r = Dpathconf(path, var)) != -EINVAL) {
if (var == _PC_NO_TRUNC)
return r ? -1 : 0;
return r;
}
+
switch(var) {
case _PC_LAST:
return 4;
Only in 46.orig/libsrc: sysconf.c.orig
Only in 46.orig/libsrc: system.c.orig
diff -u 46.orig/libsrc/tcdrain.c 46/libsrc/tcdrain.c
--- 46.orig/libsrc/tcdrain.c Tue Mar 1 22:55:02 1994
+++ 46/libsrc/tcdrain.c Fri Dec 8 11:59:46 1995
@@ -9,8 +9,6 @@
#include <mintbind.h>
#include <termios.h>
-extern int __mint;
-
int
tcdrain(fd)
int fd;
@@ -18,11 +16,6 @@
long outq;
long r;
- if (__mint < 0x10a)
- {
- errno = -EINVAL;
- return -1;
- }
do
{
r = Fcntl((short) fd, &outq, TIOCOUTQ);
diff -u 46.orig/libsrc/telldir.c 46/libsrc/telldir.c
--- 46.orig/libsrc/telldir.c Tue Mar 1 22:55:02 1994
+++ 46/libsrc/telldir.c Fri Dec 8 12:00:35 1995
@@ -11,8 +11,6 @@
#include <dirent.h>
#include "lib.h"
-extern int __mint;
-
/* not POSIX */
off_t
diff -u 46.orig/libsrc/thread.c 46/libsrc/thread.c
--- 46.orig/libsrc/thread.c Tue Mar 14 21:01:54 1995
+++ 46/libsrc/thread.c Fri Dec 8 15:52:35 1995
@@ -41,7 +41,6 @@
})
#endif /* __MBASE__ */
-extern int __mint;
extern long _childtime; /* in main.c */
extern long _sigpending, _sigmask; /* in signal.c */
extern __Sigfunc _sig_handler[NSIG]; /* ditto */
@@ -109,9 +108,7 @@
b->p_bbase = (char *) mbasep();
#endif /* __MBASE__ */
- if (__mint)
- pid = Pexec(104, 0L, b, 0L);
- else {
+ if ((pid = Pexec(104, 0L, b, 0L)) == -EINVAL) {
/* save the signal masks and signal handlers, the child may change
them */
savpending = _sigpending;
diff -u 46.orig/libsrc/times.c 46/libsrc/times.c
--- 46.orig/libsrc/times.c Fri Feb 26 15:22:50 1993
+++ 46/libsrc/times.c Fri Dec 8 12:02:45 1995
@@ -7,7 +7,6 @@
#include <mintbind.h>
#include <errno.h>
-extern int __mint;
extern long _childtime;
/* macro to convert milliseconds into CLK_TCKs */
@@ -21,8 +20,7 @@
real_time = _clock();
- if (__mint) {
- r = Prusage(usage);
+ if ((r = Prusage(usage)) != -EINVAL) {
if (r >= 0 && buffer) {
buffer->tms_cutime = CVRT(usage[3]);
buffer->tms_cstime = CVRT(usage[2]);
diff -u 46.orig/libsrc/truncate.c 46/libsrc/truncate.c
--- 46.orig/libsrc/truncate.c Fri Dec 8 17:13:33 1995
+++ 46/libsrc/truncate.c Fri Dec 8 14:58:45 1995
@@ -24,8 +24,6 @@
#endif
#include "lib.h"
-extern int __mint;
-
int
truncate (_filename, length)
const char *_filename;
@@ -36,23 +34,23 @@
(void) _unx2dos (_filename, filename, sizeof (filename));
res = -EINVAL;
- if (__mint > 92)
- {
- res = (int) Dcntl(FTRUNCATE, (long) filename, (long) &length);
- if (res == 0)
+
+ res = (int) Dcntl(FTRUNCATE, (long) filename, (long) &length);
+
+ if (res == 0)
return res;
- if (res != -EINVAL)
- {
- if (res < 0)
- {
- if ((res == -EPATH) && (_enoent(filename)))
- res = -ENOENT;
- errno = (int) -res;
- return -1;
- }
- return 0;
- }
- }
+ if (res != -EINVAL)
+ {
+ if (res < 0)
+ {
+ if ((res == -EPATH) && (_enoent(filename)))
+ res = -ENOENT;
+ errno = (int) -res;
+ return -1;
+ }
+ return 0;
+ }
+
fh = (int)Fopen (filename, 2);
if (fh < 0)
{
@@ -61,9 +59,10 @@
errno = -fh;
return -1;
}
- if (__mint > 90)
- res = (int) Fcntl (fh, (long) &length, FTRUNCATE);
+
+ res = (int) Fcntl (fh, (long) &length, FTRUNCATE);
Fclose (fh);
+
if (res == -EINVAL && length == 0)
{
res = (int)Fcreate (filename, 0);
@@ -85,12 +84,9 @@
{
int res;
- if (__mint > 90)
- res = (int) Fcntl (fd, (long) &length, FTRUNCATE);
- else
- res = -EINVAL;
+ res = (int) Fcntl (fd, (long) &length, FTRUNCATE);
- if (res < 0)
+ if (res < 0)
{
errno = -res;
return -1;
Only in 46.orig/libsrc: truncate.c.orig
Only in 46.orig/libsrc: ttyname.c.orig
Only in 46.orig/libsrc: unlink.c.orig
Only in 46.orig/libsrc: unx2dos.c.orig
diff -u 46.orig/libsrc/utime.c 46/libsrc/utime.c
--- 46.orig/libsrc/utime.c Fri Dec 8 17:13:34 1995
+++ 46/libsrc/utime.c Fri Dec 8 15:15:31 1995
@@ -27,8 +27,6 @@
#endif
#include "lib.h"
-extern int __mint;
-
time_t _dostime __PROTO((time_t t));
/* convert a Unix time into a DOS time. The longword returned contains
@@ -55,6 +53,7 @@
const struct utimbuf *tset;
{
int fh;
+ long ret;
unsigned long actime, modtime;
unsigned long dtime; /* dos time equivalent */
@@ -80,12 +79,12 @@
settime.modtime = (unsigned short) ((modtime >> 16) & 0xFFFF);
settime.moddate = (unsigned short) (modtime & 0xFFFF);
res = -EINVAL;
- if (__mint > 92) {
- if (tset)
- res = Dcntl(FUTIME, (long) filename, (long) &settime);
- else
- res = Dcntl(FUTIME, (long) filename, (long) 0);
- }
+
+ if (tset)
+ res = Dcntl(FUTIME, (long) filename, (long) &settime);
+ else
+ res = Dcntl(FUTIME, (long) filename, (long) 0);
+
if (res != -EINVAL) {
if (res < 0) {
if ((res == -EPATH) && (_enoent(filename)))
@@ -101,7 +100,7 @@
/* Kludge: on dos filesystems return success for dirs
even though we failed */
if ((fh == -ENOENT) &&
- (!__mint || Dpathconf(filename, 5) == 2) &&
+ (((ret = Dpathconf(filename, 5)) == 2) || (ret == -EINVAL)) &&
(Fattrib(filename, 0, 0) == FA_DIR))
return 0;
#endif
@@ -111,12 +110,11 @@
return -1;
}
- if (__mint > 90) {
- if (tset)
- res = Fcntl(fh, (long)&settime, FUTIME);
- else
- res = Fcntl(fh, (long)0, FUTIME);
- }
+ if (tset)
+ res = Fcntl(fh, (long)&settime, FUTIME);
+ else
+ res = Fcntl(fh, (long)0, FUTIME);
+
if (res == -EINVAL)
{
dtime = modtime;
Only in 46.orig/libsrc: utime.c.orig
diff -u 46.orig/libsrc/wait.c 46/libsrc/wait.c
--- 46.orig/libsrc/wait.c Wed Oct 27 08:09:40 1993
+++ 46/libsrc/wait.c Fri Dec 8 15:21:36 1995
@@ -17,24 +17,25 @@
{
long r;
int exit_status, sig_term, pid;
- extern int __mint;
+
#ifdef _EXPERIMENTAL_WAIT_MACROS
int *status = _status.__wi;
#else
int *status = _status;
#endif
- if (__mint == 0) { /* wait is faked by vfork() */
+ r = Pwaitpid(-1, 0, 0L);
+
+ if (r == -EINVAL) {
r = __waitval;
__waitval = -ENOENT;
}
- else
- r = Pwaitpid(-1, 0, 0L);
-
+
if (r < 0) {
errno = (int) -r;
return -1;
}
+
pid = (int) ((r & 0xffff0000L) >> 16);
exit_status = (int) (r & 0x000000ffL);
sig_term = (int) ((r & 0x00007f00L) >> 8);
diff -u 46.orig/libsrc/wait3.c 46/libsrc/wait3.c
--- 46.orig/libsrc/wait3.c Wed Oct 20 17:46:22 1993
+++ 46/libsrc/wait3.c Fri Dec 8 15:23:23 1995
@@ -10,8 +10,6 @@
#include <errno.h>
#include <signal.h>
-extern int __mint;
-
extern long __waitval; /* in thread.c */
extern long __waittime; /* ditto */
@@ -29,17 +27,20 @@
long r, rsc[8];
int exit_status, sig_term, pid;
- if (__mint == 0) {
+ r = Pwaitpid(-1, mode, rsc);
+
+ if (r == -EINVAL) {
r = __waitval;
__waitval = -ENOENT;
rsc[0] = __waittime;
rsc[1] = rsc[4] = 0;
- } else
- r = Pwaitpid(-1, mode, rsc);
+ }
+
if (r < 0) {
errno = (int) -r;
return -1;
}
+
pid = (int) ((r & 0xffff0000L) >> 16);
if (pid) {
if (status)
diff -u 46.orig/libsrc/wait4.c 46/libsrc/wait4.c
--- 46.orig/libsrc/wait4.c Tue Mar 14 21:01:54 1995
+++ 46/libsrc/wait4.c Fri Dec 8 15:26:00 1995
@@ -9,8 +9,6 @@
#include <errno.h>
#include <signal.h>
-extern int __mint;
-
extern long __waitval; /* in thread.c */
extern long __waittime; /* ditto */
@@ -29,15 +27,15 @@
long r, rsc[8];
int exit_status, sig_term;
- if (__mint == 0)
- {
+ r = Pwaitpid (pid, options, rsc);
+
+ if (r == -EINVAL) {
r = __waitval;
__waitval = -ENOENT;
rsc[0] = __waittime;
rsc[1] = rsc[4] = 0;
- }
- else
- r = Pwaitpid (pid, options, rsc);
+ }
+
if (r < 0)
{
errno = (int) -r;
diff -u 46.orig/libsrc/waitpid.c 46/libsrc/waitpid.c
--- 46.orig/libsrc/waitpid.c Wed Oct 27 08:09:40 1993
+++ 46/libsrc/waitpid.c Fri Dec 8 15:30:30 1995
@@ -9,8 +9,6 @@
#include <errno.h>
#include <signal.h>
-extern int __mint;
-
extern long __waitval; /* in thread.c */
pid_t
@@ -29,11 +27,14 @@
#endif
statwait = (union wait *) status;
- if (__mint == 0) {
+
+ r = Pwaitpid(pid, options, 0L);
+
+ if (r == -EINVAL) {
r = __waitval;
__waitval = -ENOENT;
- } else
- r = Pwaitpid(pid, options, 0L);
+ }
+
if (r < 0) {
errno = (int) -r;
return -1;
********************************* Patch for GEMLIB *************************************
--- aesappl.c.org Tue Jan 23 09:51:10 1996
+++ aesappl.c Tue Jan 23 09:52:35 1996
@@ -124,21 +124,22 @@
}
#endif /* L_appl_tre */
-
#ifdef L_appl_sea
int appl_search(int mode, char *fname, int *type, int *ap_id)
{
+ int retval;
+
_int_in[0] = mode;
_addrin[0] = fname;
- _addrin[1] = type;
- _addrin[2] = ap_id;
- return __aes__(AES_CONTROL_ENCODE(18, 1, 1, 3));
+ retval = __aes__(AES_CONTROL_ENCODE(18, 1, 3, 1));
+
+ *type = _int_out[1];
+ *ap_id = _int_out[2];
+ return retval;
}
#endif /* L_Appl_sea */
-
-
#ifdef L_appl_exi