aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@inria.fr>1999-05-31 05:56:11 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-05-31 05:56:11 +0800
commit1c1106598f9162efbbc6df7622c93b02940a4743 (patch)
tree16eb3c8ca5c509446fd983032c5df66f64a4b178 /tests
parentb3cdb41a122e797572b834fac6d5e11ddd579d5e (diff)
downloadgsoc2013-evolution-1c1106598f9162efbbc6df7622c93b02940a4743.tar.gz
gsoc2013-evolution-1c1106598f9162efbbc6df7622c93b02940a4743.tar.zst
gsoc2013-evolution-1c1106598f9162efbbc6df7622c93b02940a4743.zip
use new stream code instead of raw file * stuff.
1999-05-31 bertrand <Bertrand.Guiheneuf@inria.fr> * tests/test2.c (main): use new stream code instead of raw file * stuff. * camel/gmime-utils.c (get_header_table_from_stream): new func. Will replace get_header_table_from_file and will be used to parse headers from files as well as from memory buffers. * camel/camel-stream-fs.c: CamelStream Subclass. File system based stream. svn path=/trunk/; revision=961
Diffstat (limited to 'tests')
-rw-r--r--tests/test2.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/test2.c b/tests/test2.c
index 91e2fa0f2d..e79c5b79d3 100644
--- a/tests/test2.c
+++ b/tests/test2.c
@@ -6,6 +6,7 @@
#include "camel-mime-message.h"
#include "camel-mime-part.h"
#include "camel-stream.h"
+#include "camel-stream-fs.h"
void print_header_pair (gpointer key, gpointer value, gpointer user_data)
{
@@ -29,7 +30,6 @@ void print_header_pair (gpointer key, gpointer value, gpointer user_data)
void
main (int argc, char**argv)
{
- FILE *input_file;
FILE *output_file;
GHashTable *header_table;
CamelMimeMessage *message;
@@ -39,19 +39,20 @@ main (int argc, char**argv)
camel_debug_level = FULL_DEBUG;
message = camel_mime_message_new_with_session( (CamelSession *)NULL);
- input_file = fopen ("mail.test", "r");
- /*stream = gnome_stream_fs_open (NULL, "mail.test", GNOME_Storage_READ);*/
- if (!input_file) {
+ /* input_file = fopen ("mail.test", "r"); */
+ stream = camel_stream_fs_new_with_name (g_string_new ("mail.test"), CAMEL_STREAM_FS_READ);
+ if (!stream) {
perror("could not open input file");
exit(2);
}
- header_table = get_header_table_from_file (input_file);
+ //header_table = get_header_table_from_file (input_file);
+ header_table = get_header_table_from_stream (stream);
if (header_table) g_hash_table_foreach (header_table, print_header_pair, (gpointer)message);
else printf("header is empty, no header line present\n");
- fclose (input_file);
+ camel_stream_close (stream);
output_file = fopen ("mail2.test", "w");
if (!output_file) {