Commit e84d6b99 authored by Claes Sjofors's avatar Claes Sjofors

rt_elog_dump makefile was missing

parent ae4fbb27
include $(pwre_dir_symbols)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_sroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program 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 Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
/* rt_elog_dump.c -- <short description> /* rt_elog_dump.c -- <short description>
Author Jonas Nylund. Author Jonas Nylund.
...@@ -38,11 +74,28 @@ void convertEventPrio(int prio, char *ret); ...@@ -38,11 +74,28 @@ void convertEventPrio(int prio, char *ret);
DB *dataBaseP = NULL; DB *dataBaseP = NULL;
void usage()
{
printf( "\n"
" rt_elog_dump Dump eventlog to text file\n"
"\n"
" > rt_elog_dump [dumpfile] [database]\n"
"\n"
" dumpfile Name of dumpfile, default " DUMPFILE "\n"
" database Database file, default " DATABASE "\n\n");
}
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
FILE *outFile; FILE *outFile;
pwr_tInt32 ret; pwr_tInt32 ret;
if (argc > 1 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)) {
usage();
exit(0);
}
if(argc == 3) if(argc == 3)
{ {
if(argv[2] != NULL) if(argv[2] != NULL)
...@@ -53,7 +106,7 @@ main (int argc, char *argv[]) ...@@ -53,7 +106,7 @@ main (int argc, char *argv[])
if(outFile == NULL) if(outFile == NULL)
{ {
printf("kunde ej skapa fil, avslutar"); printf("** Unable to open file, terminating\n");
exit(1); exit(1);
} }
if(argc > 1) if(argc > 1)
...@@ -67,9 +120,9 @@ main (int argc, char *argv[]) ...@@ -67,9 +120,9 @@ main (int argc, char *argv[])
printf("error db_close: %s\n", db_strerror(ret)); printf("error db_close: %s\n", db_strerror(ret));
} }
if(argc == 3) if(argc == 3)
printf("Programmet klart resultatet finns i filen %s\n", argv[2]); printf("-- Dumpfile successfully created, %s\n", argv[2]);
else else
printf("Programmet klart resultatet finns i filen %s\n", DUMPFILE); printf("-- Dumpfile successfully created, %s\n", DUMPFILE);
return 0; return 0;
} }
...@@ -87,7 +140,7 @@ Init (char *fname) ...@@ -87,7 +140,7 @@ Init (char *fname)
{ {
/*error creating db-handle send the mess to errh, then exit*/ /*error creating db-handle send the mess to errh, then exit*/
printf("error db_create: %s\n", db_strerror(ret)); printf("error db_create: %s\n", db_strerror(ret));
printf(" Fel vid skapande av databashandtag avslutar\n"); printf("** Error when creating db handle, terminating\n");
exit(1); exit(1);
} }
...@@ -144,10 +197,10 @@ void ReadFromDBAndPutInFile(FILE *outFile) ...@@ -144,10 +197,10 @@ void ReadFromDBAndPutInFile(FILE *outFile)
if(ret != DB_NOTFOUND) if(ret != DB_NOTFOUND)
{ {
printf("error dbcp->c_get: %s\n", db_strerror(ret)); printf("error dbcp->c_get: %s\n", db_strerror(ret));
printf("Fel vid frsk att lsa post nr %u, avslutar\n", nrOfEvents); printf("** Error reading post number %u, terminating\n", nrOfEvents);
exit(1); exit(1);
} }
printf("Antal hndelser skrivna till fil: %u\n", nrOfEvents); printf("-- Number of events written to file: %u\n", nrOfEvents);
/*Close the cursor*/ /*Close the cursor*/
if((ret = dbcp->c_close(dbcp)) != 0) if((ret = dbcp->c_close(dbcp)) != 0)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment