2 This file is part of the NoBug debugging library.
4 Copyright (C) 2008, Simeon Voelkel <simeon_voelkel@arcor.de>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, contact Christian Thaeter <ct@pipapo.org>.
22 #include <sys/types.h>
27 #define NOBUG_LIBNOBUG_C
31 //rbdump HEAD~ Dumping Persistent Ringbuffers; rbdump; dumping persistent ringbuffers
33 //rbdump NoBug installs the `nobug_rbdump` tool for dumping the content of a persistent
34 //rbdump ringbuffer. It is invoked with the filename of the ringbuffer, the content is then
35 //rbdump printed to stdout.
39 main(int argc
, char* argv
[])
45 printf( "usage: %s file\n\n"
46 " nobug ringbuffer dump\n\n"
48 " 2008, Simeon Voelkel <simeon_voelkel@arcor.de>\n\n"
49 " This is free software. You may redistribute copies of it under the terms of\n"
50 " the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.\n"
51 " There is NO WARRANTY, to the extent permitted by law.\n\n",
58 if (stat(argv
[1], &filestat
))
60 fprintf (stderr
, "Can't stat file %s\n", argv
[1]);
64 struct nobug_ringbuffer rb
;
66 if (!nobug_ringbuffer_init (&rb
, filestat
.st_size
, argv
[1], NOBUG_RINGBUFFER_KEEP
|NOBUG_RINGBUFFER_APPEND
))
68 fprintf (stderr
, "Error opening ringbuffer %s\n", argv
[1]);
72 nobug_ringbuffer_save (&rb
, stdout
);