Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
eb037c92
Commit
eb037c92
authored
Aug 01, 1996
by
Per Cederqvist
Browse files
(prot_a_hunt_nl): New function.
parent
0e5cfc72
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/server/prot-a-parse.c
View file @
eb037c92
/*
* $Id: prot-a-parse.c,v 0.2
5
1996/0
7/28
1
3
:3
7:28
ceder Exp $
* $Id: prot-a-parse.c,v 0.2
6
1996/0
8/01
1
8
:3
2:02
ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
...
...
@@ -28,7 +28,7 @@
* BUG: Not all functions are used, I think. /ceder
*/
static
char
*
rcsid
=
"$Id: prot-a-parse.c,v 0.2
5
1996/0
7/28
1
3
:3
7:28
ceder Exp $"
;
static
char
*
rcsid
=
"$Id: prot-a-parse.c,v 0.2
6
1996/0
8/01
1
8
:3
2:02
ceder Exp $"
;
#include
"rcs.h"
USE
(
rcsid
);
...
...
@@ -485,3 +485,109 @@ void prot_a_parse_info(Connection *client,
client
->
struct_parse_pos
=
0
;
}
}
void
prot_a_hunt_nl
(
Connection
*
client
)
{
String_size
number_end
;
String_size
len
;
while
(
1
)
{
switch
(
client
->
fnc_parse_pos
)
{
case
0
:
/* whitspace/simple tokens */
if
(
client
->
first_to_parse
>=
s_strlen
(
client
->
unparsed
)
)
longjmp
(
parse_env
,
ISC_MSG_INCOMPLETE
);
switch
(
client
->
unparsed
.
string
[
client
->
first_to_parse
])
{
case
' '
:
case
'\r'
:
case
'\t'
:
case
'{'
:
case
'}'
:
case
'*'
:
client
->
first_to_parse
++
;
break
;
case
'\n'
:
/* We found a newline -- end of message. Return now. */
client
->
first_to_parse
++
;
return
;
case
'0'
:
case
'1'
:
case
'2'
:
case
'3'
:
case
'4'
:
case
'5'
:
case
'6'
:
case
'7'
:
case
'8'
:
case
'9'
:
/* Entering a number -- possibly a string. */
/* Don't increase first_to_parse. */
client
->
fnc_parse_pos
=
1
;
break
;
default:
longjmp
(
parse_env
,
ISC_PROTOCOL_ERR
);
}
break
;
case
1
:
/* number/string */
/* Entering a number. The first char is known to be a digit.
Parse the entire number at once. */
len
=
client
->
unparsed
.
string
[
client
->
first_to_parse
]
-
'0'
;
for
(
number_end
=
client
->
first_to_parse
+
1
;
number_end
<
s_strlen
(
client
->
unparsed
);
number_end
++
)
{
if
(
client
->
unparsed
.
string
[
number_end
]
>=
'0'
&&
client
->
unparsed
.
string
[
number_end
]
<=
'9'
)
{
len
=
10
*
len
+
client
->
unparsed
.
string
[
number_end
]
-
'0'
;
}
else
{
/* The end of the number was reached. */
break
;
}
}
if
(
number_end
==
s_strlen
(
client
->
unparsed
))
longjmp
(
parse_env
,
ISC_MSG_INCOMPLETE
);
if
(
client
->
unparsed
.
string
[
number_end
]
==
'H'
)
{
/* We are entering a string. Use num0 to store the
lenght of the string to skip. */
client
->
num0
=
len
;
client
->
first_to_parse
=
number_end
+
1
;
client
->
fnc_parse_pos
=
2
;
}
else
{
/* We have just skipped past a number that was not the
start of a string. */
client
->
first_to_parse
=
number_end
;
client
->
fnc_parse_pos
=
0
;
}
break
;
case
2
:
/* Skipping a string. */
if
(
client
->
num0
==
0
)
{
/* The entire string has been skipped. */
client
->
fnc_parse_pos
=
0
;
break
;
}
len
=
s_strlen
(
client
->
unparsed
)
-
client
->
first_to_parse
;
if
(
client
->
num0
<=
len
)
{
/* The entire string is present. Skip it. */
client
->
first_to_parse
+=
client
->
num0
;
client
->
fnc_parse_pos
=
0
;
break
;
}
else
{
/* Skip as much of the string as possible. */
client
->
num0
-=
len
;
client
->
first_to_parse
=
s_strlen
(
client
->
unparsed
);
longjmp
(
parse_env
,
ISC_MSG_INCOMPLETE
);
}
abort
();
default:
abort
();
}
}
}
src/server/prot-a-parse.h
View file @
eb037c92
/*
* $Id: prot-a-parse.h,v 0.1
1
1996/0
7/26 00:39:50
ceder Exp $
* $Id: prot-a-parse.h,v 0.1
2
1996/0
8/01 18:32:05
ceder Exp $
* Copyright (C) 1991, 1992, 1994, 1995 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
...
...
@@ -23,7 +23,7 @@
* Please mail bug reports to bug-lyskom@lysator.liu.se.
*/
/*
* $Id: prot-a-parse.h,v 0.1
1
1996/0
7/26 00:39:50
ceder Exp $
* $Id: prot-a-parse.h,v 0.1
2
1996/0
8/01 18:32:05
ceder Exp $
*
*/
extern
long
...
...
@@ -59,3 +59,6 @@ prot_a_parse_time_date(Connection *client,
extern
void
prot_a_parse_info
(
Connection
*
client
,
Info
*
info
);
extern
void
prot_a_hunt_nl
(
Connection
*
client
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment