/* * Copyright (c) 1995, 1996 Gunther Schadow. All rights reserved. * * 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 this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #ifdef DEBUG # ifdef LOGLEVEL # undef LOGLEVEL # endif # define LOGLEVEL L_JUNK #else # ifndef LOGLEVEL # define LOGLEVEL L_MESG # endif #endif /* A simple application that reads a message from a file and reports * it in several forms to stdout and stderr. This is for sure more * complex as such a simle task would require, however it is used * for some test purpose which requires multiple options to choose from. * I do not recommend to read this if you want to learn how to write * ProtoGen/HL7 applications. */ main(int argc, char *argv[]) { int c; int max = 1; bool quiet = FALSE; int loglevel = LOGLEVEL; ANYmsg msg(atoBitSet("1*")); // any configured message may be read while( ( c = getopt(argc, argv, "l:n:q") ) != -1 ) { switch(c) { case 'n': max = atoi(optarg); break; case 'q': quiet = TRUE; break; case 'l': loglevel = atoi(optarg); break; default: cerr << "usage: " << argv[0] << " [-q] [-n max] message ..." << endl; exit(0); } } argc -= optind; argv += optind; log_init(argv[0], "./inout.log", "test"); log_level(loglevel); lprintf(L_MESG, "hl7 start"); if (max > 1) { int i, j; for(i=0; i