Finishing the total time counters
[lwes-journaller.git] / src / journaller_rotate_logs.c
bloba641dd584bb9b465a0a103522f9b5c1d798c918e
1 /*======================================================================*
2 * Copyright (C) 2008 Light Weight Event System *
3 * All rights reserved. *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
18 * Boston, MA 02110-1301 USA. *
19 *======================================================================*/
20 #include "config.h"
22 #include "header.h"
23 #include "log.h"
24 #include "opt.h"
25 #include "perror.h"
26 #include "xport.h"
28 #include <fcntl.h>
29 #include <stdlib.h>
30 #include <unistd.h>
32 int main(int argc, const char* argv[])
34 int xpt_write_ret;
35 struct xport xpt;
36 const char rotate_event[] = ROTATE_COMMAND "\0";
38 process_options(argc, argv);
39 arg_ttl = 3 ; /* Command::Rotate should not be any other ... */
41 if ( (xport_factory(&xpt) < 0) || (xpt.vtbl->open(&xpt, O_RDONLY) < 0) )
43 LOG_ER("Failed to create xport object.\n");
44 exit(EXIT_FAILURE);
47 if ( (xpt_write_ret = xpt.vtbl->write(&xpt,
48 rotate_event,
49 sizeof(rotate_event))) < 0 )
51 LOG_ER("Xport Command::Rotate write error.");
52 xpt.vtbl->destructor(&xpt);
53 exit(EXIT_FAILURE);
56 xpt.vtbl->destructor(&xpt);
58 return 0;