mess822x
1.23
mess822x
Loading...
Searching...
No Matches
mess822x-1.23
src
b64encode.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 "b64encode"
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,
"b64encode [-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_b64urlencode
(&
out
,&
temp
);
35
else
r =
mess822_b64encode
(&
out
,&
temp
);
36
if
(r > 0) buffer_put(buffer_1,
out
.s,
out
.len);
37
buffer_put(buffer_1,
"\n"
,1);
38
buffer_flush(buffer_1);
39
40
_exit(0);
41
}
out
stralloc out
Definition:
b64encode.c:12
temp
stralloc temp
Definition:
b64encode.c:11
line
stralloc line
Definition:
b64encode.c:10
match
int match
Definition:
b64encode.c:13
WHO
#define WHO
Definition:
b64encode.c:8
main
int main()
Definition:
822print.c:351
mess822.h
mess822_b64urlencode
int mess822_b64urlencode(stralloc *, stralloc *)
Definition:
mess822_base64.c:130
mess822_b64encode
int mess822_b64encode(stralloc *, stralloc *)
Definition:
mess822_base64.c:74
flag
int flag
Definition:
822field.c:16
Generated on Mon Mar 3 2025 20:48:08 for mess822x by
1.9.6