[comp.sources.d] HELP with vn

eric@magic4.UUCP (Eric Kozowski) (02/19/88)

Could someone please help me with this problem.  Here is the output
from a make on vn:


	cc -O -DSYSV -Dregfree=free -Dindex=strchr -Drindex=strrchr -c std.c
	cc -o vn hash.o envir_set.o pagefile.o reader.o storage.o sig_set.o term_set.o tty_set.o userlist.o vn.o vnglob.o digest.o strings.o session.o printex.o getch.o help.o newdisp.o stat.o svart.o tmpnam.o std.o -ltermcap
undefined			first referenced
 symbol  			    in file
regcmp                              reader.o
regex                               reader.o
ld fatal: Symbol referencing errors. No output written to vn
*** Error code 13

Stop.

I'm running Sys V 3.1 on an AT&T 3B2/400.  Please help.

-- 
Eric Kozowski  AT&T GBS  Portland, Or        || I've made enough money to buy
(503)295-4250                                || Miami, but I pissed it away 
UUCP: ...!tektronix!teksce!bucket!magic4!eric|| so fast ...
All of the above opinions are mine           || -- Jimmy Buffet            

asgard@cpro.UUCP (J.R. Stoner) (02/21/88)

in article <163@magic4.UUCP>, eric@magic4.UUCP (Eric Kozowski) says:
> Could someone please help me with this problem.  Here is the output
> from a make on vn:
[...]
> undefined			first referenced
>  symbol  			    in file
> regcmp                              reader.o
> regex                               reader.o
[...]
> I'm running Sys V 3.1 on an AT&T 3B2/400.  Please help.

That is a result of Mr. McQueer having used only the Berkeley regex code,
even on his SYS5 system.  I had to make a major hackup to make the SYS5
regex work on the prior release of vn, and when I get the time I will do it
Yet Again for this one.  I had tried to send my changes to bobm but every
mailer address falls into a black hole or bounces, so this was not unexpected.

> Eric Kozowski  AT&T GBS  Portland, OR
-- 
"To prevent having to tell fools to RTFM don't let on you WTFM to begin with."
J.R. Stoner	asgard@cpro.UUCP    asgard@wotan.UUCP
P.S. I help CompuPro make computers.  They do not help me make my opinions.

clive@drutx.ATT.COM (Clive Steward) (02/21/88)

From article <163@magic4.UUCP>, by eric@magic4.UUCP (Eric Kozowski):
> Could someone please help me with this problem.  Here is the output
> from a make on vn:
> ...
> undefined			first referenced
>  symbol  			    in file
> regcmp                              reader.o
> regex                               reader.o
> ld fatal: Symbol referencing errors. No output written to vn
> *** Error code 13
> 
> Stop.
> 
> I'm running Sys V 3.1 on an AT&T 3B2/400.  Please help.

Here is how to fix such things.

Take your Unix Manuals.  Look up regcmp in the permuted index.  You'll find 
man pages listed in section 3, which is in the Programmer Reference Manual.

There you will see that 'this routine is kept in /lib/libPW.a'.

If you are familiar with ld, or read the man pages (Section 1, User
Reference Manual), you will know that such a library is automatically
included by putting the shorter -lPW on the cc command line.

So, let's edit the Makefile.  Comment out the LIBS definition, and
replace it as follows:

#LIBS = -ltermcap
LIBS = -lcurses -lPW

We'll do one thing more; curses is a later replacement for termcap,
and usually a bit better, so we substitute that library as well.  If
you turn out to have screen problems for some reason, you can alternatively
use:

LIBS = -lcurses -lPW

Once you've edited the Makefile, re-make vn.

This should work.  Hope you have good fortune with it.

jeb@gamma.UUCP (John Berry) (02/22/88)

 
My problem with vn is that after some runs it he/she cannot start backgroung
runs. The problem is with tostop. Normally the stty setting for tostop
is -tostop. Vn sets it to tostop and never sets it back to -tostop.
Since I am not a big C programer here is what I did to get around the 
problem.

We are running ULTRIX on a VAX 8650.

Here is the shell called vn:


/usr/local/bin/VN $@
stty -tostop

Is there a fix to the vn program which will correct this problem?

Thanks in advance.

  ___                      __
 (   >      /             /  )
  __/______/_  ____      /--<  _  __  __  __  ,
 / /  (_) / /_/ / <_    /___/_</_/ (_/ (_/ (_/_
<_/                                         /
                                           '

asgard@cpro.UUCP (J.R. Stoner) (02/23/88)

From article <6800@drutx.ATT.COM>, by clive@drutx.ATT.COM (Clive Steward):
> From article <163@magic4.UUCP>, by eric@magic4.UUCP (Eric Kozowski):
>> Could someone please help me with this problem.  Here is the output
>> from a make on vn:
>> undefined			first referenced
>>  symbol  			    in file
>> regcmp                              reader.o
>> regex                               reader.o
>> I'm running Sys V 3.1 on an AT&T 3B2/400.  Please help.

> Here is how to fix such things.
> Take your Unix Manuals.  Look up regcmp in the permuted index.  You'll find 
> man pages listed in section 3, which is in the Programmer Reference Manual.
> There you will see that 'this routine is kept in /lib/libPW.a'.
> If you are familiar with ld, or read the man pages (Section 1, User
> Reference Manual), you will know that such a library is automatically
> included by putting the shorter -lPW on the cc command line.

> So, let's edit the Makefile.  Comment out the LIBS definition, and
> replace it as follows:

> #LIBS = -ltermcap
> LIBS = -lcurses -lPW

> We'll do one thing more; curses is a later replacement for termcap,
> and usually a bit better, so we substitute that library as well.

Not only that, but vanilla SYS5 curses has the termcap functions in libcurses.

> If you turn out to have screen problems for some reason, you can alternatively
> use:

> LIBS = -lcurses -lPW

> Once you've edited the Makefile, re-make vn.
> This should work.  Hope you have good fortune with it.

This will get you past linking the program but the first attempt to match a
regular expression might just cause a segmentation violation.

This is the patch to reg.c which makes vanilla regex work with vn:
[Note - you must also REMOVE the -Dfree=regfree from your CFLAGS line in
your Makefile].

*** oreg.c	Fri Feb  5 21:30:56 1988
--- reg.c	Mon Feb 22 14:36:01 1988
***************
*** 45,50
  	}
  }
  
  char *regcmp(str)
  char *str;
  {

--- 45,65 -----
  	}
  }
  
