[master] 62764ca Rename -o to -m ; documentation

Tollef Fog Heen tfheen at varnish-cache.org
Fri May 6 15:22:39 CEST 2011


commit 62764cacaf9fbd9743f6ceb92a4c71eb713111d7
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Fri May 6 15:22:14 2011 +0200

    Rename -o to -m ; documentation
    
    Rename -o added in last commit to -m, add documentation.

diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c
index 26bb3cb..df6a7bd 100644
--- a/bin/varnishlog/varnishlog.c
+++ b/bin/varnishlog/varnishlog.c
@@ -315,6 +315,8 @@ main(int argc, char * const *argv)
 		case 'w':
 			w_arg = optarg;
 			break;
+		case 'm':
+			o_flag = 1; /* fall through */
 		default:
 			if (VSL_Arg(vd, c, optarg) > 0)
 				break;
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 308fab2..308d9fa 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -107,7 +107,7 @@ struct VSM_data *vd;
 
 static size_t nll;
 
-static int o_flag = 0;
+static int m_flag = 0;
 
 static const char *format;
 
@@ -516,7 +516,7 @@ h_ncsa(void *priv, enum vsl_tag tag, unsigned fd,
 	if (!lp->complete)
 		return (reopen);
 
-	if (o_flag && !VSL_Matched(vd, lp->bitmap))
+	if (m_flag && !VSL_Matched(vd, lp->bitmap))
 		/* -o is in effect matching rule failed. Don't display */
 		return (reopen);
 
@@ -775,11 +775,8 @@ main(int argc, char *argv[])
 		case 'c':
 			/* XXX: Silently ignored: it's required anyway */
 			break;
-		case 'o':
-			o_flag = 1;
-			if (VSL_Arg(vd, c, optarg) > 0)
-				break;
-			usage();
+		case 'm':
+			m_flag = 1; /* Fall through */
 		default:
 			if (VSL_Arg(vd, c, optarg) > 0)
 				break;
diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index eca542d..c98f154 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -335,8 +335,8 @@ main(int argc, char **argv)
 		case 'V':
 			varnish_version("varnishtop");
 			exit(0);
-		case 'o':
-			fprintf(stderr, "-o is not supported\n");
+		case 'm':
+			fprintf(stderr, "-m is not supported\n");
 			exit(1);
 		default:
 			if (VSL_Arg(vd, o, optarg) > 0)
diff --git a/doc/sphinx/reference/varnishhist.rst b/doc/sphinx/reference/varnishhist.rst
index a89539c..5c0cc05 100644
--- a/doc/sphinx/reference/varnishhist.rst
+++ b/doc/sphinx/reference/varnishhist.rst
@@ -15,8 +15,8 @@ Varnish request histogram
 SYNOPSIS
 ========
 
-varnishhist [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-n varnish_name] 
-[-r file] [-V] [-w delay] [-X regex] [-x tag]
+varnishhist [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...] 
+[-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag]
 
 DESCRIPTION
 ===========
@@ -51,6 +51,9 @@ The following options are available:
 -i tag      Include log entries with the specified tag.  If neither 
    	    -I nor -i is specified, all log entries are included.
 
+-m tag:regex only count transactions where tag matches regex. Multiple
+            -m options are AND-ed together.
+
 -n          Specifies the name of the varnishd instance to get logs 
 	    from.  If -n is not specified, the host name is used.
 
diff --git a/doc/sphinx/reference/varnishlog.rst b/doc/sphinx/reference/varnishlog.rst
index 8af8030..d703b47 100644
--- a/doc/sphinx/reference/varnishlog.rst
+++ b/doc/sphinx/reference/varnishlog.rst
@@ -17,7 +17,7 @@ SYNOPSIS
 ========
 
 varnishlog [-a] [-b] [-C] [-c] [-D] [-d] [-I regex] [-i tag] [-k keep] 
-[-n varnish_name] [-o [tag regex]] [-P file] [-r file] [-s num] [-u] [-V]
+[-n varnish_name] [-o] [-m tag:regex ...] [-P file] [-r file] [-s num] [-u] [-V]
 [-w file] [-X regex] [-x tag]
 
 DESCRIPTION
@@ -51,6 +51,9 @@ The following options are available:
 
 -k num      Only show the first num log records.
 
+-m tag:regex only list transactions where tag matches regex. Multiple
+            -m options are AND-ed together.
+
 -n          Specifies the name of the varnishd instance to get logs from.  If -n is not 
 	    specified, the host name is used.
 
diff --git a/doc/sphinx/reference/varnishncsa.rst b/doc/sphinx/reference/varnishncsa.rst
index 2cb64af..3fe1b35 100644
--- a/doc/sphinx/reference/varnishncsa.rst
+++ b/doc/sphinx/reference/varnishncsa.rst
@@ -16,7 +16,7 @@ SYNOPSIS
 ========
 
 varnishncsa [-a] [-b] [-C] [-c] [-D] [-d] [-f] [-F format] [-I regex]
-[-i tag] [-n varnish_name] [-o tag regex] [-P file] [-r file] [-V] [-w file] 
+[-i tag] [-n varnish_name] [-m tag:regex ...] [-P file] [-r file] [-V] [-w file] 
 [-X regex] [-x tag]
 
 
@@ -110,8 +110,8 @@ The following options are available:
 		     How the request was handled, whether it was a
 		     cache hit, miss, pass, pipe or error.
 
--o	    Filter log output to request groups that match a regular
-	    expression on a specified tag.
+-m tag:regex only list records where tag matches regex. Multiple
+            -m options are AND-ed together.
 
 -n          Specifies the name of the varnishd instance to get logs 
 	    from.  If -n is not specified, the host name is used.
diff --git a/doc/sphinx/reference/varnishsizes.rst b/doc/sphinx/reference/varnishsizes.rst
index 045166a..cc36277 100644
--- a/doc/sphinx/reference/varnishsizes.rst
+++ b/doc/sphinx/reference/varnishsizes.rst
@@ -17,8 +17,8 @@ Varnish object size request histogram
 SYNOPSIS
 ========
 
-varnishsizes [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-n varnish_name]
-             [-r file] [-V] [-w delay] [-X regex] [-x tag]
+varnishsizes [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...]
+	     [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag]
 
 DESCRIPTION
 ===========
@@ -49,6 +49,9 @@ The following options are available:
 -i tag      Include log entries with the specified tag.  If neither -I nor -i 
    	    is specified, all log entries are included.
 
+-m tag:regex only list record where tag matches regex. Multiple -m
+             options are AND-ed together.
+
 -n          Specifies the name of the varnishd instance to get logs from.  
 	    If -n is not specified, the host name is used.
 
diff --git a/include/varnishapi.h b/include/varnishapi.h
index cda0bb3..230bdbb 100644
--- a/include/varnishapi.h
+++ b/include/varnishapi.h
@@ -214,7 +214,7 @@ int VSL_Open(struct VSM_data *vd, int diag);
 	 *	!= 0 on failure
 	 */
 
-#define VSL_ARGS	"bCcdI:i:k:n:r:s:X:x:o:"
+#define VSL_ARGS	"bCcdI:i:k:n:r:s:X:x:m:"
 #define VSL_b_USAGE	"[-b]"
 #define VSL_c_USAGE	"[-c]"
 #define VSL_C_USAGE	"[-C]"
@@ -222,8 +222,8 @@ int VSL_Open(struct VSM_data *vd, int diag);
 #define VSL_i_USAGE	"[-i tag]"
 #define VSL_I_USAGE	"[-I regexp]"
 #define VSL_k_USAGE	"[-k keep]"
+#define VSL_m_USAGE	"[-m tag:regex]"
 #define VSL_n_USAGE	VSM_n_USAGE
-#define VSL_o_USAGE	"[-o tag:regex]"
 #define VSL_r_USAGE	"[-r file]"
 #define VSL_s_USAGE	"[-s skip]"
 #define VSL_x_USAGE	"[-x tag]"
@@ -232,8 +232,8 @@ int VSL_Open(struct VSM_data *vd, int diag);
 			VSL_i_USAGE " "		\
 			VSL_I_USAGE " "		\
 			VSL_k_USAGE " "		\
+			VSL_m_USAGE " "		\
 			VSL_n_USAGE " "		\
-			VSL_o_USAGE " "		\
 			VSL_r_USAGE " "		\
 			VSL_s_USAGE " "		\
 			VSL_X_USAGE " "		\
diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c
index 502ad09..a6a2700 100644
--- a/lib/libvarnishapi/vsl_arg.c
+++ b/lib/libvarnishapi/vsl_arg.c
@@ -163,7 +163,7 @@ name2tag(const char *n)
 }
 
 static int
-vsl_o_arg(const struct VSM_data *vd, const char *opt)
+vsl_m_arg(const struct VSM_data *vd, const char *opt)
 {
 	struct vsl_re_match *m;
 	const char *error;
@@ -264,7 +264,7 @@ VSL_Arg(struct VSM_data *vd, int arg, const char *opt)
 	case 'r': return (vsl_r_arg(vd, opt));
 	case 's': return (vsl_s_arg(vd, opt));
 	case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg));
-	case 'o': return (vsl_o_arg(vd, opt));
+	case 'm': return (vsl_m_arg(vd, opt));
 	case 'C': vd->vsl->regflags = VRE_CASELESS; return (1);
 	default:
 		return (0);



More information about the varnish-commit mailing list