www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/22/23:24:51

Xref: news2.mv.net comp.os.msdos.djgpp:1338
Newsgroups: comp.os.msdos.djgpp
From: jcm8 AT beech DOT lle DOT rochester DOT edu (Judy Mathers)
Subject: regex problems
Message-ID: <1996Feb21.031542.16059@galileo.cc.rochester.edu>
Sender: news AT galileo DOT cc DOT rochester DOT edu
Nntp-Posting-Host: beech.lle.rochester.edu
Organization: University of Rochester - Rochester, New York
Date: Wed, 21 Feb 96 03:15:42 GMT
Lines: 81
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm posting this for a friend whose news server seems to hate him right now.

---

A week ago I posted this problem.  I haven't seen any responses.  I
checked the archives at http://www.delorie.com/djgpp/ in case I missed
the response, but nothing has turned up.  I know switching to djgpp 2.0
is recommended, but I was hoping to just get past this problem now and
upgrade later.  If I dont' get a response this time, I guess I'll upgrade
and hope it goes away.  I just fear that other problems will turn up.

thanks.


---------- Forwarded message ----------
Date: 10 Feb 96 20:11:19 GMT
From: moss AT cheetah DOT cvs DOT rochester DOT edu
Newgroups: comp.os.msdos.djgpp
Subject: regex problems

I've been fighting with this for some time now.  I hope someone can help.
basically, I can't get regex library calls to work.  I currently have
djgpp112m4 installed.  For what it's worth, this is on a Windows 95
machine.

The following simplified code works with gcc under Solaris 2.5 but not
under djgpp.  It compiles and runs, but never finds any matches.
Everything I've found in the mail archive regarding regex says that
libgpl.a is needed.  I've found that I also need libgpp.a.  

#include <stdio.h>
#include <regex.h>
#include <string.h>

int main(int argc, char *argv[]) {
	char *rresult, line[120];
	FILE *fp;

	if(argc < 2)
		exit(1);

	if(rresult = re_comp(argv[1])) {
		fprintf(stderr, "error compiling %s as regular expression\n", regexstr);
		exit(1);
	}

	if(argc >= 3) {
		if((fp = fopen(argv[2], "r")) == NULL) {
			fprintf(stderr, "Error opening %s\n", argv[2]);
			exit(1);
		}
	} else {
		fp = stdin;
	}

	while(fgets(line, 120, fp)) {
		if(re_exec(line))
			fprintf(stderr, "match: %s\n", line);
	}
}



--

It doesn't get much simpler than that.  any suggestions are appreciated.

thanks.

Larry Moss
moss AT pobox DOT com










- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019