r2574 - in branches/1.1: . bin/varnishlog include lib/libvarnishapi

des at projects.linpro.no des at projects.linpro.no
Sat Mar 8 17:59:39 CET 2008


Author: des
Date: 2008-03-08 17:59:38 +0100 (Sat, 08 Mar 2008)
New Revision: 2574

Modified:
   branches/1.1/
   branches/1.1/bin/varnishlog/varnishlog.1
   branches/1.1/include/varnishapi.h
   branches/1.1/lib/libvarnishapi/shmlog.c
Log:
Merged revisions 2572 via svnmerge from 
svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache

........
  r2572 | des | 2008-03-08 17:55:22 +0100 (Sat, 08 Mar 2008) | 2 lines
  
  Add a -s option which specifies a number of entries to skip.
........



Property changes on: branches/1.1
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2337,2357-2359,2361-2364,2366,2374-2386,2404,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2453-2461,2467,2492-2505,2520-2524,2545,2563-2565,2569
   + /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2091,2097,2106-2107,2116,2133,2154,2173,2181,2206-2207,2211-2212,2215-2245,2256-2262,2270-2271,2275,2285-2286,2288-2291,2295-2301,2304-2327,2337,2357-2359,2361-2364,2366,2374-2386,2404,2414-2415,2421-2422,2426,2432-2434,2444-2445,2447,2453-2461,2467,2492-2505,2520-2524,2545,2563-2565,2569,2572

Modified: branches/1.1/bin/varnishlog/varnishlog.1
===================================================================
--- branches/1.1/bin/varnishlog/varnishlog.1	2008-03-08 16:56:55 UTC (rev 2573)
+++ branches/1.1/bin/varnishlog/varnishlog.1	2008-03-08 16:59:38 UTC (rev 2574)
@@ -28,7 +28,7 @@
 .\"
 .\" $Id$
 .\"
-.Dd November 8, 2007
+.Dd March 8, 2008
 .Dt VARNISHLOG 1
 .Os
 .Sh NAME
@@ -48,6 +48,7 @@
 .Op Fl o
 .Op Fl P Ar file
 .Op Fl r Ar file
+.Op Fl s Ar num
 .Op Fl V
 .Op Fl w Ar file
 .Op Fl X Ar regex
@@ -126,6 +127,10 @@
 Read log entries from
 .Ar file
 instead of shared memory.
+.It Fl s Ar num
+Skip the first
+.Ar num
+log records.
 .It Fl V
 Display the version number and exit.
 .It Fl w Ar file

Modified: branches/1.1/include/varnishapi.h
===================================================================
--- branches/1.1/include/varnishapi.h	2008-03-08 16:56:55 UTC (rev 2573)
+++ branches/1.1/include/varnishapi.h	2008-03-08 16:59:38 UTC (rev 2574)
@@ -44,8 +44,8 @@
 typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr);
 #define VSL_S_CLIENT	(1 << 0)
 #define VSL_S_BACKEND	(1 << 1)
-#define VSL_ARGS	"bCcdI:i:r:X:x:"
-#define VSL_USAGE	"[-bCcd] [-i tag] [-I regexp] [-r file] [-X regexp] [-x tag]"
+#define VSL_ARGS	"bCcdI:i:r:s:X:x:"
+#define VSL_USAGE	"[-bCcd] [-i tag] [-I regexp] [-r file] [-s skip] [-X regexp] [-x tag]"
 vsl_handler VSL_H_Print;
 struct VSL_data;
 struct VSL_data *VSL_New(void);

Modified: branches/1.1/lib/libvarnishapi/shmlog.c
===================================================================
--- branches/1.1/lib/libvarnishapi/shmlog.c	2008-03-08 16:56:55 UTC (rev 2573)
+++ branches/1.1/lib/libvarnishapi/shmlog.c	2008-03-08 16:59:38 UTC (rev 2574)
@@ -85,6 +85,8 @@
 	int			regflags;
 	regex_t			*regincl;
 	regex_t			*regexcl;
+
+	unsigned long		skip;
 };
 
 #ifndef MAP_HASSEMAPHORE
@@ -289,6 +291,10 @@
 		default:
 			break;
 		}
+		if (vd->skip) {
+			--vd->skip;
+			continue;
+		}
 		if (vd->map[p[0]] & M_SELECT) {
 			*pp = p;
 			return (1);
@@ -356,7 +362,7 @@
 			if (*ptr >= ' ' && *ptr <= '~')
 				fprintf(fo, "%c", *ptr);
 			else
-				fprintf(fo, "%%%02x", *ptr);
+				fprintf(fo, "%%%02x", (unsigned char)*ptr);
 			ptr++;
 		}
 		fprintf(fo, "\"\n");
@@ -472,6 +478,26 @@
 
 /*--------------------------------------------------------------------*/
 
+static int
+vsl_s_arg(struct VSL_data *vd, const char *opt)
+{
+	char *end;
+
+	CHECK_OBJ_NOTNULL(vd, VSL_MAGIC);
+	if (*opt == '\0') {
+		fprintf(stderr, "number required for -s\n");
+		return (-1);
+	}
+	vd->skip = strtoul(opt, &end, 10);
+	if (*end != '\0') {
+		fprintf(stderr, "invalid number for -s\n");
+		return (-1);
+	}
+	return (1);
+}
+
+/*--------------------------------------------------------------------*/
+
 int
 VSL_Arg(struct VSL_data *vd, int arg, const char *opt)
 {
@@ -485,6 +511,7 @@
 	case 'r': return (vsl_r_arg(vd, opt));
 	case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg));
 	case 'C': vd->regflags = REG_ICASE; return (1);
+	case 's': return (vsl_s_arg(vd, opt));
 	default:
 		return (0);
 	}




More information about the varnish-commit mailing list