+ #ifdef SYSV
+ 
+ char			*re_expbuf;
+ char			*re_ss;
+ extern	char		*malloc();
+ #define	INIT		char *sp = instring;
+ #define	GETC()		(*sp++)
+ #define	PEEKC()		(*sp)
+ #define	UNGETC(c)	(--sp)
+ #define	RETURN(c)	re_ss = c; return((char *)0)
+ #define	ERROR(c)	return((char *)c)
+ #include		<regexp.h>
+ 
+ #endif
+ 
  char *regcmp(str)
  char *str;
  {
***************
*** 50,56
  {
  	int i;
  	char *str_store();
- 	char *re_comp();
  
  	if (re_comp(str) != NULL)
  	{

--- 65,70 -----
  {
  	int i;
  	char *str_store();
  
  #ifdef SYSV
  
***************
*** 52,57
  	char *str_store();
  	char *re_comp();
  
  	if (re_comp(str) != NULL)
  	{
  		Compiled = NULL;	/* make sure we're OK */

--- 66,85 -----
  	int i;
  	char *str_store();
  
+ #ifdef SYSV
+ 
+ 	char	*compile();
+ 	if(re_expbuf == (char *)NULL)
+ 	{
+ 		re_expbuf = (char *)malloc(512);
+ 		if(re_expbuf == (char *)NULL)
+ 			printex("regcmp: memory allocation failure");
+ 	}
+ 	if(compile(str,re_expbuf,re_expbuf + 512,'\0') != (char *)0)
+ 
+ #else
+ 
+ 	char *re_comp();
  	if (re_comp(str) != NULL)
  
  #endif
***************
*** 53,58
  	char *re_comp();
  
  	if (re_comp(str) != NULL)
  	{
  		Compiled = NULL;	/* make sure we're OK */
  		return(NULL);

--- 81,89 -----
  
  	char *re_comp();
  	if (re_comp(str) != NULL)
+ 
+ #endif
+ 
  	{
  		Compiled = NULL;	/* make sure we're OK */
  		return(NULL);
***************
*** 87,92
  
  	if (cmp == Compiled)
  	{
  		if (re_exec(str))
  			return(str);
  		return (NULL);

--- 118,130 -----
  
  	if (cmp == Compiled)
  	{
+ 
+ #ifdef SYSV
+ 
+ 		if(step(str,re_expbuf) != 0)
+ 
+ #else
+ 
  		if (re_exec(str))
  
  #endif
***************
*** 88,93
  	if (cmp == Compiled)
  	{
  		if (re_exec(str))
  			return(str);
  		return (NULL);
  	}

--- 126,134 -----
  #else
  
  		if (re_exec(str))
+ 
+ #endif
+ 
  			return(str);
  		return (NULL);
  	}
***************
*** 101,107
  	if (Compiled == NULL)
  		printex ("regex: bad pointer");
  
! 	re_comp(Compiled->regstr);
  
  	if (re_exec(str))
  		return(str);

--- 142,148 -----
  	if (Compiled == NULL)
  		printex ("regex: bad pointer");
  
! #ifdef SYSV
  
  	(void)compile(str,re_expbuf,re_expbuf + 512,'\0');
  	if(step(str,re_expbuf) != 0)
***************
*** 103,108
  
  	re_comp(Compiled->regstr);
  
  	if (re_exec(str))
  		return(str);
  

--- 144,155 -----
  
  #ifdef SYSV
  
+ 	(void)compile(str,re_expbuf,re_expbuf + 512,'\0');
+ 	if(step(str,re_expbuf) != 0)
+ 
+ #else
+ 
+ 	re_comp(Compiled->regstr);
  	if (re_exec(str))
  
  #endif
***************
*** 104,109
  	re_comp(Compiled->regstr);
  
  	if (re_exec(str))
  		return(str);
  
  	return(NULL);

--- 151,159 -----
  
  	re_comp(Compiled->regstr);
  	if (re_exec(str))
+ 
+ #endif
+ 
  		return(str);
  
  	return(NULL);

[I hope this works out for you.  It makes vn work in a Microport 286 kernel.]
-- 
"To prevent having to tell fools to RTFM don't let on you WTFM to begin with."
J.R. Stoner	asgard@cpro.UUCP    asgard@wotan.UUCP
P.S. I help CompuPro make computers.  They do not help me make my opinions.

blair@obdient.UUCP (Doug Blair) (02/23/88)

In article <163@magic4.UUCP>, eric@magic4.UUCP (Eric Kozowski) writes:
> Could someone please help me with this problem.  Here is the output
> from a make on vn:
> 
> 	cc -O -DSYSV -Dregfree=free -Dindex=strchr -Drindex=strrchr -c std.c
> 	cc -o vn hash.o envir_set.o pagefile.o reader.o storage.o sig_set.o term_set.o tty_set.o userlist.o vn.o vnglob.o digest.o strings.o session.o printex.o getch.o help.o newdisp.o stat.o svart.o tmpnam.o std.o -ltermcap
> undefined			first referenced
>  symbol  			    in file
> regcmp                              reader.o
> regex                               reader.o
> ld fatal: Symbol referencing errors. No output written to vn
> *** Error code 13
> 
> Stop.
> 

Eric is running sysV. I ran into the same problem last night! It took me
a while to dig out the fact that regcmp and regex are functions you can
only access through the libPW.a file, which is usually in /lib. About
halfway down the Makefile there are three lines used when compiling
under sysV.  The line that defines the LIBS variable should be:

	LIBS = -ltermcap -lPW

If you're using V/AT you'll need to modify the PW filename to
include the small or large model size as appropriate. I don't have
V/AT so I'm not sure exactly how that's done. It is discussed
briefly under regcmp(3x).

Doug Blair

-- 
===============================================================================
| Doug Blair                                  ... ihnp4!laidbak!obdient!blair |
|               "I'm not a Consultant, but I play one on TV."                 |
| Obedient Software Corporation,  1007 Naperville Road,   Wheaton, IL   60187 |
===============================================================================

crash@tsc3b21.UUCP (Frank "crash" Edwards) (02/23/88)

From article <163@magic4.UUCP>, by eric@magic4.UUCP (Eric Kozowski):
> Could someone please help me with this problem.  Here is the output
> from a make on vn:
>    [ ... ]
> undefined			first referenced
>  symbol  			    in file
> regcmp                              reader.o
> regex                               reader.o
> ld fatal: Symbol referencing errors. No output written to vn
> *** Error code 13
> 
> -- 
> Eric Kozowski  AT&T GBS  Portland, Or        || I've made enough money to buy

Easily.  Just add '-lPW' to the library macro list in the Makefile.
'regcmp()' and 'regex()' are in the Programmer's Workbench on the 3B2.


"Use the Source, Luke.  Feel it flow through your fingertips..."
-----
Frank (crash) Edwards		...!codas!usfvax2!{pdn,jc3b21}!tsc3b21!crash
TSC in Palm Harbor, FL		Phone:  (813) 785-0583  (voice)
The Sweat Shop
/-------------------------------------------------------------------------\
|  These opinions are not those of my employer, his wife, either of their |
|  children, or their parakeet.  In fact, he probably doesn't even know   |
|  that I've said this!  And I prefer it that way!			  |
\-------------------------------------------------------------------------/

phn@dde.uucp (Per H. Nielsen) (02/24/88)

In article <163@magic4.UUCP>, eric@magic4.UUCP (Eric Kozowski) writes:
 > Could someone please help me with this problem.  Here is the output
 > from a make on vn:
 >
 >     (output saying regcmp and regx cannot be found)

On our system V version regcmp and regex are found in library PW.
Try setting the LIBS line in the makefile to contain (at least):
LIBS = -ltermcap -lPW
-- 
+---------------------------------------------------------------------------+
|   Per H. Nielsen @ Dansk Data Elektronik A/S,                             |
|   E-mail:  ..!uunet!mcvax!diku!dde!phn  or  phn@dde.uucp                  |
+---------------------------------------------------------------------------+