This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libU77 patches for i386-mingw32


Looks like I never sent in the following patch for libU77. Needed for
mingw32 and possibly few other braindead runtimes. Diffs against
egcs-980129.

Thu Dec 18 18:40:17 1997  Mumit Khan <khan@xraylith.wisc.edu>
       
	* libU77/configure.in (getlogin,getgid,getuid, kill,link,ttyname): 
	Check.
	* libU77/config.h.in (HAVE_GETLOGIN, HAVE_GETGID, HAVE_GETUID,
	HAVE_KILL, HAVE_LINK, HAVE_TTYNAME): New defs.
	* libU77/getlog_.c: Conditionalize for target platform. Set errno
	to ENOSYS if target libc doesn't have the function.
	* libU77/getgid_.c: Likewise.
	* libU77/getuid_.c: Likewise.
	* libU77/kill_.c: Likewise.
	* libU77/link_.c: Likewise.
	* libU77/ttynam_.c: Likewise.

Index: egcs/gcc/f/runtime/libU77/configure.in
diff -u egcs/gcc/f/runtime/libU77/configure.in:1.1.1.2 egcs/gcc/f/runtime/libU77/configure.in:1.3
--- egcs/gcc/f/runtime/libU77/configure.in:1.1.1.2	Sat Jan 31 02:11:09 1998
+++ egcs/gcc/f/runtime/libU77/configure.in	Sun Dec 28 21:32:38 1997
@@ -98,7 +98,7 @@
 dnl Checks for library functions.
 
 AC_CHECK_FUNCS(symlink getcwd getwd lstat gethostname strerror clock \
-  getrusage times alarm)
+  getrusage times alarm getlogin getgid getuid kill link ttyname)
 test $ac_cv_func_symlink = yes && MAYBES="$MAYBES symlnk_.o"
 test $ac_cv_func_lstat = yes && MAYBES="$MAYBES lstat_.o"
 test $ac_cv_func_gethostname = yes && MAYBES="$MAYBES hostnm_.o"
Index: egcs/gcc/f/runtime/libU77/config.h.in
diff -u egcs/gcc/f/runtime/libU77/config.h.in:1.1.1.2 egcs/gcc/f/runtime/libU77/config.h.in:1.3
--- egcs/gcc/f/runtime/libU77/config.h.in:1.1.1.2	Sat Jan 31 02:11:08 1998
+++ egcs/gcc/f/runtime/libU77/config.h.in	Sun Dec 28 21:32:38 1997
@@ -84,3 +84,20 @@
 /* Define if you have the times function.  */
 #undef HAVE_TIMES
 
+/* Define if you have the getlogin function.  */
+#undef HAVE_GETLOGIN
+
+/* Define if you have the getgid function.  */
+#undef HAVE_GETGID
+
+/* Define if you have the getuid function.  */
+#undef HAVE_GETUID
+
+/* Define if you have the kill function.  */
+#undef HAVE_KILL
+
+/* Define if you have the link function.  */
+#undef HAVE_LINK
+
+/* Define if you have the ttyname function.  */
+#undef HAVE_TTYNAME
Index: egcs/gcc/f/runtime/libU77/getgid_.c
diff -u egcs/gcc/f/runtime/libU77/getgid_.c:1.1.1.1 egcs/gcc/f/runtime/libU77/getgid_.c:1.2
--- egcs/gcc/f/runtime/libU77/getgid_.c:1.1.1.1	Sat Dec 20 12:11:11 1997
+++ egcs/gcc/f/runtime/libU77/getgid_.c	Sun Dec 28 21:32:38 1997
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #endif
 #include <sys/types.h>
+#include <errno.h>		/* for ENOSYS */
 #include "f2c.h"
 
 #ifdef KR_headers
@@ -31,5 +32,10 @@
 integer G77_getgid_0 (void)
 #endif
 {
+#if defined (HAVE_GETGID)
   return getgid ();
+#else
+  errno = ENOSYS;
+  return -1;
+#endif
 }
Index: egcs/gcc/f/runtime/libU77/getlog_.c
diff -u egcs/gcc/f/runtime/libU77/getlog_.c:1.1.1.1 egcs/gcc/f/runtime/libU77/getlog_.c:1.2
--- egcs/gcc/f/runtime/libU77/getlog_.c:1.1.1.1	Sat Dec 20 12:11:11 1997
+++ egcs/gcc/f/runtime/libU77/getlog_.c	Sun Dec 28 21:32:38 1997
@@ -34,6 +34,7 @@
 #else
 #  include <strings.h>
 #endif
+#include <errno.h>		/* for ENOSYS */
 #include "f2c.h"
 
 /* getlogin not in svr1-3 */
