Commit 2a5ee8e5 2a5ee8e518780c2f1c13e52e16845f4da7160e40 by Sergey Poznyakoff

Added to the repository

1 parent 4c9f40d5
AUTOMAKE_OPTIONS = ../lib/ansi2knr
noinst_PROGRAMS = addr url-parse sfrom mimetest muemail msg-send
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib
AM_LDFLAGS = ../mailbox/libmailbox.la ../lib/libmailutils.la
EXTRA_DIST = comsat.conf dot.biffrc gnu-imap4d.pam gnu-pop3d.pam\
mailutils.rc reply.scm
\ No newline at end of file
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* sfrom, Simple From */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <mailutils/mailutils.h>
int
main (int argc, const char **argv)
{
char *from;
char *subject;
mailbox_t mbox;
int status;
size_t msgno, total = 0;
/* Register the type of mailbox. IMAP4, POP3 and local format */
{
list_t registrar;
registrar_get_list (&registrar);
list_append (registrar, imap_record);
list_append (registrar, path_record);
list_append (registrar, pop_record);
}
status = mailbox_create_default (&mbox, argv[1]);
if (status != 0)
{
fprintf (stderr, "mailbox_create: %s\n", mu_errstring (status));
exit (EXIT_FAILURE);
}
status = mailbox_open (mbox, MU_STREAM_READ);
if (status != 0)
{
fprintf (stderr, "mailbox_open: %s\n", mu_errstring (status));
exit (EXIT_FAILURE);
}
mailbox_messages_count (mbox, &total);
for (msgno = 1; msgno <= total; msgno++)
{
message_t msg;
header_t hdr;
if ((status = mailbox_get_message (mbox, msgno, &msg)) != 0
|| (status = message_get_header (msg, &hdr)) != 0)
{
fprintf (stderr, "Error message: %s\n",
mu_errstring (status));
exit (EXIT_FAILURE);
}
if (header_aget_value (hdr, MU_HEADER_FROM, &from))
from = strdup ("(NO FROM)");
if (header_aget_value (hdr, MU_HEADER_SUBJECT, &subject))
subject = strdup("(NO SUBJECT)");
printf ("%s\t%s\n", from, subject);
free (from);
free (subject);
}
mailbox_close (mbox);
mailbox_destroy (&mbox);
return 0;
}
Makefile
Makefile.in
*.log
*.sum
site.exp
remote.exp
data
AUTOMAKE_OPTIONS = dejagnu
DEJATOOL = mailbox
RUNTESTFLAGS =
CLEANFILES = *.log
test_dirs = lib mailbox
EXTRA_DIST = Addrs Urls
dist-hook:
here=`cd $(top_builddir)/$(subdir) && pwd`; \
srcdir=`cd $(srcdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
for dir in $(test_dirs); \
do \
cd $$srcdir;\
mkdir $$distdir/$$dir;\
cd $$dir;\
for file in DISTFILES `cat DISTFILES`; do \
d=$$srcdir/$$dir; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $$distdir/$$dir/$$file; \
else \
test -f $$distdir/$$dir/$$file \
|| cp -p $$d/$$file $$distdir/$$dir/$$file || exit; \
fi; \
done;\
done;\
cd $$here
site.exp: Makefile remote.exp
@echo 'Making a new site.exp file...'
@test ! -f site.bak || rm -f site.bak
@echo '## these variables are automatically generated by make ##' > $@-t
@echo '# Do not edit here. If you wish to override these values' >> $@-t
@echo '# edit the last section' >> $@-t
@echo 'set tool $(DEJATOOL)' >> $@-t
@echo "set top_srcdir `cd $(top_srcdir); pwd`" >> $@-t
@echo "set top_builddir `cd $(top_builddir); pwd`" >> $@-t
@echo "set srcdir `cd $(srcdir); pwd`" >> $@-t
@echo 'set objdir' `pwd` >> $@-t
@echo 'set host_alias "$(host_alias)"' >> $@-t
@echo 'set host_triplet $(host_triplet)' >> $@-t
@echo 'set target_alias "$(target_alias)"' >> $@-t
@echo 'set target_triplet $(target_triplet)' >> $@-t
@echo 'set build_alias "$(build_alias)"' >> $@-t
@echo 'set build_triplet $(build_triplet)' >> $@-t
@echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
@test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
@test ! -f site.exp || mv site.exp site.bak
@mv $@-t site.exp
remote.exp:;
@echo 'Making a new remote.exp file...'
@test ! -f remote.bak || rm -f remote.bak
@echo '## These variables are used to set up for the remote testing.' >> $@-t
@echo '## Please, read file README in this directory for instructions' >> $@-t
@echo '## on how to use this file' >> $@-t
@echo "set host_board `hostname`" >> $@-t
@echo 'set board_info($$host_board,connect) rlogin' >> $@-t
@echo 'set board_info($$host_board,shell_prompt) "\\$$ "' >> $@-t
@echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
@echo "set board_info(\$$host_board,top_builddir) `cd $(top_builddir); pwd`" >> $@-t
@echo "set board_info(\$$host_board,srcdir) `cd $(srcdir); pwd`" >> $@-t
@echo "set board_info(\$$host_board,objdir) `pwd`" >> $@-t
@echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
@echo "set board_info(\$$host_board,top_builddir) `cd $(top_builddir); pwd`" >> $@-t
@test ! -f remote.exp || mv remote.exp remote.bak
@mv $@-t remote.exp
DISTCLEANFILES=*.exp *.log *.sum
distclean-local:
-rm -rf data
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# NOTE: Apart from this comment, the contents of this file is taken verbatim.
# Please be sure you don't add any extra newlines.
Message: 1
From: Foo Bar <foobar@nonexistent.net>
Subject: Jabberwocky
Number of parts in message - 1
Total message size - 1255
Type of part 1 =
Message part size - 1255
Text Message
Begin
`Twas brillig, and the slithy toves
Did gyre and gimble in the wabe;
All mimsy were the borogoves,
And the mome raths outgrabe.
`Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jujub bird, and shun
The frumious Bandersnatch!'
He took his vorpal sword in hand:
Long time the manxome foe he sought --
So rested he by the Tumtum gree,
And stood awhile in thought.
And as in uffish thought he stood,
The Jabberwock, with eyes of flame,
Came whiffling through the tulgey wook,
And burbled as it came!
One, two! One, two! And through and through
The vorpal blade went snicker-snack!
He left it dead, and with its head
He went galumphing back.
`And has thou slain the Jabberwock?
Come to my arms, my beamish boy!
O frabjous day! Calloh! Callay!
He chortled in his joy.
`Twas brillig, and the slithy toves
Did gyre and gimble in the wabe;
All mimsy were the borogoves,
And the mome raths outgrabe.
End
Message: 2
From: Bar <bar@dontmailme.org>
Subject: Re: Jabberwocky
Number of parts in message - 1
Total message size - 535
Type of part 1 =
Message part size - 535
Text Message
Begin
It seems very pretty, but it's *rather* hard to understand!'
Somehow it seems to fill my head with ideas -- only I don't
exactly know what they are! However, SOMEBODY killed SOMETHING:
that's clear, at any rate...
End
Message: 3
From: Sergey Poznyakoff <gray@Mirddin.farlep.net>
Subject: Simple MIME
Number of parts in message - 2
Total message size - 1626
Type of part 1 = text/plain; name="msg.1"; charset="us-ascii"
Message part size - 372
Text Message
Begin
How doth the little crocodile
Improve his shining tail,
And pour the waters of the Nile
On every golden scale!
`How cheerfully he seems to grin,
How neatly spread his claws,
And welcome little fishes in
With gently smiling jaws!
End
Type of part 2 = application/octet-stream; name="msg.21"
Message part size - 646
Attachment - saving [msg.21]
Begin
`You are old, Father William,' the young man said,
`And your hair has become very white;
And yet you incessantly stand on your head--
Do you think, at your age, it is right?'
`In my youth,' Father William replied to his son,
`I feared it might injure the brain;
But, now that I'm perfectly sure I have none,
Why, I do it again and again.'
End
Message: 4
From: Sergey Poznyakoff <gray@Mirddin.farlep.net>
Subject: Nested MIME
Number of parts in message - 2
Total message size - 3484
Type of part 1 = text/plain; name="msg.21"; charset="us-ascii"
Message part size - 497
Text Message
Begin
`You are old, Father William,' the young man said,
`And your hair has become very white;
And yet you incessantly stand on your head--
Do you think, at your age, it is right?'
`In my youth,' Father William replied to his son,
`I feared it might injure the brain;
But, now that I'm perfectly sure I have none,
Why, I do it again and again.'
End
Type of part 2 = multipart/mixed; boundary="----- =_aaaaaaaaaa1"
Message part size - 2379
Encapsulated message :
Begin
Type of part 1 = application/octet-stream; name="msg.22"
Message part size - 664
Attachment - saving [msg.22]
Begin
`You are old,' said the youth, `as I mentioned before,
And have grown most uncommonly fat;
Yet you turned a back-somersault in at the door--
Pray, what is the reason of that?'
`In my youth,' said the sage, as he shook his grey locks,
`I kept all my limbs very supple
By the use of this ointment--one shilling the box--
Allow me to sell you a couple?'
End
Type of part 2 = multipart/mixed; boundary="----- =_aaaaaaaaaa2"
Message part size - 1532
Encapsulated message :
Begin
Type of part 1 = application/octet-stream; name="msg.23"
Message part size - 669
Attachment - saving [msg.23]
Begin
`You are old,' said the youth, `and your jaws are too weak
For anything tougher than suet;
Yet you finished the goose, with the bones and the beak--
Pray how did you manage to do it?'
`In my youth,' said his father, `I took to the law,
And argued each case with my wife;
And the muscular strength, which it gave to my jaw,
Has lasted the rest of my life.'
End
Type of part 2 = application/octet-stream; name="msg.24"
Message part size - 680
Attachment - saving [msg.24]
Begin
`You are old,' said the youth, `one would hardly suppose
That your eye was as steady as ever;
Yet you balanced an eel on the end of your nose--
What made you so awfully clever?'
`I have answered three questions, and that is enough,'
Said his father; `don't give yourself airs!
Do you think I can listen all day to such stuff?
Be off, or I'll kick you down stairs!'
End
End
End
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
scheme: => SUCCESS
scheme <scheme>
user <>
passwd <>
auth <>
host <>
port 0
path <>
query <>
scheme:/absolute/path => SUCCESS
scheme <scheme>
user <>
passwd <>
auth <>
host <>
port 0
path </absolute/path>
query <>
scheme:relative/path => SUCCESS
scheme <scheme>
user <>
passwd <>
auth <>
host <>
port 0
path <relative/path>
query <>
scheme:///relative/path => SUCCESS
scheme <scheme>
user <>
passwd <>
auth <>
host <>
port 0
path <relative/path>
query <>
scheme:////absolute/path => SUCCESS
scheme <scheme>
user <>
passwd <>
auth <>
host <>
port 0
path </absolute/path>
query <>
scheme://%75%73%65%72:%70%61%73%73@%68%6f%73%74 => SUCCESS
scheme <scheme>
user <user>
passwd <pass>
auth <>
host <hest>
port 0
path <>
query <>
ftp://user:pass@host//a/path => SUCCESS
scheme <ftp>
user <user>
passwd <pass>
auth <>
host <host>
port 0
path </a/path>
query <>
ftp://:pass@host//a/path => SUCCESS
scheme <ftp>
user <>
passwd <pass>
auth <>
host <host>
port 0
path </a/path>
query <>
ftp://user:@host//a/path => SUCCESS
scheme <ftp>
user <user>
passwd <>
auth <>
host <host>
port 0
path </a/path>
query <>
ftp://user:pass@//a/path => SUCCESS
scheme <ftp>
user <user>
passwd <pass>
auth <>
host <>
port 0
path </a/path>
query <>
ftp://user:@//a/path => SUCCESS
scheme <ftp>
user <user>
passwd <>
auth <>
host <>
port 0
path </a/path>
query <>
ftp://:@host//a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <host>
port 0
path </a/path>
query <>
ftp://:pass@//a/path => SUCCESS
scheme <ftp>
user <>
passwd <pass>
auth <>
host <>
port 0
path </a/path>
query <>
ftp://:@//a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <>
port 0
path </a/path>
query <>
ftp://://a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <>
port 0
path </a/path>
query <>
ftp://@//a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <>
port 0
path </a/path>
query <>
ftp:////a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <>
port 0
path </a/path>
query <>
ftp://user:pass@host/a/path => SUCCESS
scheme <ftp>
user <user>
passwd <pass>
auth <>
host <host>
port 0
path <a/path>
query <>
ftp://:pass@host/a/path => SUCCESS
scheme <ftp>
user <>
passwd <pass>
auth <>
host <host>
port 0
path <a/path>
query <>
ftp://user:@host/a/path => SUCCESS
scheme <ftp>
user <user>
passwd <>
auth <>
host <host>
port 0
path <a/path>
query <>
ftp://user:pass@/a/path => SUCCESS
scheme <ftp>
user <user>
passwd <pass>
auth <>
host <>
port 0
path <a/path>
query <>
ftp://user:@/a/path => SUCCESS
scheme <ftp>
user <user>
passwd <>
auth <>
host <>
port 0
path <a/path>
query <>
ftp://:@host/a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <host>
port 0
path <a/path>
query <>
ftp://:pass@/a/path => SUCCESS
scheme <ftp>
user <>
passwd <pass>
auth <>
host <>
port 0
path <a/path>
query <>
ftp://:@/a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <>
port 0
path <a/path>
query <>
ftp://:/a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <>
port 0
path <a/path>
query <>
ftp://@/a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <>
port 0
path <a/path>
query <>
ftp:///a/path => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <>
port 0
path <a/path>
query <>
pop://pop.example.net => SUCCESS
scheme <pop>
user <>
passwd <>
auth <>
host <pop.example.net>
port 0
path <>
query <>
pop://user@pop.example.net => SUCCESS
scheme <pop>
user <user>
passwd <>
auth <>
host <pop.example.net>
port 0
path <>
query <>
pop://user:passwd@pop.example.net => SUCCESS
scheme <pop>
user <user>
passwd <passwd>
auth <>
host <pop.example.net>
port 0
path <>
query <>
pop://user;auth=*@pop.example.net => SUCCESS
scheme <pop>
user <user>
passwd <>
auth <*>
host <pop.example.net>
port 0
path <>
query <>
pop://pop.example.net:111 => SUCCESS
scheme <pop>
user <>
passwd <>
auth <>
host <pop.example.net>
port 111
path <>
query <>
pop://user@pop.example.net:111 => SUCCESS
scheme <pop>
user <user>
passwd <>
auth <>
host <pop.example.net>
port 111
path <>
query <>
pop://user:passwd@pop.example.net:111 => SUCCESS
scheme <pop>
user <user>
passwd <passwd>
auth <>
host <pop.example.net>
port 111
path <>
query <>
pop://user;auth=*@pop.example.net:111 => SUCCESS
scheme <pop>
user <user>
passwd <>
auth <*>
host <pop.example.net>
port 111
path <>
query <>
imap://imap.example.net => SUCCESS
scheme <imap>
user <>
passwd <>
auth <>
host <imap.example.net>
port 0
path <>
query <>
imap://user@imap.example.net => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <>
host <imap.example.net>
port 0
path <>
query <>
imap://user:passwd@imap.example.net => SUCCESS
scheme <imap>
user <user>
passwd <passwd>
auth <>
host <imap.example.net>
port 0
path <>
query <>
imap://user;auth=*@imap.example.net => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <*>
host <imap.example.net>
port 0
path <>
query <>
imap://imap.example.net:111 => SUCCESS
scheme <imap>
user <>
passwd <>
auth <>
host <imap.example.net>
port 111
path <>
query <>
imap://user@imap.example.net:111 => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <>
host <imap.example.net>
port 111
path <>
query <>
imap://user:passwd@imap.example.net:111 => SUCCESS
scheme <imap>
user <user>
passwd <passwd>
auth <>
host <imap.example.net>
port 111
path <>
query <>
imap://user;auth=*@imap.example.net:111 => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <*>
host <imap.example.net>
port 111
path <>
query <>
imap://imap.example.net/mbox => SUCCESS
scheme <imap>
user <>
passwd <>
auth <>
host <imap.example.net>
port 0
path <mbox>
query <>
imap://user@imap.example.net/mbox => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <>
host <imap.example.net>
port 0
path <mbox>
query <>
imap://user:passwd@imap.example.net/mbox => SUCCESS
scheme <imap>
user <user>
passwd <passwd>
auth <>
host <imap.example.net>
port 0
path <mbox>
query <>
imap://user;auth=*@imap.example.net/mbox => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <*>
host <imap.example.net>
port 0
path <mbox>
query <>
imap://imap.example.net:111/mbox => SUCCESS
scheme <imap>
user <>
passwd <>
auth <>
host <imap.example.net>
port 111
path <mbox>
query <>
imap://user@imap.example.net:111/mbox => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <>
host <imap.example.net>
port 111
path <mbox>
query <>
imap://user:passwd@imap.example.net:111/mbox => SUCCESS
scheme <imap>
user <user>
passwd <passwd>
auth <>
host <imap.example.net>
port 111
path <mbox>
query <>
imap://user;auth=*@imap.example.net:111/mbox => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <*>
host <imap.example.net>
port 111
path <mbox>
query <>
imap://imap.example.net/mbox/user@host => SUCCESS
scheme <imap>
user <imap.example.net/mbox/user>
passwd <>
auth <>
host <host>
port 0
path <>
query <>
imap://user@imap.example.net/mbox/user@host => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <>
host <imap.example.net>
port 0
path <mbox/user@host>
query <>
imap://user:passwd@imap.example.net/mbox/user@host => SUCCESS
scheme <imap>
user <user>
passwd <passwd>
auth <>
host <imap.example.net>
port 0
path <mbox/user@host>
query <>
imap://user;auth=*@imap.example.net/mbox/user@host => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <*>
host <imap.example.net>
port 0
path <mbox/user@host>
query <>
imap://imap.example.net:111/mbox/user@host => SUCCESS
scheme <imap>
user <imap.example.net>
passwd <111/mbox/user>
auth <>
host <host>
port 0
path <>
query <>
imap://user@imap.example.net:111/mbox/user@host => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <>
host <imap.example.net>
port 111
path <mbox/user@host>
query <>
imap://user:passwd@imap.example.net:111/mbox/user@host => SUCCESS
scheme <imap>
user <user>
passwd <passwd>
auth <>
host <imap.example.net>
port 111
path <mbox/user@host>
query <>
imap://user;auth=*@imap.example.net:111/mbox/user@host => SUCCESS
scheme <imap>
user <user>
passwd <>
auth <*>
host <imap.example.net>
port 111
path <mbox/user@host>
query <>
ftp://ftp.example.org/mbox/user%40host => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <ftp.example.org>
port 0
path <mbox/user@host>
query <>
ftp://ftp.example.org:111/mbox/user%40host => SUCCESS
scheme <ftp>
user <>
passwd <>
auth <>
host <ftp.example.org>
port 111
path <mbox/user@host>
query <>
# NOTE: This file must end with an empty line
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
source $top_srcdir/testsuite/lib/mailutils.exp
mu_init
proc mailbox_run {args} {
global verbose
global expect_out
set sw ""
for {set i 0} {$i < [llength $args]} {incr i} {
set a [lindex $args $i]
if {"$a" == "-mail-spool"} {
if [info exists host_board] {
if [board_info $host_board exists top_srcdir] {
append sw "--mail-spool [board_info $host_board top_srcdir]/mail/testsuite/spool"
}
}
if {![info exists init_spool]} {
set init_spool 1
}
} elseif {"$a" == "-reuse-spool"} {
set init_spool 0
} else {
break
}
}
if [info exists init_spool] {
mu_prepare_spools
}
set args "[lrange $args $i end] $sw"
verbose "Spawning $args"
set res [remote_spawn host $args]
if { $res < 0 || $res == "" } {
perror "Spawning $args failed."
return 1;
}
return 0
}
proc mailbox_send { string } {
return [mu_send "$string"]
}
# mailbox_test [-message MESSAGE][-default (FAIL|XFAIL)]
# COMMAND [-pattern PATTERN-LIST][PATTERN...]
# COMMAND - Command to send.
# PATTERN - Sequence to expect in return.
# MESSAGE - [optional] message to output
proc mailbox_test { args } {
global verbose
global suppress_flag;
upvar timeout timeout
set default ""
set message ""
for {set i 0} {$i < [llength $args]} {incr i} {
set a [lindex $args $i]
if {"$a" == "-default"} {
incr i
set default [lindex $args $i]
} elseif {"$a" == "-message"} {
incr i
set message [lindex $args $i]
} elseif {"$a" == "-pattern"} {
incr i
set pattern [lindex $args $i]
} else {
set args [lrange $args $i end]
break
}
}
if {"$message" == ""} {
set message [lindex $args 0]
}
if $verbose>2 then {
send_user "Message is \"$message\"\n"
}
set command [lindex $args 0]
if {[llength $args] >= 2} {
set pattern [lrange $args 1 end]
}
if [info exists pattern] {
set result [mu_test $command $pattern]
} else {
set result [mu_test $command]
}
if {$result == 0} {
pass "$message"
} elseif {$result == 1} {
if { "$default" == "" || "$default" != "FAIL" } {
fail "$message"
} else {
xfail "$message"
set result 0
}
} elseif {$result == -2} {
fail "$message (timeout)"
} elseif {$result == -3} {
fail "$message (eof)"
} else {
fail "$message"
}
return $result
}
address.exp
mime.exp
url.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
mailbox_run ${top_builddir}/examples/addr
set chan [open ${objdir}/Addrs r]
set command ""
for {gets $chan line} {![eof $chan]} {gets $chan line} {
switch -regexp -- "$line" {
"^#.*" { }
"^[^ \t].*=>.*" {
regexp "(.*)=>.*" $line dummy command
set pattern [list $line]
}
"^\$" {
if {$command != ""} {
mailbox_test -pattern $pattern $command
set command ""
}
}
default {
if [info exist pattern] {
set pattern [concat $pattern [list $line]]
}
}
}
}
close $chan
# end of address.exp
\ No newline at end of file
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
set MU_TOOL "${top_builddir}/examples/mimetest"
set MU_TOOL_FLAGS "-i 0 -p $MU_SPOOL_DIR/mbox1"
mu_prepare_spools
set chan [open ${objdir}/Mime r]
set pattern [list]
for {gets $chan line} {![eof $chan]} {gets $chan line} {
switch -regexp -- "$line" {
"^#.*" { }
default { set pattern [concat $pattern [list $line]] }
}
}
mu_exec -retcode 0 -message "MIME" -pattern $pattern
close $chan
# end of mime.exp
\ No newline at end of file
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
mailbox_run ${top_builddir}/examples/url-parse
set chan [open ${objdir}/Urls r]
set command ""
for {gets $chan line} {![eof $chan]} {gets $chan line} {
verbose "LINE: $line"
switch -regexp -- "$line" {
"^#.*" { }
"^[^ \t].*=>.*" {
regexp "(.*\[^ \t\])\[ \t\]*=>.*" $line dummy command
verbose "COMMAND: \"$command\""
set pattern [list $line]
}
"^\$" {
if {$command != ""} {
mailbox_test -pattern $pattern $command
set command ""
}
}
default {
set pattern [concat $pattern [list $line]]
}
}
}
close $chan
# end of url.exp
\ No newline at end of file