Skip to content
GitLab
Menu
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
cbac3a88
Commit
cbac3a88
authored
Nov 15, 2002
by
Per Cederqvist
Browse files
(prot_a_parse_read_range): New static function.
(prot_a_parse_read_range_list): New function.
parent
2d730e61
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/server/prot-a-parse.c
View file @
cbac3a88
/*
* $Id: prot-a-parse.c,v 0.5
4
2002/1
0/21 08:5
4:5
3
ceder Exp $
* $Id: prot-a-parse.c,v 0.5
5
2002/1
1/15 17:1
4:5
0
ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
...
...
@@ -703,6 +703,89 @@ prot_a_parse_misc_info(Connection *client,
}
}
static
void
prot_a_parse_read_range
(
Connection
*
client
,
struct
read_range
*
result
)
{
switch
(
client
->
struct_parse_pos
)
{
case
0
:
result
->
first_read
=
prot_a_parse_long
(
client
);
client
->
struct_parse_pos
=
1
;
/* Fall through */
case
1
:
result
->
last_read
=
prot_a_parse_long
(
client
);
/* Fall through */
default:
client
->
struct_parse_pos
=
0
;
}
}
void
prot_a_parse_read_range_list
(
Connection
*
client
,
struct
read_range_list
*
res
,
int
maxlen
)
{
static
unsigned
long
err_cnt
=
0
;
struct
read_range
dummy_read_range
;
switch
(
client
->
array_parse_pos
)
{
case
0
:
if
((
res
->
length
!=
0
||
res
->
ranges
!=
NULL
)
&&
err_cnt
<
20
)
{
kom_log
(
"WNG: prot_a_parse_read_range_list():"
" len = %lu data = %lu
\n
"
,
(
unsigned
long
)
res
->
length
,
(
unsigned
long
)
res
->
ranges
);
res
->
length
=
0
;
res
->
ranges
=
NULL
;
if
(
++
err_cnt
==
20
)
kom_log
(
"The above warning is now turned off.
\n
"
);
}
client
->
array_parse_parsed_length
=
prot_a_parse_long
(
client
);
if
(
client
->
array_parse_parsed_length
<
0
)
{
isc_puts
(
"%%Insane array size.
\n
"
,
client
->
isc_session
);
isc_flush
(
client
->
isc_session
);
longjmp
(
parse_env
,
ISC_LOGOUT
);
}
client
->
array_parse_pos
=
1
;
/* Fall through */
case
1
:
if
(
parse_nonwhite_char
(
client
)
!=
'{'
)
longjmp
(
parse_env
,
ISC_PROTOCOL_ERR
);
res
->
length
=
min
(
maxlen
+
1
,
client
->
array_parse_parsed_length
);
res
->
ranges
=
smalloc
(
res
->
length
*
sizeof
(
struct
read_range
));
client
->
array_parse_index
=
0
;
client
->
array_parse_pos
=
2
;
case
2
:
while
(
client
->
array_parse_index
<
client
->
array_parse_parsed_length
)
{
/* Enter a parsed range into the list only if we
have parsed less than the no_of_misc of the list. */
if
(
client
->
array_parse_index
<
res
->
length
)
prot_a_parse_read_range
(
client
,
&
res
->
ranges
[
client
->
array_parse_index
]);
else
prot_a_parse_read_range
(
client
,
&
dummy_read_range
);
client
->
array_parse_index
+=
1
;
}
client
->
array_parse_pos
=
3
;
case
3
:
/* Read the closing brace */
if
(
parse_nonwhite_char
(
client
)
!=
'}'
)
longjmp
(
parse_env
,
ISC_PROTOCOL_ERR
);
default:
client
->
array_parse_pos
=
0
;
}
}
void
prot_a_parse_time_date
(
Connection
*
client
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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