1 /* $Id: pazpar2.c,v 1.90 2007-06-18 11:10:20 adam Exp $
2 Copyright (c) 2006-2007, Index Data.
4 This file is part of Pazpar2.
6 Pazpar2 is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with Pazpar2; see the file LICENSE. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
34 void child_handler(void *data)
39 if (*global_parameters.settings_path_override)
40 settings_read(global_parameters.settings_path_override);
41 else if (global_parameters.server->settings)
42 settings_read(global_parameters.server->settings);
44 yaz_log(YLOG_WARN, "No settings-directory specified");
45 global_parameters.odr_in = odr_createmem(ODR_DECODE);
46 global_parameters.odr_out = odr_createmem(ODR_ENCODE);
53 int main(int argc, char **argv)
57 int log_file_in_use = 0;
59 const char *pidfile = "pazpar2.pid";
62 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
63 yaz_log(YLOG_WARN|YLOG_ERRNO, "signal");
65 yaz_log_init_prefix("pazpar2");
67 while ((ret = options("f:h:p:t:u:l:dDX", argv, argc, &arg)) != -2)
72 if (!read_config(arg))
76 strcpy(global_parameters.listener_override, arg);
82 strcpy(global_parameters.settings_path_override, arg);
88 global_parameters.dump_records = 1;
91 yaz_log_init_file(arg);
98 global_parameters.debug_mode = 1;
101 fprintf(stderr, "Usage: pazpar2\n"
103 " -h [host:]port (REST protocol listener)\n"
104 " -p pidfile PID file\n"
107 " -d (show internal records)\n"
108 " -D Daemon mode (background)\n"
109 " -l file log to file\n"
116 yaz_log(YLOG_LOG, "Pazpar2 %s started", VERSION);
117 if (daemon && !log_file_in_use)
119 yaz_log(YLOG_FATAL, "Logfile must be given (option -l) for daemon "
125 yaz_log(YLOG_FATAL, "Load config with -f");
128 global_parameters.server = config->servers;
130 start_http_listener();
131 pazpar2_process(global_parameters.debug_mode, daemon,
132 child_handler, 0 /* child_data */,
141 * indent-tabs-mode: nil
143 * vim: shiftwidth=4 tabstop=8 expandtab