[478] in Zephyr_Bugs

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

current Zephyr source comments

daemon@ATHENA.MIT.EDU (Stephen Gildea)
Wed May 26 11:49:09 1993

To: zephyr-bugs@Athena.MIT.EDU
In-Reply-To: Message from lucien@watson.ibm.com of 11 Mar 93 18:00:32 EST<9303112300.AA33462@fionavar.watson.ibm.com> 
Date: Wed, 26 May 1993 11:48:57 EDT
From: Stephen Gildea <gildea@expo.lcs.mit.edu>

Thank you for making the 8/31/92 Zephyr snapshot available.

I was impressed that Zephyr built with only minimal tweaking.  Knowing
this was only a snapshot, I had low expectations.  But I have it built
on Sparc running SunOS 4.1.3, DECstations running Ultrix 4.2 and
OSF/1, and HP-UX 8.07 now, and it works great.

Here are a few suggestions to make it even easier to build.  I've
included explanations and diffs to try to make it easy for you to to
find the time to integrate this code with your sources.


The rules command_table and make_error_table in config/Imake.rules
should separate running make_commands or compile_et from compiling the
resulting files.  I built zephyr on a platform to which make_commands
and et did not port easily.  So I want to be able to copy the .c and
.h files from another machine and not have the local machine insist on
recreating them.

server/zstring.c should not include mit-copyright.h.
Note that the include of server/mit-copyright.h 10 lines earlier succeeds.

lib/strcasecmp.c needs to include sys/types.h always, not just for
lint, to get u_char defined.

et/lib/internal.h declares perror incorrectly for Ultrix and OSF/1.

ss/lib/list_rqs.c should not declare wait struct if it won't use it.
This makes the code easily portable to machines without "union wait".

zhm/zhm.c assumes the system has the TIOCNOTTY ioctl.  Also assumes
the getdtablesize system call.  I changed it to use getrlimit instead
of getdtablesize, but probably calling the Posix function sysconf
would be better.

zwgc: HP-UX is like AUX in the name (regex) and locations (in libPW)
for its regular expression functions.  I changed a couple of ifdefs.

zwgc/X_driver.c makes two references into the Display structure, which
is illegal.  The Display is an opaque structure, and you are supposed
to use the provided functions to access its members.  In our current
Xlib sources (and hence in R6), you get a compile-time error if you
try to dereference a Display.

Finally, I'd like to know what will happen with this bug report.  Is
there anyone left with the time and inclination to evaluate and apply
these patches?  It took some time to prepare this message, and I'm not
likely to do it again unless I know I'm actually contributing.

 < Stephen
   MIT X Consortium


Those fixes again, with diffs:

The rules command_table and make_error_table in config/Imake.rules
should separate running make_commands or compile_et from compiling the
resulting files.  I built zephyr on a platform to which make_commands
and et did not port easily.  So I want to be able to copy the .c and
.h files from another machine and not have the local machine insist on
recreating them.

*** ./config/Imake.rules.dist	Mon Aug 10 09:26:11 1992
--- ./config/Imake.rules	Mon Mar 15 17:25:16 1993
***************
*** 435,441 ****
  #ifdef PROFILED_LIBS
  #define command_table(tbl)						@@\
! concat(tbl,.o): concat(tbl,.ct)						@@\
! 	$(RM) concat(tbl,.c) concat(tbl,.o)				@@\
  	$(MAKE_COMMANDS) concat(tbl,.ct)				@@\
  	$(CC) -c PROF_FLAG $(CFLAGS) concat(tbl,.c)			@@\
  	$(MV) concat(tbl,.o) concat3(profiled/,tbl,.o)			@@\
--- 435,443 ----
  #ifdef PROFILED_LIBS
  #define command_table(tbl)						@@\
! concat(tbl,.c): concat(tbl,.ct)						@@\
! 	$(RM) concat(tbl,.c)						@@\
  	$(MAKE_COMMANDS) concat(tbl,.ct)				@@\
+ concat(tbl,.o): concat(tbl,.c)						@@\
+ 	$(RM) concat(tbl,.o)						@@\
  	$(CC) -c PROF_FLAG $(CFLAGS) concat(tbl,.c)			@@\
  	$(MV) concat(tbl,.o) concat3(profiled/,tbl,.o)			@@\
