]> bicyclesonthemoon.info Git - ott/ong1/blob - lastpost.awk
Update from src directory as of 26.11.2016
[ott/ong1] / lastpost.awk
1 #// lastpost.awk\r
2 #// what was the last post?\r
3 #// 20.03.2015\r
4 #// \r
5 #// Copyright (C) 2015  Balthasar SzczepaƄski\r
6 #// \r
7 #// This program is free software: you can redistribute it and/or modify\r
8 #// it under the terms of the GNU Affero General Public License as\r
9 #// published by the Free Software Foundation, either version 3 of the\r
10 #// License, or (at your option) any later version.\r
11 #// \r
12 #// This program is distributed in the hope that it will be useful,\r
13 #// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 #// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15 #// GNU Affero General Public License for more details.\r
16 #// \r
17 #// You should have received a copy of the GNU Affero General Public License\r
18 #// along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
19 \r
20 BEGIN{\r
21         FS=""\r
22 }\r
23 {\r
24         if ((i=match($0, /id=\"p[0-9]+\"/))!=0) #"\r
25         {\r
26                 temp=substr($0, i+5)\r
27                 postid=substr(temp, 1, index(temp,"\"")-1)\r
28         }\r
29         \r
30         if ($0 ~ /class=\"postprofile\"/) #"\r
31                 postprofile = "1"\r
32         \r
33         else if (postprofile=="")\r
34                 next\r
35         \r
36         if($0 ~ /memberlist\.php.*mode=viewprofile[^<>]*>[^<>]+<\/a/)\r
37         {\r
38                 temp=substr($0, index($0, ">")+1)\r
39                 username=substr(temp, 1, index(temp,"<")-1)\r
40                 exit\r
41         }\r
42 }\r
43 END{\r
44         print postid\r
45         print username\r
46 }