[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mintlib patches, uucp, cu...



alright i'm testing mgetty and uucp-1.05 now...  compared to 1.03 for
old MiNTs the amout of hacks needed is down near zero now (if you don't
count the neverending story of the blocking fork), and looks like
performance is even better than it was, a receiving uucico shows up with
< 10% CPU on `top' most of the time at 38400/14400/~1700cps and i still
don't have a 030... :)  the i protocol is really nice, IMHO that alone
will be worth installing MiNT if you want to use your online time
effectively... (or which of those singletask TOS uucp clones can do i?)

 oh and i got cu's child working, hacked it to run as a thread. performance
is much like tip i.e. keeps up with 38400bps no problem, something that
even good ol' uniterm never did, not to mention anything `runn'ing in
GEM windows...

 ok enough about that.

1. fix cpp errors with e.g. `#if CLK_TCK != 0'

Index: usr/include/time.h
@@ -14,7 +14,7 @@
 extern "C" {
 #endif
 
-#define CLOCKS_PER_SEC  ((clock_t) 200)           /* clock ticks per second */
+#define CLOCKS_PER_SEC	(200UL)			  /* clock ticks per second */
 #define CLK_TCK         CLOCKS_PER_SEC            /* old name for this */
 
 #ifndef NULL

2. and warnings about _POSIX_VDISABLE redefined

Index: usr/include/unistd.h
@@ -41,7 +41,9 @@
 #define _POSIX_VERSION		0L		/* <- NON-CONFORMING */
 #endif
 #define _POSIX_CHOWN_RESTRICTED 0
+#ifndef _TERMIOS_H
 #define _POSIX_VDISABLE		0
+#endif
 
 #if 0					/* this depends on the file system */
 #define _POSIX_NO_TRUNC		-1

3. fix configure :)

Index: usr/include/termios.h
@@ -1,6 +1,10 @@
 #ifndef _TERMIOS_H
 #define _TERMIOS_H
 
+#ifndef _COMPILER_H
+#include <compiler.h>
+#endif
+
 #define VEOF	0
 #define VEOL	1
 #define VERASE	2

4. and VTIME in termios

Index: tcattr.c
@@ -13,7 +13,7 @@
 #include <types.h>
 #include <termios.h>
 
-#define VTIME_MS	(1000/HZ)
+#define VTIME_MS	100  /* count in .1 seconds */
 
 extern int __mint;
 
@@ -89,8 +89,13 @@
     stp->c_cc[VMIN]	= (cc_t) 1;
     stp->c_cc[VTIME]	= (cc_t) 0;
   } else {
-    stp->c_cc[VMIN]	= (cc_t) (vmin[0] >= 0xff) ? 0xff : vmin[0];
-    stp->c_cc[VTIME]	= (cc_t) (vmin[1] >= 0xff*VTIME_MS) ? 0xff : vmin[1]/VTIME_MS;
+    if (vmin[1]) {
+      stp->c_cc[VMIN]	= (cc_t) 0;
+      stp->c_cc[VTIME]	= (cc_t) (vmin[1] >= 0xff*VTIME_MS) ? 0xff : vmin[1]/VTIME_MS;
+    } else {
+      stp->c_cc[VMIN]	= (cc_t) (vmin[0] >= 0xff) ? 0xff : vmin[0];
+      stp->c_cc[VTIME]	= (cc_t) 0;
+    }
   }
   stp->c_cc[VLNEXT]	= (cc_t) lt.t_lnextc;
   stp->c_cc[VWERASE]	= (cc_t) lt.t_werasc;
@@ -151,8 +156,14 @@
   lt.t_suspc		= (char) stp->c_cc[VSUSP];
   t.t_startc		= (char) stp->c_cc[VSTART];
   t.t_stopc		= (char) stp->c_cc[VSTOP];
-  vmin[0]		= (unsigned char) stp->c_cc[VMIN] ? stp->c_cc[VMIN] : 1;
-  vmin[1]		= (unsigned short) stp->c_cc[VTIME] * VTIME_MS;
+  if (stp->c_cc[VMIN]) {
+  /* have to ignore VTIME when VMIN is set, some programs rely on it... */
+    vmin[0]		= (unsigned char) stp->c_cc[VMIN];
+    vmin[1]		= 0;
+  } else {
+    vmin[0]		= (unsigned char) 1;
+    vmin[1]		= (unsigned short) stp->c_cc[VTIME] * VTIME_MS;
+  }
   lt.t_lnextc		= (char) stp->c_cc[VLNEXT];
   lt.t_werasc		= (char) stp->c_cc[VWERASE];
   lt.t_dsuspc		= (char) stp->c_cc[VDSUSP];

5. and make link return EEXIST and adjust some more errno results.

Index: link.c
@@ -4,6 +4,7 @@
 #include <mintbind.h>
 #include <param.h>
 #include <unistd.h>
+#include <stat.h>
 #include "lib.h"
 
 extern int __mint;
@@ -28,6 +29,13 @@
 
 	r = Flink(old, new);
 	if (r < 0) {
+		struct stat sb;
+
+		if ((r == -EPATH)) {
+			if (_enoent(Fxattr(1, old, &sb) ? old : new))
+				r = -ENOENT;
+		} else if ((r == -EACCESS) && (!Fxattr(1, new, &sb)))
+			r = -EEXIST;
 		errno = (int) -r;
 		return -1;
 	}
Index: mkdir.c
@@ -32,7 +32,10 @@
 	}
 
 	if (errno != ENOENT) {		/* Return stat error, if other than */
-		return -1;		/* File not found. */
+					/* File not found. */
+		if ((errno == EPATH) && (_enoent(path)))
+			errno = ENOENT;
+		return -1;
 	}
 
 	rv = Dcreate(path);
Index: opendir.c
@@ -41,6 +41,8 @@
 	if (__mint > 8) {
 		r = Dopendir(name, 0);
 		if ( (r & 0xff000000L) == 0xff000000L ) {
+			if ((r == -EPATH) && (_enoent(name)))
+				r = -ENOENT;
 			errno = (int) -r;
 			free(d);
 			return 0;
Index: rename.c
@@ -36,13 +36,25 @@
 	rval = Frename(0, oldname, newname);
 	if (rval == 0)
 	  return 0;
-	if (rval != -EXDEV && rval != -ENOENT)
+	if (rval != -EXDEV && rval != -ENOENT && rval != -EPATH)
 	  {
+	    if (!strcmp(newname, oldname)) {
+		    errno = EEXIST;
+		    return -1;
+	    }
 	    (void) Fdelete (newname);
 	    rval = Frename(0, oldname, newname);
+	    if (rval == -EACCESS && !(rval = Flink (oldname, newname))) {
+		    int r;
+		    if ((r = Fdelete (oldname)) && r != -ENOENT && r != -EPATH)
+			    (void) Fdelete (newname);
+	    }
 	  }
 
 	if (rval < 0) {
+		if ((rval == -EPATH) && __mint >= 9 &&
+		    (_enoent(Fxattr(1, oldname, &oldstat) ? oldname : newname)))
+			rval = -ENOENT;
 		errno = -rval;
 		rval = -1;
 	}
Index: rmdir.c
@@ -2,11 +2,13 @@
 /* written by Eric R. Smith and placed in the public domain */
 
 #include <limits.h>
-#include <osbind.h>
+#include <mintbind.h>
 #include <errno.h>
 #include <unistd.h>
 #include "lib.h"
 
+extern int __mint;
+
 int rmdir(_path)
 	const char *_path;
 {
@@ -16,6 +18,24 @@
 	_unx2dos(_path, path);
 	r = Ddelete(path);
 	if (r < 0) {
+		long d;
+
+		if ((r == -EPATH)) {
+			if (_enoent(path))
+				r = -ENOENT;
+		} else if ((r == -EACCESS) && __mint >= 9 &&
+		    ((d = Dopendir(path, 0) & 0xff000000L) != 0xff000000L)) {
+			char *name;
+			int  rd;
+
+			do
+				rd = (int)Dreaddir((int)(PATH_MAX), d, path);
+			while (rd >= 0 && *(name=path+sizeof(long)) == '.' &&
+				(!*++name || (*name == '.' && !*++name)));
+			if (rd != -ENMFIL)
+				r = -ENOTEMPTY;
+			(void)Dclosedir (d);
+		}
 		errno = -r;
 		r = -1;
 	}
Index: symlink.c
@@ -29,9 +29,13 @@
 		_unx2dos(new, linkname);
 		r = Fsymlink(path, linkname);
 		if (r) {
-			if ((r == -EPATH) && _enoent(linkname)) {
-				r = -ENOENT;
-			}
+			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;
 		}
Index: truncate.c
@@ -41,6 +41,8 @@
       res = Dcntl(FTRUNCATE, (long) filename, (long) &length);
       if (res != -EINVAL)
         {
+	  if ((res == -EPATH) && (_enoent(filename)))
+		res = -ENOENT;
           errno = (int) -res;
           return -1;
 	}
@@ -48,6 +50,8 @@
   fh = (int)Fopen (filename, 2);
   if (fh < 0)
     {
+      if ((fh == -EPATH) && (_enoent(filename)))
+	fh = -ENOENT;
       errno = -fh;
       return -1;
     }
Index: utime.c
@@ -88,6 +88,8 @@
 	}
 	if (res != -EINVAL) {
 		if (res < 0) {
+			if ((res == -EPATH) && (_enoent(filename)))
+				res = -ENOENT;
 			errno = (int) -res;
 			return -1;
 		}
@@ -103,6 +105,8 @@
 		    (Fattrib(filename, 0, 0) == FA_DIR))
 			return 0;
 #endif
+		if ((fh == -EPATH) && (_enoent(filename)))
+			fh = -ENOENT;
 		errno = -fh;
 		return -1;
 	}
-- 
J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
								...ohne Gewehr
PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA