s/qmail
4.3.21
Next generation secure email transport
Loading...
Searching...
No Matches
4.3
sqmail-4.3.21
src
commands.c
Go to the documentation of this file.
1
#include "
commands.h
"
2
#include "buffer.h"
3
#include "stralloc.h"
4
#include "str.h"
5
#include "case.h"
6
7
static
stralloc cmd = {0};
8
9
int
commands
(buffer *
b
,
struct
commands
*c)
10
{
11
int
i;
12
char
*arg;
13
14
for
(;;) {
15
if
(!
stralloc_copys
(&cmd,
""
))
return
-1;
16
17
for
(;;) {
18
if
(!stralloc_readyplus(&cmd,1))
return
-1;
19
i = buffer_get(
b
,cmd.s + cmd.len,1);
20
if
(i != 1)
return
i;
21
if
(cmd.s[cmd.len] ==
'\n'
)
break
;
22
++cmd.len;
23
}
24
25
if
(cmd.len > 0)
if
(cmd.s[cmd.len - 1] ==
'\r'
) --cmd.len;
26
27
cmd.s[cmd.len] = 0;
28
29
i = str_chr(cmd.s,
' '
);
30
arg = cmd.s + i;
31
while
(*arg ==
' '
) ++arg;
32
cmd.s[i] = 0;
33
34
for
(i = 0; c[i].text; ++i)
35
if
(case_equals(c[i].
text
,cmd.s))
break
;
36
37
c[i].fun(arg);
38
if
(c[i].
flush
) c[i].flush();
39
}
40
}
b
buffer b
Definition
auto-gid.c:10
commands
int commands(buffer *b, struct commands *c)
Definition
commands.c:9
commands.h
stralloc_copys
int stralloc_copys(stralloc *, char const *)
text
stralloc text
Definition
maildirwatch.c:21
flush
void flush(void)
Definition
qmail-smtpd.c:91
commands
Definition
commands.h:5
Generated on
for s/qmail by
1.14.0