Commit 358dfaa8 authored by David Byers's avatar David Byers
Browse files

(prot_a_parse_num_list): New function to pase num_list data

parent 4682186e
/* /*
* $Id: prot-a-parse.c,v 0.22 1996/06/09 13:54:43 byers Exp $ * $Id: prot-a-parse.c,v 0.23 1996/06/14 15:53:40 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association. * Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* BUG: Not all functions are used, I think. /ceder * BUG: Not all functions are used, I think. /ceder
*/ */
static char *rcsid = "$Id: prot-a-parse.c,v 0.22 1996/06/09 13:54:43 byers Exp $"; static char *rcsid = "$Id: prot-a-parse.c,v 0.23 1996/06/14 15:53:40 byers Exp $";
#include "rcs.h" #include "rcs.h"
USE(rcsid); USE(rcsid);
...@@ -40,10 +40,14 @@ USE(rcsid); ...@@ -40,10 +40,14 @@ USE(rcsid);
#ifdef HAVE_STDARG_H #ifdef HAVE_STDARG_H
# include <stdarg.h> # include <stdarg.h>
#endif #endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include "debug.h" #include "debug.h"
#include "s-string.h" #include "s-string.h"
#include "kom-types.h" #include "kom-types.h"
#include "server/smalloc.h"
#include "com.h" #include "com.h"
#include "connections.h" #include "connections.h"
#include "prot-a-parse.h" #include "prot-a-parse.h"
...@@ -100,6 +104,41 @@ prot_a_parse_long(Connection *client) ...@@ -100,6 +104,41 @@ prot_a_parse_long(Connection *client)
return res; return res;
} }
void
prot_a_parse_num_list(Connection *client,
Number_list *res)
{
String token;
token = prot_a_get_token(client);
if (client->array_parse_pos == 0)
{
res->length = atoi(token.string);
res->data = smalloc(sizeof(*res->data) * res->length);
client->array_parse_pos += 1;
}
if (client->array_parse_pos == 1) /* Ignore open-brace token or star */
{
token = prot_a_get_token(client); /* Ignore open-brace */
client->array_parse_pos += 1;
}
if (res->length == 0)
return;
while (client->array_parse_pos < res->length + 2)
{
token = prot_a_get_token(client);
res->data[client->array_parse_pos - 2] = atol(token.string);
client->array_parse_pos += 1;
}
token = prot_a_get_token(client); /* Ignore close-brace token */
}
void void
prot_a_parse_priv_bits(Connection *client, prot_a_parse_priv_bits(Connection *client,
Priv_bits *res) Priv_bits *res)
......
/* /*
* $Id: prot-a-parse.h,v 0.9 1996/06/09 13:54:45 byers Exp $ * $Id: prot-a-parse.h,v 0.10 1996/06/14 15:53:43 byers Exp $
* Copyright (C) 1991, 1992, 1994, 1995 Lysator Academic Computer Association. * Copyright (C) 1991, 1992, 1994, 1995 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -23,12 +23,16 @@ ...@@ -23,12 +23,16 @@
* Please mail bug reports to bug-lyskom@lysator.liu.se. * Please mail bug reports to bug-lyskom@lysator.liu.se.
*/ */
/* /*
* $Id: prot-a-parse.h,v 0.9 1996/06/09 13:54:45 byers Exp $ * $Id: prot-a-parse.h,v 0.10 1996/06/14 15:53:43 byers Exp $
* *
*/ */
extern long extern long
prot_a_parse_long(Connection *client); prot_a_parse_long(Connection *client);
extern void
prot_a_parse_num_list(Connection *client,
Number_list *res);
extern void extern void
prot_a_parse_priv_bits(Connection *client, prot_a_parse_priv_bits(Connection *client,
Priv_bits *result); Priv_bits *result);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment