[MINOR] halog: add support for statisticts on status codes

Using "-st", halog outputs number of requests by status codes.
diff --git a/contrib/halog/halog.c b/contrib/halog/halog.c
index 96d32bc..8f24030 100644
--- a/contrib/halog/halog.c
+++ b/contrib/halog/halog.c
@@ -63,6 +63,8 @@
 #define FILT_INVERT_ERRORS     0x200
 #define FILT_INVERT_TIME_RESP  0x400
 
+#define FILT_COUNT_STATUS      0x800
+
 unsigned int filter = 0;
 unsigned int filter_invert = 0;
 const char *line;
@@ -73,7 +75,7 @@
 {
 	fprintf(stderr,
 		"%s"
-		"Usage: halog [-c] [-v] [-gt] [-pct] [-s <skip>] [-e|-E] [-rt|-RT <time>] [-ad <delay>] [-ac <count>] < file.log\n"
+		"Usage: halog [-c] [-v] [-gt] [-pct] [-st] [-s <skip>] [-e|-E] [-rt|-RT <time>] [-ad <delay>] [-ac <count>] < file.log\n"
 		"\n",
 		msg ? msg : ""
 		);
@@ -408,6 +410,8 @@
 			filter |= FILT_GRAPH_TIMERS;
 		else if (strcmp(argv[0], "-pct") == 0)
 			filter |= FILT_PERCENTILE;
+		else if (strcmp(argv[0], "-st") == 0)
+			filter |= FILT_COUNT_STATUS;
 		else if (strcmp(argv[0], "-o") == 0) {
 			if (output_file)
 				die("Fatal: output file name already specified.\n");
@@ -484,6 +488,10 @@
 			}
 		}
 
+		test ^= filter_invert;
+		if (!test)
+			continue;
+
 		if (filter & (FILT_ACC_COUNT|FILT_ACC_DELAY)) {
 			b = field_start(line, ACCEPT_FIELD + skip_fields);
 			if (!*b) {
@@ -585,9 +593,18 @@
 			continue;
 		}
 
-		test ^= filter_invert;
-		if (!test)
+		if (filter & FILT_COUNT_STATUS) {
+			b = field_start(line, STATUS_FIELD + skip_fields);
+			if (!*b) {
+				truncated_line(linenum, line);
+				continue;
+			}
+			val = str2ic(b);
+
+			t2 = insert_value(&timers[0], &t, val);
+			t2->count++;
 			continue;
+		}
 
 		/* all other cases mean we just want to count lines */
 		tot++;
@@ -603,9 +620,6 @@
 		exit(0);
 	}
 
-	if (filter & FILT_ERRORS_ONLY)
-		exit(0);
-
 	if (filter & (FILT_ACC_COUNT|FILT_ACC_DELAY)) {
 		/* sort and count all timers. Output will look like this :
 		 * <accept_date> <delta_ms from previous one> <nb entries>
@@ -709,6 +723,15 @@
 				step += 1;
 		}
 	}
+	else if (filter & FILT_COUNT_STATUS) {
+		/* output all statuses in the form of <status> <occurrences> */
+		n = eb32_first(&timers[0]);
+		while (n) {
+			t = container_of(n, struct timer, node);
+			printf("%d %d\n", n->key, t->count);
+			n = eb32_next(n);
+		}
+	}
  empty:
 	if (!(filter & FILT_QUIET))
 		fprintf(stderr, "%d lines in, %d lines out, %d parsing errors\n",