mess822x
1.23
mess822x
Loading...
Searching...
No Matches
mess822x-1.23
src
b64decode.c
Go to the documentation of this file.
1
#include "buffer.h"
2
#include "logmsg.h"
3
#include "getln.h"
4
#include "
mess822.h
"
5
#include "exit.h"
6
#include "getoptb.h"
7
8
#define WHO "b64decode"
9
10
stralloc
line
= {0};
11
stralloc
temp
= {0};
12
stralloc
out
= {0};
13
int
match
;
14
15
int
main
(
int
argc,
char
**argv)
16
{
17
int
r;
18
int
opt;
19
int
flag
= 0;
20
21
while
((opt = getoptb(argc,argv,
"u"
)) != opteof)
22
switch
(opt) {
23
case
'u'
:
flag
= 4648;
break
;
24
default : logmsg(
WHO
,100,USAGE,
"b64decode [-u] (reading from STDIN)"
);
25
}
26
27
for
(;;) {
28
if
(getln(buffer_0,&
line
,&
match
,
'\n'
) == -1)
29
logmsg(
WHO
,111,FATAL,B(
"unable to read input: "
,
line
.s));
30
if
(!stralloc_cat(&
temp
,&
line
)) _exit(-1);
31
if
(!
match
)
break
;
32
}
33
34
if
(
flag
== 4648) r =
mess822_b64decode
(&
out
,
temp
.s,
temp
.len,4648);
35
else
r =
mess822_b64decode
(&
out
,
temp
.s,
temp
.len,1);
36
if
(r > 0) buffer_put(buffer_1,
out
.s,
out
.len);
37
buffer_flush(buffer_1);
38
39
_exit(0);
40
}
main
int main()
Definition:
822print.c:351
out
stralloc out
Definition:
b64decode.c:12
temp
stralloc temp
Definition:
b64decode.c:11
line
stralloc line
Definition:
b64decode.c:10
match
int match
Definition:
b64decode.c:13
WHO
#define WHO
Definition:
b64decode.c:8
mess822.h
mess822_b64decode
int mess822_b64decode(stralloc *, const char *, int, int)
Definition:
mess822_base64.c:30
flag
int flag
Definition:
822field.c:16
Generated on Mon Mar 3 2025 20:48:08 for mess822x by
1.9.6