[SR-Dev] git:master: Two small fixes in regular expressions.

Jan Janak jan at iptel.org
Wed Feb 18 01:10:02 CET 2009


Module: sip-router
Branch: master
Commit: 859fa59c08645100735b9653bd8dccd6a01d8c03
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=859fa59c08645100735b9653bd8dccd6a01d8c03

Author: Jan Janak <jan at iptel.org>
Committer: Jan Janak <jan at iptel.org>
Date:   Wed Feb 18 01:09:22 2009 +0100

Two small fixes in regular expressions.

The fixes include:
 * db_con.h added to the regex matching header file names.
 * Fixed regexp matching db_con_t and db_res_t structures (previously
   did not match the two strings at the beginning of a line).

---

 scripts/kam_to_sr.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/kam_to_sr.sh b/scripts/kam_to_sr.sh
index 330ee07..50e47f3 100755
--- a/scripts/kam_to_sr.sh
+++ b/scripts/kam_to_sr.sh
@@ -34,7 +34,7 @@ if ! egrep "Makefile\.modules" Makefile >/dev/null ; then
 	exit 1
 fi
 
-if ! egrep '^#[ \t]*include[ \t]*".*\/db\/db(_(cap|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"' *.[ch] >/dev/null ; then
+if ! egrep '^#[ \t]*include[ \t]*".*\/db\/db(_(cap|con|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"' *.[ch] >/dev/null ; then
 	echo "The module does not seem to include old database headers..."
 	exit 0
 fi
@@ -80,18 +80,18 @@ for file in *.[ch] ; do
 	cp $file $file.backup
 	cat $file.backup | gawk '
 
-/^#[ \t]*include[ \t]*".*\/db\/db(_(cap|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"/ {
+/^#[ \t]*include[ \t]*".*\/db\/db(_(cap|con|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"/ {
     sub("/db/", "/lib/srdb1/", $0);
 }
 
-/[^a-zA-Z0-9_](db_(con|res)_t|struct[ \t]+db_(con|res))[^a-zA-Z0-9_]/ {
+/(^|[^a-zA-Z0-9_])(db_(con|res)_t|struct[ \t]+db_(con|res))([^a-zA-Z0-9_]|$)/ {
     gsub("struct[ \t]+db_con", "struct db1_con", $0);
     gsub("struct[ \t]+db_res", "struct db1_res", $0);
     gsub("db_con_t", "db1_con_t", $0);
     gsub("db_res_t", "db1_res_t", $0);
 }
 
-/[^a-zA-Z0-9_]DB_((BIG)?INT|DOUBLE|STR(ING)?|DATETIME|BLOB|BITMAP)[^a-zA-Z0-9_]/ {
+/(^|[^a-zA-Z0-9_])DB_((BIG)?INT|DOUBLE|STR(ING)?|DATETIME|BLOB|BITMAP)([^a-zA-Z0-9_]|$)/ {
     gsub("DB_INT", "DB1_INT", $0);
     gsub("DB_BIGINT", "DB1_BIGINT", $0);
     gsub("DB_DOUBLE", "DB1_DOUBLE", $0);




More information about the sr-dev mailing list