r109502 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109501‎ | r109502 | r109503 >
Date:05:57, 19 January 2012
Author:diederik
Status:deferred
Tags:udplog 
Comment:
Some more filters
Modified paths:
  • /trunk/udplog/filters/5xx-filter.c (added) (history)
  • /trunk/udplog/filters/book-filter.c (added) (history)
  • /trunk/udplog/filters/edits-filter.c (added) (history)
  • /trunk/udplog/filters/m-filter.c (added) (history)
  • /trunk/udplog/filters/wap-filter.c (added) (history)

Diff [purge]

Index: trunk/udplog/filters/5xx-filter.c
@@ -0,0 +1,46 @@
 2+#include <stdio.h>
 3+#include <string.h>
 4+
 5+char editparam[]="action=submit";
 6+char editattempt[]="action=edit";
 7+
 8+main() {
 9+ char line[10240];
 10+ char code[10240];
 11+ char *codestart, *codeend;
 12+ char *t = 0;
 13+
 14+ while (!feof(stdin)) {
 15+ char *r;
 16+ r=fgets(line, 10000, stdin);
 17+
 18+ int pos=0;
 19+ t = line;
 20+ /* eliminate mobile :-) */
 21+ if (r[0] == 'm')
 22+ continue;
 23+
 24+ while(pos++<5) {
 25+ if (!t)
 26+ continue;
 27+ t = strstr(t, " ");
 28+ if (!t)
 29+ continue;
 30+ t++;
 31+ }
 32+ if (!t)
 33+ continue;
 34+ codestart = t;
 35+ codeend = strstr(codestart, " ");
 36+ if (!codeend)
 37+ continue;
 38+
 39+ strncpy(code, codestart, codeend-codestart);
 40+ code[codeend-codestart]=0;
 41+
 42+ if (strstr(code, "/5")) {
 43+ printf("%s", line);
 44+ fflush(stdout);
 45+ }
 46+ }
 47+}
Property changes on: trunk/udplog/filters/5xx-filter.c
___________________________________________________________________
Added: svn:eol-style
148 + native
Index: trunk/udplog/filters/wap-filter.c
@@ -0,0 +1,43 @@
 2+#include <stdio.h>
 3+#include <string.h>
 4+
 5+char bp1[] = "wap.wikipedia.org";
 6+char bp2[] = "mobile.wikipedia.org";
 7+
 8+
 9+
 10+main() {
 11+ char line[10240];
 12+ char title[10240];
 13+ char *urlstart, *urlend;
 14+ char *t = 0;
 15+
 16+ while (!feof(stdin)) {
 17+ char *r;
 18+ r=fgets(line, 10000, stdin);
 19+
 20+ int pos=0;
 21+ t = line;
 22+
 23+ while(pos++<8) {
 24+ if (!t)
 25+ continue;
 26+ t = strstr(t, " ");
 27+ if (!t)
 28+ continue;
 29+ t++;
 30+ }
 31+ if (!t)
 32+ continue;
 33+ urlstart = t;
 34+ urlend = strstr(urlstart, " ");
 35+ strncpy(title, urlstart, urlend-urlstart);
 36+ title[urlend-urlstart]=0;
 37+ if ( strstr(title, bp1) ||
 38+ strstr(title, bp2)
 39+ ){
 40+ printf("%s", line);
 41+ }
 42+ }
 43+
 44+}
