Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
5b78b0db
...
5b78b0db0a66d5370b8f55cc676d2c431eb580a8
authored
2003-04-03 11:51:34 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Use custom ISPRINT macro so we don't depend on the current locale settings.
1 parent
86bcf5c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
examples/base64.c
examples/decode2047.c
examples/base64.c
View file @
5b78b0d
...
...
@@ -22,6 +22,8 @@
#include <string.h>
#include <mailutils/mailutils.h>
#define ISPRINT(c) ((c)>=' '&&(c)<127)
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -86,7 +88,7 @@ main (int argc, char * argv [])
while
(
stream_read
(
flt
,
&
buffer
,
sizeof
(
buffer
),
total
,
&
size
)
==
0
&&
size
>
0
)
{
if
(
printable
&&
!
isprint
(
buffer
))
if
(
printable
&&
!
ISPRINT
(
buffer
))
{
char
outbuf
[
24
];
sprintf
(
outbuf
,
"
\\
%03o"
,
(
unsigned
int
)
buffer
);
...
...
examples/decode2047.c
View file @
5b78b0d
...
...
@@ -22,12 +22,14 @@
#include <mailutils/mailutils.h>
#define ISPRINT(c) ((c)=='\t'||(c)==' '||(c)=='\n'||((c)>' '&&(c)<128))
void
print
(
char
*
p
,
int
printable
)
{
for
(;
*
p
;
p
++
)
{
if
(
printable
&&
*
p
!=
'\n'
&&
!
isprint
(
*
p
))
if
(
printable
&&
*
p
!=
'\n'
&&
!
ISPRINT
(
*
p
))
printf
(
"
\\
%03o"
,
*
(
unsigned
char
*
)
p
);
else
putchar
(
*
p
);
...
...
Please
register
or
sign in
to post a comment