[cvslog] [CVS] Module eggdrop1.6: Change committed

cvs at eggheads.org cvs at eggheads.org
Sun Mar 14 12:35:09 CST 2010


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2010-03-14 18:35:09 UTC
Committer  : Rumen Stoyanov <pseudo at egg6.net>

Modified files:
     doc/Changes1.6 doc/tcl-commands.doc doc/html/tcl-commands.html
     src/patch.h src/tclmisc.c

Log message:

Added new Tcl command 'matchstr' as a simplified alternative to Tcl's string match.

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/Changes1.6
diff -u eggdrop1.6/doc/Changes1.6:1.74 eggdrop1.6/doc/Changes1.6:1.75
--- eggdrop1.6/doc/Changes1.6:1.74	Sun Mar 14 12:30:17 2010
+++ eggdrop1.6/doc/Changes1.6	Sun Mar 14 12:34:59 2010
@@ -1,4 +1,4 @@
-$Id: Changes1.6,v 1.74 2010/03/14 18:30:17 pseudo Exp $
+$Id: Changes1.6,v 1.75 2010/03/14 18:34:59 pseudo Exp $
 
 Eggdrop Changes (since version 1.6.0)
 
@@ -6,6 +6,10 @@
 
 1.6.20 (CVS):
 
+  - Added new Tcl command 'matchstr' as a simplified alternative to Tcl's
+    string match.
+    Found by: thommey / Patch by: pseudo
+
   - Modified the uptime module to send packets at a random interval, with
     per-second resolution, to reduce the peak traffic and load on the uptime
     server.
Index: eggdrop1.6/doc/html/tcl-commands.html
diff -u eggdrop1.6/doc/html/tcl-commands.html:1.67 eggdrop1.6/doc/html/tcl-commands.html:1.68
--- eggdrop1.6/doc/html/tcl-commands.html:1.67	Mon Mar  8 14:52:56 2010
+++ eggdrop1.6/doc/html/tcl-commands.html	Sun Mar 14 12:34:59 2010
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- $Id: tcl-commands.html,v 1.67 2010/03/08 20:52:56 pseudo Exp $ -->
+<!-- $Id: tcl-commands.html,v 1.68 2010/03/14 18:34:59 pseudo Exp $ -->
 
 <html>
   <head>
@@ -3673,6 +3673,22 @@
           
           <p><strong>Module:</strong> core</p>
         </dd>
+
+
+        <dt><strong><a name="cmd_matchstr"></a>matchstr &lt;pattern&gt;
+        &lt;string&gt;</strong></dt>*
+
+        <dd>
+          <p><strong>Description:</strong> checks if pattern matches string.
+          Only two wildcards are supported: '*' and '?'. Matching is
+          case-insensitive. This command is intended as a simplified
+          alternative to Tcl's string match.</p>
+
+          <p><strong>Returns:</strong> 1 if the pattern matches the string,
+          0 if it doesn't.</p>
+          
+          <p><strong>Module:</strong> core</p>
+        </dd>
       </dl>
     </blockquote>
 
Index: eggdrop1.6/doc/tcl-commands.doc
diff -u eggdrop1.6/doc/tcl-commands.doc:1.133 eggdrop1.6/doc/tcl-commands.doc:1.134
--- eggdrop1.6/doc/tcl-commands.doc:1.133	Mon Mar  8 14:52:56 2010
+++ eggdrop1.6/doc/tcl-commands.doc	Sun Mar 14 12:34:59 2010
@@ -1,4 +1,4 @@
-$Id: tcl-commands.doc,v 1.133 2010/03/08 20:52:56 pseudo Exp $
+$Id: tcl-commands.doc,v 1.134 2010/03/14 18:34:59 pseudo Exp $
 
 Eggdrop Tcl Commands
 Last revised: November 23, 2009
@@ -1587,6 +1587,13 @@
 |   Returns: 1 if the address matches the block prefix, 0 otherwise.
 |   Module: core
 
+|  matchstr <pattern> <string>
+|   Description: checks if pattern matches string. Only two wildcards are
+|     supported: '*' and '?'. Matching is case-insensitive. This command
+|     is intended as a simplified alternative to Tcl's string match.  
+|   Returns: 1 if the pattern matches the string, 0 if it doesn't.
+|   Module: core
+
 *** GLOBAL VARIABLES ***
 
   NOTE: All config file variables are also global.
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.1242 eggdrop1.6/src/patch.h:1.1243
--- eggdrop1.6/src/patch.h:1.1242	Sun Mar 14 12:30:17 2010
+++ eggdrop1.6/src/patch.h	Sun Mar 14 12:34:59 2010
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.1242 2010/03/14 18:30:17 pseudo Exp $
+ * $Id: patch.h,v 1.1243 2010/03/14 18:34:59 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1268591186");            /* current unixtime */
+patch("1268591523");            /* current unixtime */
 /*
  *
  *
  */
-patch("uptime_randomize");
+patch("matchstr");
 /*
  *
  *
Index: eggdrop1.6/src/tclmisc.c
diff -u eggdrop1.6/src/tclmisc.c:1.67 eggdrop1.6/src/tclmisc.c:1.68
--- eggdrop1.6/src/tclmisc.c:1.67	Mon Mar  8 14:52:56 2010
+++ eggdrop1.6/src/tclmisc.c	Sun Mar 14 12:34:59 2010
@@ -2,7 +2,7 @@
  * tclmisc.c -- handles:
  *   Tcl stubs for everything else
  *
- * $Id: tclmisc.c,v 1.67 2010/03/08 20:52:56 pseudo Exp $
+ * $Id: tclmisc.c,v 1.68 2010/03/14 18:34:59 pseudo Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -744,6 +744,17 @@
     Tcl_AppendResult(irp, "0", NULL);
   return TCL_OK;
 }
+
+static int tcl_matchstr STDVAR
+{
+  BADARGS(3, 3, " pattern string");
+
+  if (wild_match(argv[1], argv[2]))
+    Tcl_AppendResult(irp, "1", NULL);
+  else
+    Tcl_AppendResult(irp, "0", NULL);
+  return TCL_OK;
+}
                     
 tcl_cmds tclmisc_objcmds[] = {
 #ifdef USE_TCL_OBJ
@@ -792,5 +803,6 @@
   {"stripcodes",     tcl_stripcodes},
   {"matchaddr",       tcl_matchaddr},
   {"matchcidr",       tcl_matchcidr},
+  {"matchstr",         tcl_matchstr},
   {NULL,                       NULL}
 };
----------------------- End of diff -----------------------


More information about the Changes mailing list