public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: thornber@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/unit-tests/regex matcher_t.c
Date: Mon, 09 Aug 2010 10:23:00 -0000	[thread overview]
Message-ID: <20100809102356.16047.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	thornber@sourceware.org	2010-08-09 10:23:55

Modified files:
	unit-tests/regex: matcher_t.c 

Log message:
	[REGEX] matcher_t unit test now takes a flag to turn on fingerprinting

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/unit-tests/regex/matcher_t.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3

--- LVM2/unit-tests/regex/matcher_t.c	2010/07/20 15:32:07	1.2
+++ LVM2/unit-tests/regex/matcher_t.c	2010/08/09 10:23:54	1.3
@@ -109,9 +109,18 @@
 	char **regex;
 	int nregex;
 	int ret = 0;
+	int want_finger_print = 0, i;
+	const char *pattern_file = NULL;
 
-	if (argc < 2) {
-		fprintf(stderr, "Usage : %s <pattern_file>\n", argv[0]);
+	for (i = 1; i < argc; i++)
+		if (!strcmp(argv[i], "--fingerprint"))
+			want_finger_print = 1;
+
+		else
+			pattern_file = argv[i];
+
+	if (!pattern_file) {
+		fprintf(stderr, "Usage : %s [--fingerprint] <pattern_file>\n", argv[0]);
 		exit(1);
 	}
 
@@ -123,7 +132,7 @@
 		goto err;
 	}
 
-	if (!_read_spec(argv[1], &regex, &nregex)) {
+	if (!_read_spec(pattern_file, &regex, &nregex)) {
 		fprintf(stderr, "Couldn't read the lex specification\n");
 		ret = 3;
 		goto err;
@@ -135,7 +144,8 @@
 		goto err;
 	}
 
-        printf("fingerprint: %x\n", dm_regex_fingerprint(scanner));
+	if (want_finger_print)
+		printf("fingerprint: %x\n", dm_regex_fingerprint(scanner));
 	_scan_input(scanner, regex);
 	_free_regex(regex, nregex);
 


                 reply	other threads:[~2010-08-09 10:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100809102356.16047.qmail@sourceware.org \
    --to=thornber@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).