@@ -51,7 +52,9 @@
 {
   size_t i;
   char *p;
+  int status;
 
+#if defined (HAVE_GETLOGIN)
   p = getlogin ();
   if (p != NULL) {
     i = strlen (p);
@@ -59,5 +62,10 @@
   } else {
     s_copy (str, " ", Lstr, 1);
   }
-  return 0;
+  status = 0;
+#else
+  errno = ENOSYS;
+  status = -1;
+#endif
+  return status;
 }
Index: egcs/gcc/f/runtime/libU77/getuid_.c
diff -u egcs/gcc/f/runtime/libU77/getuid_.c:1.1.1.1 egcs/gcc/f/runtime/libU77/getuid_.c:1.2
--- egcs/gcc/f/runtime/libU77/getuid_.c:1.1.1.1	Sat Dec 20 12:11:11 1997
+++ egcs/gcc/f/runtime/libU77/getuid_.c	Sun Dec 28 21:32:38 1997
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #endif
 #include <sys/types.h>
+#include <errno.h>		/* for ENOSYS */
 #include "f2c.h"
 
 #ifdef KR_headers
@@ -31,5 +32,10 @@
 integer G77_getuid_0 (void)
 #endif
 {
+#if defined (HAVE_GETUID)
   return getuid ();
+#else
+  errno = ENOSYS;
+  return -1;
+#endif
 }
Index: egcs/gcc/f/runtime/libU77/kill_.c
diff -u egcs/gcc/f/runtime/libU77/kill_.c:1.1.1.1 egcs/gcc/f/runtime/libU77/kill_.c:1.2
--- egcs/gcc/f/runtime/libU77/kill_.c:1.1.1.1	Sat Dec 20 12:11:11 1997
+++ egcs/gcc/f/runtime/libU77/kill_.c	Sun Dec 28 21:32:38 1997
@@ -33,5 +33,10 @@
 integer G77_kill_0 (const integer *pid, const integer *signum)
 #endif
 {
+#if defined (HAVE_KILL)
   return kill ((pid_t) *pid, *signum) ? errno : 0;
+#else
+  errno = ENOSYS;
+  return -1;
+#endif
 }
Index: egcs/gcc/f/runtime/libU77/link_.c
diff -u egcs/gcc/f/runtime/libU77/link_.c:1.1.1.2 egcs/gcc/f/runtime/libU77/link_.c:1.3
--- egcs/gcc/f/runtime/libU77/link_.c:1.1.1.2	Sat Jan 31 02:11:11 1998
+++ egcs/gcc/f/runtime/libU77/link_.c	Sun Dec 28 21:32:38 1997
@@ -31,6 +31,7 @@
 #if HAVE_SYS_PARAM_H
 #  include <sys/param.h>
 #endif
+#include <errno.h>		/* for ENOSYS */
 #include "f2c.h"
 
 #ifdef KR_headers
@@ -44,6 +45,7 @@
 integer G77_link_0 (const char *path1, const char *path2, const ftnlen Lpath1, const ftnlen Lpath2)
 #endif
 {
+#if defined (HAVE_LINK)
   char *buff1, *buff2;
   char *bp, *blast;
   int i;
@@ -57,4 +59,8 @@
   i = link (buff1, buff2);
   free (buff1); free (buff2);
   return i ? errno : 0;
+#else /* ! HAVE_LINK */
+  errno = ENOSYS;
+  return -1;
+#endif
 }
Index: egcs/gcc/f/runtime/libU77/ttynam_.c
diff -u egcs/gcc/f/runtime/libU77/ttynam_.c:1.1.1.1 egcs/gcc/f/runtime/libU77/ttynam_.c:1.2
--- egcs/gcc/f/runtime/libU77/ttynam_.c:1.1.1.1	Sat Dec 20 12:11:12 1997
+++ egcs/gcc/f/runtime/libU77/ttynam_.c	Sun Dec 28 21:32:38 1997
@@ -32,6 +32,7 @@
 #else
 #  include <strings.h>
 #endif
+#include <errno.h>		/* for ENOSYS */
 #include "f2c.h"
 
 #ifdef KR_headers
@@ -45,6 +46,7 @@
 /* Character */ void G77_ttynam_0 (char *ret_val, ftnlen ret_val_len, integer *lunit)
 #endif
 {
+#if defined (HAVE_TTYNAME)
   size_t i;
   char *p;
 
@@ -55,4 +57,8 @@
   } else {
     s_copy (ret_val, " ", ret_val_len, 1);
   }
+#else
+  errno = ENOSYS;
+  return -1;
+#endif
 }

Regards,
Mumit -- khan@xraylith.wisc.edu
http://www.xraylith.wisc.edu/~khan/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]