***************
*** 443,449 ****
  
  #define make_error_table(tbl)						@@\
! concat(tbl,.h) concat(tbl,.o): concat(tbl,.et)				@@\
  	$(RM) concat(tbl,.c) concat(tbl,.h)				@@\
  	$(COMPILE_ET) concat(tbl,.et)					@@\
  	$(CC) -c PROF_FLAG $(CFLAGS) concat(tbl,.c)			@@\
  	$(MV) concat(tbl,.o) concat3(profiled/,tbl,.o)			@@\
--- 445,452 ----
  
  #define make_error_table(tbl)						@@\
! concat(tbl,.h) concat(tbl,.c): concat(tbl,.et)				@@\
  	$(RM) concat(tbl,.c) concat(tbl,.h)				@@\
  	$(COMPILE_ET) concat(tbl,.et)					@@\
+ concat(tbl,.o): concat(tbl,.h) concat(tbl,.c)				@@\
  	$(CC) -c PROF_FLAG $(CFLAGS) concat(tbl,.c)			@@\
  	$(MV) concat(tbl,.o) concat3(profiled/,tbl,.o)			@@\
***************
*** 451,486 ****
  	$(CC) -c $(CFLAGS) concat(tbl,.c)				@@\
  clean::									@@\
! 	$(RM) concat(tbl,.o) concat(tbl,.h)
  
  #else /* !PROFILED_LIBS */
  #define command_table(tbl)						@@\
! concat(tbl,.o): concat(tbl,.ct)						@@\
! 	$(RM) concat(tbl,.c) concat(tbl,.o)				@@\
  	$(MAKE_COMMANDS) concat(tbl,.ct)				@@\
  	$(CC) -c $(CFLAGS) concat(tbl,.c)
  
  #define make_error_table(tbl)						@@\
! concat(tbl,.h) concat(tbl,.o): concat(tbl,.et)				@@\
  	$(RM) concat(tbl,.c) concat(tbl,.h)				@@\
  	$(COMPILE_ET) concat(tbl,.et)					@@\
  	maybe_compile_ucode($(CC) -j $(CFLAGS) concat(tbl,.c))		@@\
  	$(CC) -c $(CFLAGS) concat(tbl,.c)				@@\
  clean::									@@\
! 	$(RM) concat(tbl,.o) concat(tbl,.h)
  #endif /* PROFILED_LIBS */
  
  #define command_table_noprof(tbl)					@@\
! concat(tbl,.o) concat(tbl,.c): concat(tbl,.ct)				@@\
! 	$(RM) concat(tbl,.c) concat(tbl,.o)				@@\
  	$(MAKE_COMMANDS) concat(tbl,.ct)				@@\
  	$(CC) -c $(CFLAGS) concat(tbl,.c)
  #define error_table_noprof(tbl)						@@\
! concat(tbl,.h) concat(tbl,.o): concat(tbl,.et)				@@\
  	$(RM) concat(tbl,.c) concat(tbl,.h)				@@\
  	$(COMPILE_ET) concat(tbl,.et)					@@\
  	maybe_compile_ucode($(CC) -j $(CFLAGS) concat(tbl,.c))		@@\
  	$(CC) -c $(CFLAGS) concat(tbl,.c)				@@\
  clean::									@@\
! 	$(RM) concat(tbl,.o) concat(tbl,.h)
  
  #define install_shell_scripts(which,targetdir)				@@\
--- 454,495 ----
  	$(CC) -c $(CFLAGS) concat(tbl,.c)				@@\
  clean::									@@\
! 	$(RM) concat(tbl,.o) concat(tbl,.h) concat(tbl,.c)
  
  #else /* !PROFILED_LIBS */
  #define command_table(tbl)						@@\
! concat(tbl,.c): concat(tbl,.ct)						@@\
! 	$(RM) concat(tbl,.c)						@@\
  	$(MAKE_COMMANDS) concat(tbl,.ct)				@@\
+ concat(tbl,.o): concat(tbl,.c)						@@\
+ 	$(RM) concat(tbl,.o)						@@\
  	$(CC) -c $(CFLAGS) concat(tbl,.c)
  
  #define make_error_table(tbl)						@@\
