From: jrs@world.std.com (Rick Sladkey)
Subject: working patch for olvwm-3.2 (was: xview and olwm)
Organization: The Internet
	<1992Nov20.100208.19569@news.Hawaii.Edu>
Date: Sat, 21 Nov 1992 05:42:32 GMT

>>>>> On Fri, 20 Nov 1992 10:02:08 GMT, lee@Hawaii.Edu (Greg Lee) said:

Greg> If someone gets the DIRMENU and WINMENU functions working for olvwm
Greg> v. 3.2, I hope they let us know how.  I've tried, but so far no go.

OK.  Here is a patch that makes everything work.  To use it you must
have something like:

$ export IMAKECPP=/usr/bin/imakecpp
$ cat /usr/bin/imakecpp
#! /bin/sh
exec /lib/cpp -imake "$@"

Also, you must have Kenneth Osterberg's xview3 installed in order to
get the olgx header files and library.
-----
diff -rc orig/olvwm-3.2/Imakefile olvwm-3.2/Imakefile
*** orig/olvwm-3.2/Imakefile	Fri Nov 20 23:33:22 1992
--- olvwm-3.2/Imakefile	Sat Nov 21 00:36:17 1992
***************
*** 16,30 ****
  
  /**/# No more changes needed
  
! #include <XView.tmpl>
  
  /**/#########################################################################
  /**/# @(#)Imakefile	1.5 10/4/91 SMI
  /**/# Imakefile for olwm release 3.0.
  
! DEFINES =  -DOW_I18N_L3 -DSUNDAE -DSHAPE
! INCLUDES = -I$(HEADER_DEST) -I$(TOP)
! SYS_LIBRARIES = -ll
  DEPLIBS = 
  LOCAL_LIBRARIES = $(OLGXLIB) $(XLIB)
  
--- 16,31 ----
  
  /**/# No more changes needed
  
! /* #include <XView.tmpl> */
! OLGXLIB = -L/usr/openwin/lib -lolgx
  
  /**/#########################################################################
  /**/# @(#)Imakefile	1.5 10/4/91 SMI
  /**/# Imakefile for olwm release 3.0.
  
! DEFINES = -DMAXPID=65535 -DMAXNAMLEN=NAME_MAX -DSYSV -DSHAPE
! INCLUDES = -I$(HEADER_DEST) -I$(TOP) -I/usr/openwin/include
! SYS_LIBRARIES =
  DEPLIBS = 
  LOCAL_LIBRARIES = $(OLGXLIB) $(XLIB)
  
***************
*** 59,71 ****
  OBJS = 	\
  	  Debug.o Error.o Notice.o Select.o WinInfo.o atom.o \
            client.o cmdstream.o cursors.o defaults.o environ.o evbind.o \
!           events.o gettext.o group.o helpsend.o images.o kbdfuncs.o \ 
            list.o mem.o menu.o moveresize.o ol_button.o olwm.o olvwmrc.o \
! 	  properties.o resources.o screen.o services.o slave.o slots.o \ 
            st.o states.o usermenu.o usleep.o virtual.o win.o \
! 	  winbusy.o winbutton.o wincolor.o winframe.o wingframe.o \ 
!           winicon.o winipane.o winmenu.o winnofoc.o \ 
!           winpane.o winpinmenu.o winpush.o winresize.o \ 
            winroot.o ${VERSION}
  
  
--- 60,72 ----
  OBJS = 	\
  	  Debug.o Error.o Notice.o Select.o WinInfo.o atom.o \
            client.o cmdstream.o cursors.o defaults.o environ.o evbind.o \
!           events.o gettext.o group.o helpsend.o images.o kbdfuncs.o \
            list.o mem.o menu.o moveresize.o ol_button.o olwm.o olvwmrc.o \
! 	  properties.o resources.o screen.o services.o slave.o slots.o \
            st.o states.o usermenu.o usleep.o virtual.o win.o \
! 	  winbusy.o winbutton.o wincolor.o winframe.o wingframe.o \
!           winicon.o winipane.o winmenu.o winnofoc.o \
!           winpane.o winpinmenu.o winpush.o winresize.o \
            winroot.o ${VERSION}
  
  
***************
*** 80,101 ****
  #endif
  
  parse.c: parse.l
! 	lex -t parse.l > parse.c
  
  olvwmrc.c: olvwmrc.y
! 	yacc olvwmrc.y
  	mv y.tab.c olvwmrc.c
  
  olvwmrc.o: parse.c olvwmrc.c
  
! version.c:: ${SRCS} ${HEADERS}
  	@/bin/sh -c 'echo -n "#ident \"@(#)olvwm version compiled "' > version.c
  	@/bin/sh -c 'echo `date` \"' >> version.c
  
! clean::
  	/bin/rm -f parse.c olvwmrc.c version.c
  
! install.man:: $(MANPAGES)
  	@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
  	else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
  	@for i in $(MANPAGES) ;\
--- 81,105 ----
  #endif
  
  parse.c: parse.l
! 	flex -t parse.l > parse.c
  
  olvwmrc.c: olvwmrc.y
! 	bison -y olvwmrc.y
  	mv y.tab.c olvwmrc.c
  
  olvwmrc.o: parse.c olvwmrc.c
  
! version.c: ${SRCS} ${HEADERS}
  	@/bin/sh -c 'echo -n "#ident \"@(#)olvwm version compiled "' > version.c
  	@/bin/sh -c 'echo `date` \"' >> version.c
  
! usleep.o: usleep.c
! 	$(CC) -c usleep.c -o usleep.o
! 	
! clean:
  	/bin/rm -f parse.c olvwmrc.c version.c
  
! install.man: $(MANPAGES)
  	@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
  	else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
  	@for i in $(MANPAGES) ;\
***************
*** 104,107 ****
  	$(INSTALL) -c $(INSTMANFLAGS) $$i $(DESTDIR)$(MANDIR)/`basename $$i .man`.$(MANSUFFIX) ; \
  	done
  
! #include <XView.prog>
--- 108,111 ----
  	$(INSTALL) -c $(INSTMANFLAGS) $$i $(DESTDIR)$(MANDIR)/`basename $$i .man`.$(MANSUFFIX) ; \
  	done
  
! /* #include <XView.prog> */
Only in olvwm-3.2: make.out
diff -rc orig/olvwm-3.2/mem.c olvwm-3.2/mem.c
*** orig/olvwm-3.2/mem.c	Fri Jan  3 18:50:58 1992
--- olvwm-3.2/mem.c	Thu Oct  8 21:47:55 1992
***************
*** 16,21 ****
--- 16,25 ----
  #include <stdio.h>
  #include <sys/types.h>
  
+ #ifdef __STDC__
+ #include <stdlib.h>
+ #endif
+ 
  #include "i18n.h"
  
  #ifdef MEMDEBUG
diff -rc orig/olvwm-3.2/parse.l olvwm-3.2/parse.l
*** orig/olvwm-3.2/parse.l	Fri Nov 20 23:33:27 1992
--- olvwm-3.2/parse.l	Thu Oct  8 21:49:08 1992
***************
*** 47,52 ****
--- 47,56 ----
  \}	{ return CLOSEBRACE; }
  
  \"[^"]*\"	{
+ #ifdef FLEX_SCANNER
+ #undef yymore()
+ #define yymore() (yy_more_flag = 1)
+ #endif
  	    if (yytext[yyleng - 1] == '\\')
  		yymore();
  	    else {
Only in orig/olvwm-3.2: patch1.out
Only in orig/olvwm-3.2: patch2.out
diff -rc orig/olvwm-3.2/slave.c olvwm-3.2/slave.c
*** orig/olvwm-3.2/slave.c	Fri Nov 20 23:32:27 1992
--- olvwm-3.2/slave.c	Thu Oct  8 21:47:57 1992
***************
*** 79,88 ****
--- 79,92 ----
  	case 0:				/* Slave */
  		dup2(input[0],0);
  		dup2(output[1],1);
+ #ifdef RLIMIT_NOFILE
  		if (getrlimit(RLIMIT_NOFILE,&rlimit) == -1)
+ #endif
  			maxfd = 0;
+ #ifdef RLIMIT_NOFILE
  		else
  			maxfd = rlimit.rlim_cur;	
+ #endif
  		for (fd=3; fd<maxfd ; fd++) {
  			(void)close(fd);
  		}
diff -rc orig/olvwm-3.2/virtual.c olvwm-3.2/virtual.c
*** orig/olvwm-3.2/virtual.c	Fri Nov 20 23:33:30 1992
--- olvwm-3.2/virtual.c	Thu Oct  8 22:36:41 1992
***************
*** 1895,1900 ****
--- 1895,1954 ----
  				MenuInfoCreate(cache, winInfo, menu, depth);
  }
  
+ #ifdef _GNU_SOURCE
+ #include <regex.h>
+ 
+ static struct re_pattern_buffer expbuf;
+ 
+ static
+ rexMatch(string)
+     char *string;
+ {
+     return (re_match(&expbuf, string, strlen(string), 0, 0) != -1);
+ }
+ 
+ static
+ rexInit(pattern)
+     char *pattern;
+ {
+ int i, j, n;
+ char newPattern[256],tmp[256];
+ char *s;
+ 
+     n = strlen(pattern);
+     newPattern[0] = '^';
+     for(i = 0, j = 1; i < n; i++) {
+ 	switch(pattern[i]) {
+ 	    case '?':
+ 		newPattern[j++] = '.';
+ 		break;
+ 	    case '*':
+ 		newPattern[j++] = '.';
+ 		newPattern[j++] = '*';
+ 		break;
+ 	    case '.':
+ 		newPattern[j++] = '\\';
+ 		newPattern[j++] = '.';
+ 		break;
+ 	    default:
+ 		newPattern[j++] = pattern[i];
+ 	}
+     }
+     newPattern[j++] = '$';
+     if (expbuf.allocated == 0) {
+ 	expbuf.buffer = MemAlloc(256);
+ 	expbuf.allocated = 256;
+     }
+     expbuf.translate = 0;
+     s = re_compile_pattern(newPattern, strlen(newPattern), &expbuf);
+     if (s) {
+ 	sprintf(tmp, "DIRMENU: %s", s);
+ 	ErrorWarning(s);
+     }
+ }
+ 
+ #else
+ 
  #define INIT   register char *sp = instring;
  #define GETC() (*sp++)
  #define PEEKC()     (*sp)
***************
*** 1992,1994 ****
--- 2046,2050 ----
      newPattern[j++] = '$';
      compile(newPattern, expbuf, &expbuf[256], '\0');
  }
+ 
+ #endif
--
Rick Sladkey
jrs@world.std.com