www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/11/09:09:29

Xref: news2.mv.net comp.os.msdos.djgpp:961
Newsgroups: comp.os.msdos.djgpp
From: moss AT cvs DOT rochester DOT edu (Larry Moss)
Subject: regex problems
Message-ID: <moss.823983079@cvs.rochester.edu>
Sender: news AT galileo DOT cc DOT rochester DOT edu
Nntp-Posting-Host: swift.cvs.rochester.edu
Organization: University of Rochester Computing Center
Date: 10 Feb 96 20:11:19 GMT
Lines: 55
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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

--
Larry Moss, Programmer, Dept. of Ophthalmology, University of Rochester
moss AT cvs DOT rochester DOT edu, http://www.cvs.rochester.edu/people/l_moss/l_moss.html

- Raw text -


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