(************************************************************************) (* This file is part of SKS. SKS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* Copyright 2002, 2003, 2004 Yaron M. Minsky *) (* Copyright 2004 Peter Palfrader *) (***********************************************************************) (** prints the log of added and removed hashes *) module F(M:sig end) = struct open StdLabels open MoreLabels open Printf open Common open Packet let settings = { Keydb.withtxn = !Settings.transactions; Keydb.cache_bytes = !Settings.cache_bytes; Keydb.pagesize = !Settings.pagesize; Keydb.dbdir = !Settings.dbdir; Keydb.dumpdir = !Settings.dumpdir; } module Keydb = Keydb.Unsafe let printlog maxsize timestamp = let log = Keydb.reverse_logquery ~maxsize timestamp in if List.length log = 0 then printf "No changes since timestamp\n" else List.iter log ~f:(function (time,Add hash) -> printf "Add %s\n" (KeyHash.hexify hash) | (time,Delete hash) -> printf "Del %s\n" (KeyHash.hexify hash) ); exception Argument_error let run () = try ( match !Settings.anonlist with | maxsize::timestamp::tl -> set_logfile ".printlog"; Keydb.open_dbs settings; let timestamp = float_of_string timestamp in let maxsize = int_of_string maxsize in printlog maxsize timestamp | _ -> raise Argument_error ) with Argument_error -> eprintf "wrong number of arguments\n"; eprintf "usage: sksdump maxlines timestamp(seconds since 1970)\n"; flush stderr; exit (-1) end