/[webpac]/trunk2/openisis/ois.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk2/openisis/ois.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 337 - (show annotations)
Thu Jun 10 19:22:40 2004 UTC (15 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 2343 byte(s)
new trunk for webpac v2

1 /*
2 openisis - an open implementation of the CDS/ISIS database
3 Version 0.8.x (patchlevel see file Version)
4 Copyright (C) 2001-2003 by Erik Grziwotz, erik@openisis.org
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library 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 GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 see README for more information
21 EOH */
22
23 /*
24 $Id: ois.c,v 1.9 2003/06/30 09:50:15 kripke Exp $
25 OpenIsis server
26 */
27
28 #include <string.h> /* mem* */
29
30 #include "lsv.h"
31 #include "ldsp.h"
32
33 /* the db srv application */
34 static int dbsrv (Con *con, int task) {
35 int rt;
36 switch ( task ) {
37 case LSV_APPGOT:
38 con->grp = 0; /* single threaded */
39 default:
40 return 0;
41 case LSV_APPRUN:
42 break;
43 }
44 sMsg( LOG_INFO, "dbs %d: %d fields from %s",
45 svCur()->id, con->req->len, con->nam);
46 rt = ldspProcess (con->req, &(con->ses->res), 0, 0);
47 sMsg( LOG_INFO, "dbs %d: %d fields to %s (%d)",
48 svCur()->id, con->ses->res->len, con->nam, rt);
49 return rt;
50 }
51
52
53
54 int main ( int argc, const char **argv )
55 {
56 const char *arg0 = *argv;
57 /* should we ask federico for his fhc 1499 ? */
58 /* or use unassigned 5433 = postgresql++ ? */
59 const char *port = "2042"; /* isis :) */
60 int ndb = 0;
61 Srv dbs;
62 Rec *rec = 0;
63
64 memset( &dbs, 0, sizeof(dbs) );
65 dbs.prt = svPlain;
66 dbs.app = dbsrv;
67 cOpen(0);
68 cLog( LOG_DEBUG, 0 );
69 nInit( 0, 0, 0 );
70 while ( --argc ) {
71 const char *arg = *++argv;
72 if ( '0' <= *arg && *arg <= '9' )
73 port = arg;
74 else {
75 rec = rSet (rec, 0, OPENISIS_RQS_TYPE, "1", OPENISIS_COM_DBN, arg, 0 );
76 openIsisNSend (stub0, rec, 0, 0, 0);
77 CLRREC( rec );
78 ndb++;
79 /* else sMsg( LOG_ERROR, "could not open db '%s'", arg ); */
80 }
81 }
82 if ( ! ndb ) {
83 sMsg( LOG_ERROR, "usage: %s db [db ...] [port]", arg0 );
84 return 1;
85 }
86 return svRun( &dbs, port );
87 }

  ViewVC Help
Powered by ViewVC 1.1.26