summaryrefslogtreecommitdiff
path: root/zwgc/port.c
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@mit.edu>2008-01-21 03:11:44 +0000
committerGravatar Karl Ramm <kcr@mit.edu>2008-01-21 03:11:44 +0000
commitb6ea75cfc9712b77a0886c4348d6fb519641e40e (patch)
tree65f68bb2db7c6118e80670cd5edc297159f43409 /zwgc/port.c
parent71f70d3066d1c038e1794c4ffe804591eda3d1af (diff)
de K&Rify, fix prototypes
Diffstat (limited to 'zwgc/port.c')
-rw-r--r--zwgc/port.c162
1 files changed, 81 insertions, 81 deletions
diff --git a/zwgc/port.c b/zwgc/port.c
index 0244dac..55d6274 100644
--- a/zwgc/port.c
+++ b/zwgc/port.c
@@ -37,10 +37,10 @@ static const char rcsid_port_c[] = "$Id$";
/* */
/****************************************************************************/
-static string port_get(p)
- port *p;
+static string
+port_get(port *p)
{
- char *(*get_proc)();
+ char *(*get_proc)(port *, char **);
char *error = NULL;
char *result;
@@ -65,12 +65,12 @@ static string port_get(p)
return(result);
}
-static void port_put(p, data, length)
- port *p;
- char *data;
- int length;
+static void
+port_put(port *p,
+ char *data,
+ int length)
{
- char *(*put_proc)();
+ char *(*put_proc)(port *, char *, int);
char *error;
if (p->status & OUTPUT_CLOSED) {
@@ -91,10 +91,10 @@ static void port_put(p, data, length)
var_set_variable("error", error);
}
-static void port_close_input(p)
- port *p;
+static void
+port_close_input(port *p)
{
- char *(*close_input_proc)();
+ char *(*close_input_proc)(port *);
char *error;
if (p->status & INPUT_CLOSED)
@@ -109,10 +109,10 @@ static void port_close_input(p)
var_set_variable("error", error);
}
-static void port_close_output(p)
- port *p;
+static void
+port_close_output(port *p)
{
- char *(*close_output_proc)();
+ char *(*close_output_proc)(port *);
char *error;
if (p->status & OUTPUT_CLOSED)
@@ -146,14 +146,15 @@ static port_dictionary port_dict = NULL;
* any other port call is made.
*/
-static void close_port_from_binding(b)
- port_dictionary_binding *b;
+static void
+close_port_from_binding(port_dictionary_binding *b)
{
port_close_input(&(b->value));
port_close_output(&(b->value));
}
-void init_ports()
+void
+init_ports(void)
{
if (port_dict) {
port_dictionary_Enumerate(port_dict, close_port_from_binding);
@@ -176,8 +177,8 @@ void init_ports()
* various fields correctly.
*/
-static port *create_named_port(name)
- string name;
+static port *
+create_named_port(string name)
{
int already_exists;
port_dictionary_binding *binding;
@@ -200,8 +201,8 @@ static port *create_named_port(name)
* it. Otherwise returns NULL.
*/
-static port *get_named_port(name)
- string name;
+static port *
+get_named_port(string name)
{
port_dictionary_binding *binding;
@@ -230,8 +231,8 @@ static port *get_named_port(name)
* on the heap & must be eventually freed.
*/
-string read_from_port(name)
- string name;
+string
+read_from_port(string name)
{
port *p;
@@ -253,10 +254,10 @@ string read_from_port(name)
* occurs, $error is set to the error message.
*/
-void write_on_port(name, text, length)
- string name;
- char *text;
- int length;
+void
+write_on_port(string name,
+ char *text,
+ int length)
{
port *p;
@@ -280,8 +281,8 @@ void write_on_port(name, text, length)
* occurs, $error is set to the error message.
*/
-void close_port_input(name)
- string name;
+void
+close_port_input(string name)
{
port_dictionary_binding *binding;
@@ -306,8 +307,8 @@ void close_port_input(name)
* occurs, $error is set to the error message.
*/
-void close_port_output(name)
- string name;
+void
+close_port_output(string name)
{
port_dictionary_binding *binding;
@@ -326,9 +327,9 @@ void close_port_output(name)
/* */
/****************************************************************************/
-static string get_file(p, error_p)
- port *p;
- char **error_p;
+static string
+get_file(port *p,
+ char **error_p)
{
char buffer[10000]; /* <<<>>> */
@@ -352,10 +353,10 @@ static string get_file(p, error_p)
return(string_Copy(buffer));
}
-static char *put_file(p, text, length)
- port *p;
- string text;
- int length;
+static char *
+put_file(port *p,
+ string text,
+ int length)
{
if (!p->data.file.output_connector)
return(NULL);
@@ -370,8 +371,8 @@ static char *put_file(p, text, length)
return(NULL);
}
-static char *close_file_input(p)
- port *p;
+static char *
+close_file_input(port *p)
{
errno = 0;
if (p->data.file.input_connector) {
@@ -385,8 +386,8 @@ static char *close_file_input(p)
return(NULL);
}
-static char *close_file_output(p)
- port *p;
+static char *
+close_file_output(port *p)
{
errno = 0;
if (p->data.file.output_connector) {
@@ -400,10 +401,9 @@ static char *close_file_output(p)
return(NULL);
}
-void create_port_from_files(name, input, output)
- string name;
- FILE *input;
- FILE *output;
+void create_port_from_files(string name,
+ FILE *input,
+ FILE *output)
{
port *p = create_named_port(name);
@@ -434,9 +434,9 @@ void create_port_from_files(name, input, output)
/* */
/****************************************************************************/
-void create_subprocess_port(name, argv)
- string name;
- char **argv;
+void
+create_subprocess_port(string name,
+ char **argv)
{
int pid;
int to_child_descriptors[2];
@@ -477,9 +477,9 @@ void create_subprocess_port(name, argv)
create_port_from_files(name, in, out);
}
-void create_file_append_port(name, filename)
- string name;
- string filename;
+void
+create_file_append_port(string name,
+ string filename)
{
FILE *out;
int oumask;
@@ -497,9 +497,9 @@ void create_file_append_port(name, filename)
create_port_from_files(name, 0, out);
}
-void create_file_input_port(name, filename)
- string name;
- string filename;
+void
+create_file_input_port(string name,
+ string filename)
{
FILE *in;
@@ -513,9 +513,9 @@ void create_file_input_port(name, filename)
create_port_from_files(name, in, 0);
}
-void create_file_output_port(name, filename)
- string name;
- string filename;
+void
+create_file_output_port(string name,
+ string filename)
{
FILE *out;
int oumask;
@@ -539,9 +539,9 @@ void create_file_output_port(name, filename)
/* */
/****************************************************************************/
-static string get_filter(p, error_p)
- port *p;
- char **error_p;
+static string
+get_filter(port *p,
+ char **error_p)
{
string result;
@@ -555,10 +555,10 @@ static string get_filter(p, error_p)
return(result);
}
-static char *put_filter(p, text, length)
- port *p;
- string text;
- int length;
+static char *
+put_filter(port *p,
+ string text,
+ int length)
{
string input;
string output;
@@ -573,8 +573,8 @@ static char *put_filter(p, text, length)
return(NULL);
}
-static char *close_filter_input(p)
- port *p;
+static char *
+close_filter_input(port *p)
{
while (!string_stack_empty(p->data.filter.waiting_packets))
string_stack_pop(p->data.filter.waiting_packets);
@@ -583,15 +583,15 @@ static char *close_filter_input(p)
}
/*ARGSUSED*/
-static char *close_filter_output(p)
- port *p;
+static char *
+close_filter_output(port *p)
{
return(NULL);
}
-void create_port_from_filter(name, filter)
- string name;
- string (*filter)();
+void
+create_port_from_filter(string name,
+ string (*filter)(string))
{
port *p = create_named_port(name);
@@ -610,10 +610,10 @@ void create_port_from_filter(name, filter)
/* */
/****************************************************************************/
-static char *put_output(p, text, length)
- port *p;
- string text;
- int length;
+static char *
+put_output(port *p,
+ string text,
+ int length)
{
string input;
char *error;
@@ -625,15 +625,15 @@ static char *put_output(p, text, length)
}
/*ARGSUSED*/
-static char *close_output(p)
- port *p;
+static char *
+close_output(port *p)
{
return(NULL);
}
-void create_port_from_output_proc(name, output)
- string name;
- char *(*output)();
+void
+create_port_from_output_proc(string name,
+ char *(*output)(string))
{
#ifdef SABER /* Yes, it's another ANSI incompatiblity */
port *p;