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
503487da
...
503487da9f8d0cd3d986e91b4039e46c0bd73fab
authored
2000-01-21 05:10:40 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
from.c
support for headers.
1 parent
be7da7a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
from/from.c
from/from.c
View file @
503487d
...
...
@@ -17,7 +17,7 @@
/**
*
* Created as an example
of using libmailbox
* Created as an example
for using mailutils API
* Sean 'Shaleh' Perry <shaleh@debian.org>, 1999
* Alain Magloire alainm@gnu.org
*
...
...
@@ -27,7 +27,6 @@
# include <config.h>
#endif
#include <mailbox.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -38,12 +37,17 @@
# include <paths.h>
#endif
#include <paths.h>
#include <mailbox.h>
#include <header.h>
#ifndef _PATH_MAILDIR
# define _PATH_MAILDIR "/var/spool/mail"
#endif
#ifndef VERSION
# define VERSION "unknow
n
"
# define VERSION "unknow"
#endif
#include "getopt.h"
...
...
@@ -136,6 +140,8 @@ main(int argc, char *argv[])
char
*
mailbox_name
=
NULL
;
int
opt
;
char
buffer
[
BUFSIZ
];
char
from
[
BUFSIZ
];
char
subject
[
BUFSIZ
];
/* set program name */
program
=
argv
[
0
];
...
...
@@ -189,14 +195,14 @@ main(int argc, char *argv[])
exit
(
0
);
break
;
default:
usage
(
2
);
exit
(
1
);
//
usage (2);
//
exit (1);
break
;
}
}
/* have an argument */
if
(
optind
>
0
)
if
(
optind
>
argc
)
{
mailbox_name
=
argv
[
optind
];
/* is it a URL */
...
...
@@ -242,7 +248,11 @@ main(int argc, char *argv[])
fprintf
(
stderr
,
"header %s
\n
"
,
strerror
(
rvalue
));
exit
(
2
);
}
printf
(
"%s
\n
"
,
buffer
);
header_gvalue
(
buffer
,
size
,
MU_HDR_FROM
,
from
,
sizeof
(
from
),
NULL
);
header_gvalue
(
buffer
,
size
,
MU_HDR_SUBJECT
,
subject
,
sizeof
(
subject
),
NULL
);
printf
(
"%s %s
\n
"
,
from
,
subject
);
}
mailbox_close
(
mbox
);
mailbox_destroy
(
&
mbox
);
...
...
Please
register
or
sign in
to post a comment