! concat(tbl,.h) concat(tbl,.c): concat(tbl,.et)				@@\
  	$(RM) concat(tbl,.c) concat(tbl,.h)				@@\
  	$(COMPILE_ET) concat(tbl,.et)					@@\
+ concat(tbl,.o): concat(tbl,.h) concat(tbl,.c)				@@\
  	maybe_compile_ucode($(CC) -j $(CFLAGS) concat(tbl,.c))		@@\
  	$(CC) -c $(CFLAGS) concat(tbl,.c)				@@\
  clean::									@@\
! 	$(RM) concat(tbl,.o) concat(tbl,.h) concat(tbl,.c)
  #endif /* PROFILED_LIBS */
  
  #define command_table_noprof(tbl)					@@\
! concat(tbl,.c): concat(tbl,.ct)						@@\
! 	$(RM) concat(tbl,.c)						@@\
  	$(MAKE_COMMANDS) concat(tbl,.ct)				@@\
+ concat(tbl,.o): concat(tbl,.c)						@@\
+ 	$(RM) concat(tbl,.o)						@@\
  	$(CC) -c $(CFLAGS) concat(tbl,.c)
  #define error_table_noprof(tbl)						@@\
! concat(tbl,.h) concat(tbl,.c): concat(tbl,.et)				@@\
  	$(RM) concat(tbl,.c) concat(tbl,.h)				@@\
  	$(COMPILE_ET) concat(tbl,.et)					@@\
+ concat(tbl,.o): concat(tbl,.h) concat(tbl,.c)				@@\
  	maybe_compile_ucode($(CC) -j $(CFLAGS) concat(tbl,.c))		@@\
  	$(CC) -c $(CFLAGS) concat(tbl,.c)				@@\
  clean::									@@\
! 	$(RM) concat(tbl,.o) concat(tbl,.h) concat(tbl,.c)
  
  #define install_shell_scripts(which,targetdir)				@@\


server/zstring.c should not include mit-copyright.h.
Note that the include of server/mit-copyright.h 10 lines earlier succeeds.

*** ./server/zstring.c.dist	Fri Aug 14 08:24:07 1992
--- ./server/zstring.c	Fri Mar 12 18:00:36 1993
***************
*** 21,26 ****
  #endif
  
- #include <mit-copyright.h>
- 
  #include <ctype.h>
  #if defined(__STDC__) && !defined(__HIGHC__) && !defined(SABER)
--- 21,24 ----


lib/strcasecmp.c needs to include sys/types.h always, not just for
lint, to get u_char defined.

*** ./lib/strcasecmp.c.dist	Fri Aug 14 08:25:08 1992
--- ./lib/strcasecmp.c	Fri Mar 12 18:10:09 1993
***************
*** 15,21 ****
  #endif /* LIBC_SCCS and not lint */
  
- #ifdef lint
  #include <sys/types.h>
- #endif
  
  #ifndef __STDC__
--- 15,19 ----



et/lib/internal.h declares perror incorrectly for Ultrix and OSF/1.

*** ./et/lib/internal.h.dist	Thu Oct 19 18:03:08 1989
--- ./et/lib/internal.h	Tue Mar 23 18:24:39 1993
***************
*** 12,16 ****
  extern const int sys_nerr;
  
! #ifdef __STDC__
  void perror (const char *);
  #else
--- 12,17 ----
  extern const int sys_nerr;
  
! /* DEC systems want the ANSI definition but don't claim to be ANSI */
! #if defined(__STDC__) || defined(ultrix) || defined(_AES_SOURCE)
  void perror (const char *);
  #else


ss/lib/list_rqs.c should not declare wait struct if it won't use it.
This makes the code easily portable to machines without "union wait".

*** ./ss/lib/list_rqs.c.dist	Tue May 30 23:09:08 1989
--- ./ss/lib/list_rqs.c	Wed Mar 24 12:29:10 1993
***************
*** 36,40 ****
--- 36,42 ----
      int mask;
      int (*func)();
+ #ifndef NO_FORK
      union wait waitb;
+ #endif
  
      DONT_USE(argc);


