/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1990-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* css - multiplex multiple clients on one filter server
*/
static const char usage[] =
"[-?\n@(#)$Id: css (AT&T Research) 1998-05-01 $\n]"
"[+NAME?css - multiplex multiple clients on one connect stream server]"
"[+DESCRIPTION?\bcss\b multiplexes multiple clients on one filter server."
" A filter server is a process that reads lines from the standard input"
" and writes result lines to the standard output. \aconnect-stream\a"
" is the connect stream path by which the filter service will be known.]"
"[t:timeout?The service will exit after a \atime\a period of client"
" inactivity.]:[time]"
"\n"
"\nconnect-stream command [ arg ... ]\n"
"\n"
"[+PROTOCOL?A filter service must follow a simple line oriented protocol. All"
" client lines are split into arguments and a number is inserted in the"
" second argument position. This number, followed by a space, must be"
" placed at the beginning of each line written by the filter server for"
" the given client request.]"
"[+SEE ALSO?\bcoshell\b(1), \bcs\b(1), \bss\b(1), \bcs\b(3)]"
;
#include <css.h>
#include <ctype.h>
#include <error.h>
#include <proc.h>
typedef struct
{
int service;
} Connection_t;
typedef struct
{
} State_t;
static int
{
return -1;
}
static int
{
register char* s;
register char* t;
int n;
int i;
{
case CS_POLL_CLOSE:
{
}
return 0;
case CS_POLL_READ:
{
return -1;
}
buf[n] = 0;
{
for (; isspace(*s); s++);
{
n -= s - buf;
}
}
else if (*s == '!')
{
return -1;
}
else
{
for (t = s; *t && !isspace(*t); t++);
for (; isspace(*t); t++);
if (*s == 'Q' && !*t)
{
}
else
{
return -1;
return -1;
}
}
return 1;
}
return 0;
}
static int
{
switch (op)
{
case CSS_INTERRUPT:
return 0;
case CSS_DORMANT:
exit(0);
}
return -1;
}
int
{
char* e;
for (;;)
{
{
case 't':
if (*e)
continue;
case '?':
continue;
case ':':
continue;
}
break;
}
return 1;
return 1;
}