[4005] in SIPB bug reports

home help back first fref pref prev next nref lref last post

xscreensaver Posix patch

daemon@ATHENA.MIT.EDU (svalente@athena.mit.edu)
Wed Aug 4 01:26:04 1993

From: svalente@athena.mit.edu
Date: Wed, 4 Aug 93 01:25:33 EDT
To: bug-sipb@athena.mit.edu
Cc: jik@athena.mit.edu


Here is a patch to get Xscreensaver to compile on Linux and Solaris
(and, most likely, other non-BSD machines.)

It's very simple stuff, it basically just maps BSD functions to Posix
functions.  Enjoy.

/*                 Sal Valente   <svalente@athena.mit.edu>               */
/*  All opinions stated here are shared by my school, my employer, my    */
/*  friends, my family, a large group of people I've never met, the      */
/*  entire cast of "Taxi," President Clinton, the Pope, Elvis, and you.  */

diff -cr /mit/sipb/src/src/xscreensaver/Imakefile xscreensaver/Imakefile
*** /mit/sipb/src/src/xscreensaver/Imakefile	Wed Jul 14 20:36:12 1993
--- xscreensaver/Imakefile	Wed Aug  4 00:14:58 1993
***************
*** 32,37 ****
--- 32,41 ----
  MACH_DEP_OBJS		=	converter.o hft.o
  #endif
  
+ #if defined(LinuxArchitecture)
+ EXTRA_LIBRARIES=-lshadow
+ #endif
+ 
  APPCLASS	=	XScreensaver
  BITMAPDIR       =       /mit/sipb/bitmaps.x11
  DEFINES		=	-DAPPCLASS=\"$(APPCLASS)\" \
diff -cr /mit/sipb/src/src/xscreensaver/password.c xscreensaver/password.c
*** /mit/sipb/src/src/xscreensaver/password.c	Thu Jul 15 11:10:11 1993
--- xscreensaver/password.c	Tue Aug  3 22:05:47 1993
***************
*** 29,37 ****
  #include <netinet/in.h>
  #include <fcntl.h>
  #include <errno.h>
- #if defined(sun) && defined(__svr4__)
- #include <sys/file.h>
- #endif
  #if defined(mips) || defined(sparc) || defined (_IBMR2)
  extern int sys_nerr;
  extern char *sys_errlist[];
--- 29,34 ----
***************
*** 41,46 ****
--- 38,46 ----
  extern char *sys_errlist[];
  #endif
  #endif
+ #if defined (linux)
+ #define SHADOW_PWD 1
+ #endif
  #if defined(sun) && defined(__svr4__)
  #include <shadow.h>
  #else
***************
*** 53,59 ****
  Widget PasswordWindow();
  
  extern char *time_string(), *timeleft_string(), *timeout_string(),
!      *user_string(), *get_user(), *malloc(), *crypt(), *my_malloc();
  extern long random();
  extern void RemoveRoot();
  
--- 53,62 ----
  Widget PasswordWindow();
  
  extern char *time_string(), *timeleft_string(), *timeout_string(),
!      *user_string(), *get_user(), *malloc(), *my_malloc();
! #ifndef crypt
! extern char *crypt ();
! #endif
  extern long random();
  extern void RemoveRoot();
  
diff -cr /mit/sipb/src/src/xscreensaver/savescreen.c xscreensaver/savescreen.c
*** /mit/sipb/src/src/xscreensaver/savescreen.c	Thu Jul 15 11:10:13 1993
--- xscreensaver/savescreen.c	Mon Aug  2 23:56:15 1993
***************
*** 710,720 ****
  	       lock_command_pid = 0;
  	  }
  	  else if (! lock_command_pid) {
- #if defined(sun) && defined(__svr4__)
- 	       setsid();
- #else
  	       setpgrp(getpid(), getpid());
- #endif
  	       XtCloseDisplay(dpy);
  #ifdef PASSWORD_PORT
  	       close_password_port();
--- 710,716 ----
***************
*** 734,744 ****
  	  return;
       did_lock_command = 0;
       if (lock_command_pid) {
- #if (defined(sun) && defined(__svr4__)) || defined(NO_KILLPG)
- 	  kill(-lock_command_pid, SIGTERM);
- #else
  	  killpg(lock_command_pid, SIGTERM);
- #endif
  	  lock_command_pid = 0;
       }
       if (lock_flag && defs.unlock_command) {
--- 730,736 ----
diff -cr /mit/sipb/src/src/xscreensaver/xsaver.h xscreensaver/xsaver.h
*** /mit/sipb/src/src/xscreensaver/xsaver.h	Tue Apr 28 16:29:03 1992
--- xscreensaver/xsaver.h	Mon Aug  2 23:57:03 1993
***************
*** 170,172 ****
--- 170,212 ----
  #else
  #define SIGTYPE void
  #endif
+ 
+ #ifndef BSD
+ #ifndef bzero
+ #define bzero(a, b) memset(a, 0, b)
+ #endif
+ #ifndef bcopy
+ #define bcopy(a, b, c) mempcy(b, a, c)
+ #endif
+ #ifndef bcmp
+ #define bcmp memcmp
+ #endif
+ #ifndef index
+ #define index strchr
+ #endif
+ #ifndef rindex
+ #define rindex strrchr
+ #endif
+ #ifndef srandom
+ #define srandom srand
+ #endif
+ #ifndef random
+ #define random rand
+ #endif
+ #ifndef setpgrp
+ #define setpgrp(foo, bar) setsid()
+ #endif
+ #ifndef killpg
+ #define killpg(foo, bar) kill(-(foo), bar)
+ #endif
+ #endif /* BSD */
+ 
+ #ifndef FNDELAY
+ #ifdef O_NONBLOCK
+ #define FNDELAY O_NONBLOCK
+ #else
+ #ifdef O_NDELAY
+ #define FNDELAY O_NDELAY
+ #endif
+ #endif
+ #endif

home help back first fref pref prev next nref lref last post