zhm/zhm.c assumes the system has the TIOCNOTTY ioctl.  Also assumes
the getdtablesize system call.  I changed it to use getrlimit instead
of getdtablesize, but probably calling the Posix function sysconf
would be better.

*** ./zhm/zhm.c.dist	Sun Dec  1 14:37:22 1991
--- ./zhm/zhm.c	Wed Mar 24 15:40:31 1993
***************
*** 396,403 ****
  }
  
  void detach()
  {
       /* detach from terminal and fork. */
!      register int i, x = ZGetFD(), size = getdtablesize();
    
       if (i = fork()) {
--- 396,411 ----
  }
  
+ #ifdef hpux
+ #include <sys/resource.h>
+ #endif
+ 
  void detach()
  {
       /* detach from terminal and fork. */
!      register int i, x = ZGetFD();
!      register int size;
! #ifdef hpux
!      struct rlimit file_limit;
! #endif
    
       if (i = fork()) {
***************
*** 407,410 ****
--- 415,425 ----
       }
  
+ #ifdef hpux
+      i = getrlimit(RLIMIT_NOFILE, &file_limit);
+      size = i == 0 ? file_limit.rlim_cur : 0;
+ #else
+      size = getdtablesize();
+ #endif
+ 
       for (i = 0; i < size; i++)
  	  if (i != x)
***************
*** 411,414 ****
--- 426,430 ----
  	       (void) close(i);
    
+ #ifdef TIOCNOTTY
       if ((i = open("/dev/tty", O_RDWR, 666)) < 0)
  	  ;		/* Can't open tty, but don't flame about it. */
***************
*** 417,420 ****
--- 433,437 ----
  	  (void) close(i);
       }
+ #endif
  }
  


zwgc: HP-UX is like AUX in the name (regex) and locations (in libPW)
for its regular expression functions.  I changed a couple of ifdefs.

*** ./zwgc/Imakefile.dist	Fri Aug  7 11:18:02 1992
--- ./zwgc/Imakefile	Wed Mar 24 15:04:07 1993
***************
*** 10,14 ****
  
  SUBDIRS= Memory String Dictionary
! #ifdef macII
  LIBS2= -lc -lPW
  #endif
--- 10,14 ----
  
  SUBDIRS= Memory String Dictionary
! #if defined(macII) || defined(PWB)
  LIBS2= -lc -lPW
  #endif
*** ./zwgc/regexp.c.dist	Thu Jun 20 09:20:49 1991
--- ./zwgc/regexp.c	Wed Mar 24 15:02:14 1993
***************
*** 44,52 ****
  
  /*
!  * This is for AUX.
   * It is a wrapper around the C library regexp functions.
   */
  
! #ifdef _AUX_SOURCE
  
  static char *re;
--- 44,52 ----
  
  /*
!  * This is for AUX and HP-UX.
   * It is a wrapper around the C library regexp functions.
   */
  
! #if defined(_AUX_SOURCE) || defined(PWB)
  
  static char *re;


zwgc/X_driver.c makes two references into the Display structure, which
is illegal.  The Display is an opaque structure, and you are supposed
to use the provided functions to access its members.  In our current
Xlib sources (and hence in R6), you get a compile-time error if you
try to dereference a Display.

*** ./zwgc/X_driver.c.dist	Thu May  7 18:38:01 1992
--- ./zwgc/X_driver.c	Wed May 26 10:07:48 1993
***************
*** 275,280 ****
       * Get resources from the just opened display:
       */
!     if (dpy->xdefaults != NULL)
! 	temp_db2 = XrmGetStringDatabase(dpy->xdefaults);
      else
  	temp_db2 = NULL;
--- 275,280 ----
       * Get resources from the just opened display:
       */
!     if (XResourceManagerString(dpy) != NULL)
! 	temp_db2 = XrmGetStringDatabase(XResourceManagerString(dpy));
      else
  	temp_db2 = NULL;
***************
*** 325,329 ****
      extern void finalize_zephyr();
  
!     ERROR2("X IO error on display '%s'--exiting\n", display->display_name);
      finalize_zephyr();
      exit(1);
--- 325,329 ----
      extern void finalize_zephyr();
  
!     ERROR2("X IO error on display '%s'--exiting\n", DisplayString(display));
      finalize_zephyr();
      exit(1);



/end/

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