Property changes on: trunk/udplog/filters/wap-filter.c
___________________________________________________________________
Added: svn:eol-style
145 + native
Index: trunk/udplog/filters/book-filter.c
@@ -0,0 +1,75 @@
 2+#include <stdio.h>
 3+#include <string.h>
 4+
 5+char bp1[] = "bookcmd=";
 6+char bp2[] = "wfAjaxCollection";
 7+char bp3[] = "Special:Book";
 8+char bp4[] = "Spezial:Buch";
 9+char bp5[] = "Especial:Libro";
 10+char bp6[] = "Sp%C3%A9cial:Livre";
 11+char bp7[] = "Especial:Livro";
 12+char bp8[] = "Speciale:Libro";
 13+char bp9[] = "Special:Bok";
 14+char bp10[] = "Speciaal:Boek";
 15+
 16+
 17+/*
 18+char bp3[] = "Special%3ABook";
 19+char bp4[] = "Spezial%3ABuch";
 20+char bp5[] = "Especial%3ALibro";
 21+char bp6[] = "Sp%C3%A9cial%3ALivre";
 22+char bp7[] = "Especial%3ALivro";
 23+char bp8[] = "Speciale%3ALibro";
 24+char bp9[] = "Special%3ABok";
 25+char bp10[] = "Speciaal%3ABoek";
 26+*/
 27+
 28+char bparams[]="?title=Special:BannerLoader";
 29+
 30+
 31+main() {
 32+ char line[10240];
 33+ char title[10240];
 34+ char *urlstart, *urlend;
 35+ char *t = 0;
 36+
 37+ while (!feof(stdin)) {
 38+ char *r;
 39+ r=fgets(line, 10000, stdin);
 40+
 41+ int pos=0;
 42+ t = line;
 43+
 44+ while(pos++<8) {
 45+ if (!t)
 46+ continue;
 47+ t = strstr(t, " ");
 48+ if (!t)
 49+ continue;
 50+ t++;
 51+ }
 52+ if (!t)
 53+ continue;
 54+ urlstart = t;
 55+ urlend = strstr(urlstart, " ");
 56+ if (!urlend)
 57+ continue;
 58+
 59+ strncpy(title, urlstart, urlend-urlstart);
 60+ title[urlend-urlstart]=0;
 61+ if ( strstr(title, bp1) ||
 62+ strstr(title, bp2) ||
 63+ strstr(title, bp3) ||
 64+ strstr(title, bp4) ||
 65+ strstr(title, bp5) ||
 66+ strstr(title, bp6) ||
 67+ strstr(title, bp7) ||
 68+ strstr(title, bp8) ||
 69+ strstr(title, bp9) ||
 70+ strstr(title, bp10)
 71+ ){
 72+ printf("%s", line);
 73+ }
 74+ }
 75+
 76+}
Property changes on: trunk/udplog/filters/book-filter.c
___________________________________________________________________
Added: svn:eol-style
177 + native
Index: trunk/udplog/filters/m-filter.c
@@ -0,0 +1,38 @@
 2+#include <stdio.h>
 3+#include <string.h>
 4+
 5+char bp1[] = "m.wikipedia.org";
 6+
 7+main() {
 8+ char line[10240];
 9+ char title[10240];
 10+ char *urlstart, *urlend;
 11+ char *t = 0;
 12+
 13+ while (!feof(stdin)) {
 14+ char *r;
 15+ r=fgets(line, 10000, stdin);
 16+
 17+ int pos=0;
 18+ t = line;
 19+
 20+ while(pos++<8) {
 21+ if (!t)
 22+ continue;
 23+ t = strstr(t, " ");
 24+ if (!t)
 25+ continue;
 26+ t++;
 27+ }
 28+ if (!t)
 29+ continue;
 30+ urlstart = t;
 31+ urlend = strstr(urlstart, " ");
 32+ strncpy(title, urlstart, urlend-urlstart);
 33+ title[urlend-urlstart]=0;
 34+ if (strstr(title, bp1)){
 35+ printf("%s", line);
 36+ }
 37+ }
 38+
 39+}
Property changes on: trunk/udplog/filters/m-filter.c
___________________________________________________________________
Added: svn:eol-style
140 + native
Index: trunk/udplog/filters/edits-filter.c
@@ -0,0 +1,44 @@
 2+#include <stdio.h>
 3+#include <string.h>
 4+
 5+char editparam[]="action=submit";
 6+char editattempt[]="action=edit";
 7+
 8+main() {
 9+ char line[10240];
 10+ char title[10240];
 11+ char *urlstart, *urlend;
 12+ char *t = 0;
 13+
 14+ while (!feof(stdin)) {
 15+ char *r;
 16+ r=fgets(line, 10000, stdin);
 17+
 18+ int pos=0;
 19+ t = line;
 20+
 21+ while(pos++<8) {
 22+ if (!t)
 23+ continue;
 24+ t = strstr(t, " ");
 25+ if (!t)
 26+ continue;
 27+ t++;
 28+ }
 29+ if (!t)
 30+ continue;
 31+ urlstart = t;
 32+ urlend = strstr(urlstart, " ");
 33+ if (!urlend)
 34+ continue;
 35+ strncpy(title, urlstart, urlend-urlstart);
 36+ title[urlend-urlstart]=0;
 37+
 38+ if ( strstr(title, editparam) ||
 39+ strstr(title, editattempt)
 40+ ){
 41+ printf("%s", line);
 42+ }
 43+ }
 44+
 45+}
Property changes on: trunk/udplog/filters/edits-filter.c
___________________________________________________________________
Added: svn:eol-style
146 + native

Status & tagging log