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
19be4447
...
19be4447de8711a0480455d2bd5f902813b4db10
authored
2002-09-10 12:03:42 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Upgrade to guile 1.6.0
1 parent
59e7b2d4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
38 deletions
libmu_scm/mu_address.c
libmu_scm/mu_body.c
libmu_scm/mu_guimb.c
libmu_scm/mu_logger.c
libmu_scm/mu_mailbox.c
libmu_scm/mu_message.c
libmu_scm/mu_scm.c
libmu_scm/mu_scm.h
libmu_scm/mu_address.c
View file @
19be444
...
...
@@ -41,12 +41,12 @@ _get_address_part (const char *func_name, address_get_fp fun,
else
num
=
1
;
str
=
SCM_CHARS
(
ADDRESS
);
str
=
SCM_
STRING_
CHARS
(
ADDRESS
);
length
=
strlen
(
str
);
if
(
length
==
0
)
return
scm_makfrom0str
(
""
);
if
(
address_create
(
&
addr
,
SCM_CHARS
(
ADDRESS
)))
if
(
address_create
(
&
addr
,
SCM_
STRING_
CHARS
(
ADDRESS
)))
return
SCM_BOOL_F
;
str
=
malloc
(
length
+
1
);
...
...
@@ -126,7 +126,7 @@ SCM_DEFINE (mu_address_get_count, "mu-address-get-count", 1, 0, 0,
SCM_ASSERT
(
SCM_NIMP
(
ADDRESS
)
&&
SCM_STRINGP
(
ADDRESS
),
ADDRESS
,
SCM_ARG1
,
FUNC_NAME
);
if
(
address_create
(
&
addr
,
SCM_CHARS
(
ADDRESS
)))
if
(
address_create
(
&
addr
,
SCM_
STRING_
CHARS
(
ADDRESS
)))
return
SCM_MAKINUM
(
0
);
address_get_count
(
addr
,
&
count
);
...
...
@@ -150,7 +150,7 @@ SCM_DEFINE (mu_username_to_email, "mu-username->email", 0, 1, 0,
else
{
SCM_ASSERT
(
SCM_NIMP
(
NAME
)
&&
SCM_STRINGP
(
NAME
),
NAME
,
SCM_ARG1
,
FUNC_NAME
);
name
=
SCM_CHARS
(
NAME
);
name
=
SCM_
STRING_
CHARS
(
NAME
);
}
email
=
mu_get_user_email
(
name
);
...
...
libmu_scm/mu_body.c
View file @
19be444
...
...
@@ -174,7 +174,7 @@ SCM_DEFINE (mu_body_write, "mu-body-write", 2, 0, 0,
return
SCM_BOOL_F
;
}
ptr
=
SCM_CHARS
(
TEXT
);
ptr
=
SCM_
STRING_
CHARS
(
TEXT
);
len
=
strlen
(
ptr
);
if
(
stream_write
(
mbp
->
stream
,
ptr
,
len
,
mbp
->
offset
,
&
n
))
{
...
...
libmu_scm/mu_guimb.c
View file @
19be444
...
...
@@ -56,13 +56,11 @@ _scheme_main (void *closure, int argc, char **argv)
#include <mu_guimb.x>
_current_mailbox
=
mu_scm_mailbox_create
(
param
->
mbox
);
scm_loc
=
SCM_CDRLOC
(
scm_sysintern
(
"current-mailbox"
,
SCM_EOL
));
*
scm_loc
=
_current_mailbox
;
mu_set_variable
(
"current-mailbox"
,
_current_mailbox
);
_user_name
=
param
->
user_name
?
scm_makfrom0str
(
param
->
user_name
)
:
SCM_BOOL_F
;
scm_loc
=
SCM_CDRLOC
(
scm_sysintern
(
"user-name"
,
SCM_EOL
));
*
scm_loc
=
_user_name
;
mu_set_variable
(
"user-name"
,
_user_name
);
if
(
param
->
init
)
param
->
init
(
param
->
data
);
...
...
libmu_scm/mu_logger.c
View file @
19be444
...
...
@@ -33,20 +33,20 @@ SCM_DEFINE(mu_openlog, "mu-openlog", 3, 0, 0,
{
SCM_ASSERT
(
SCM_NIMP
(
IDENT
)
&&
SCM_STRINGP
(
IDENT
),
IDENT
,
SCM_ARG1
,
FUNC_NAME
);
ident
=
SCM_CHARS
(
IDENT
);
ident
=
SCM_
STRING_
CHARS
(
IDENT
);
}
if
(
SCM_IMP
(
OPTION
)
&&
SCM_INUMP
(
OPTION
))
option
=
SCM_INUM
(
OPTION
);
else
if
(
SCM_BIGP
(
OPTION
))
option
=
(
int
)
scm_big2dbl
(
OPTION
);
option
=
(
int
)
scm_
i_
big2dbl
(
OPTION
);
else
SCM_ASSERT
(
0
,
OPTION
,
SCM_ARG2
,
FUNC_NAME
);
if
(
SCM_IMP
(
FACILITY
)
&&
SCM_INUMP
(
FACILITY
))
facility
=
SCM_INUM
(
FACILITY
);
else
if
(
SCM_BIGP
(
FACILITY
))
facility
=
(
int
)
scm_big2dbl
(
FACILITY
);
facility
=
(
int
)
scm_
i_
big2dbl
(
FACILITY
);
else
SCM_ASSERT
(
0
,
FACILITY
,
SCM_ARG3
,
FUNC_NAME
);
...
...
@@ -67,13 +67,13 @@ SCM_DEFINE (mu_logger, "mu-logger", 2, 0, 0,
else
if
(
SCM_IMP
(
PRIO
)
&&
SCM_INUMP
(
PRIO
))
prio
=
SCM_INUM
(
PRIO
);
else
if
(
SCM_BIGP
(
PRIO
))
prio
=
(
int
)
scm_big2dbl
(
PRIO
);
prio
=
(
int
)
scm_
i_
big2dbl
(
PRIO
);
else
SCM_ASSERT
(
0
,
PRIO
,
SCM_ARG1
,
FUNC_NAME
);
SCM_ASSERT
(
SCM_NIMP
(
TEXT
)
&&
SCM_STRINGP
(
TEXT
),
TEXT
,
SCM_ARG2
,
FUNC_NAME
);
syslog
(
prio
,
"%s"
,
SCM_CHARS
(
TEXT
));
syslog
(
prio
,
"%s"
,
SCM_
STRING_
CHARS
(
TEXT
));
return
SCM_UNSPECIFIED
;
}
#undef FUNC_NAME
...
...
@@ -126,6 +126,6 @@ mu_scm_logger_init ()
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
syslog_kw
)
/
sizeof
(
syslog_kw
[
0
]);
i
++
)
scm_
sysintern
(
syslog_kw
[
i
].
name
,
SCM_MAKINUM
(
syslog_kw
[
i
].
facility
));
scm_
c_define
(
syslog_kw
[
i
].
name
,
SCM_MAKINUM
(
syslog_kw
[
i
].
facility
));
#include <mu_logger.x>
}
...
...
libmu_scm/mu_mailbox.c
View file @
19be444
...
...
@@ -117,7 +117,7 @@ SCM_DEFINE (mu_mailbox_open, "mu-mailbox-open", 2, 0, 0,
SCM_ASSERT
(
SCM_NIMP
(
MODE
)
&&
SCM_STRINGP
(
MODE
),
MODE
,
SCM_ARG2
,
FUNC_NAME
);
for
(
mode_str
=
SCM_CHARS
(
MODE
);
*
mode_str
;
mode_str
++
)
for
(
mode_str
=
SCM_
STRING_
CHARS
(
MODE
);
*
mode_str
;
mode_str
++
)
switch
(
*
mode_str
)
{
case
'r'
:
...
...
@@ -137,7 +137,7 @@ SCM_DEFINE (mu_mailbox_open, "mu-mailbox-open", 2, 0, 0,
if
(
mode
&
MU_STREAM_READ
&&
mode
&
MU_STREAM_WRITE
)
mode
=
(
mode
&
~
(
MU_STREAM_READ
|
MU_STREAM_WRITE
))
|
MU_STREAM_RDWR
;
if
(
mailbox_create_default
(
&
mbox
,
SCM_CHARS
(
URL
))
!=
0
)
if
(
mailbox_create_default
(
&
mbox
,
SCM_
STRING_
CHARS
(
URL
))
!=
0
)
return
SCM_BOOL_F
;
if
(
mailbox_open
(
mbox
,
mode
)
!=
0
)
...
...
@@ -197,7 +197,7 @@ SCM_DEFINE (mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0,
if
(
mailbox_get_stream
(
mum
->
mbox
,
&
stream
))
return
SCM_BOOL_F
;
return
mu_port_make_from_stream
(
MBOX
,
stream
,
scm_mode_bits
(
SCM_CHARS
(
MODE
)));
scm_mode_bits
(
SCM_
STRING_
CHARS
(
MODE
)));
}
#undef FUNC_NAME
...
...
libmu_scm/mu_message.c
View file @
19be444
...
...
@@ -272,7 +272,7 @@ SCM_DEFINE (mu_message_set_header, "mu-message-set-header", 3, 1, 0,
}
message_get_header
(
msg
,
&
hdr
);
header_set_value
(
hdr
,
SCM_
CHARS
(
HEADER
),
strdup
(
SCM
_CHARS
(
VALUE
)),
header_set_value
(
hdr
,
SCM_
STRING_CHARS
(
HEADER
),
strdup
(
SCM_STRING
_CHARS
(
VALUE
)),
replace
);
return
SCM_UNSPECIFIED
;
}
...
...
@@ -342,7 +342,7 @@ SCM_DEFINE (mu_message_get_header, "mu-message-get-header", 2, 0, 0,
msg
=
mu_scm_message_get
(
MESG
);
SCM_ASSERT
(
SCM_NIMP
(
HEADER
)
&&
SCM_STRINGP
(
HEADER
),
HEADER
,
SCM_ARG2
,
FUNC_NAME
);
header_string
=
SCM_CHARS
(
HEADER
);
header_string
=
SCM_
STRING_
CHARS
(
HEADER
);
message_get_header
(
msg
,
&
hdr
);
if
(
header_aget_value
(
hdr
,
header_string
,
&
value
)
==
0
)
{
...
...
@@ -360,7 +360,7 @@ string_sloppy_member (SCM lst, char *name)
{
SCM
car
=
SCM_CAR
(
lst
);
if
((
SCM_NIMP
(
car
)
&&
SCM_STRINGP
(
car
))
&&
strcasecmp
(
SCM_CHARS
(
car
),
name
)
==
0
)
&&
strcasecmp
(
SCM_
STRING_
CHARS
(
car
),
name
)
==
0
)
return
1
;
}
return
0
;
...
...
@@ -463,7 +463,7 @@ SCM_DEFINE (mu_message_set_header_fields, "mu-message-set-header-fields", 2, 1,
car
,
SCM_ARGn
,
FUNC_NAME
);
SCM_ASSERT
(
SCM_NIMP
(
cdr
)
&&
SCM_STRINGP
(
cdr
),
cdr
,
SCM_ARGn
,
FUNC_NAME
);
header_set_value
(
hdr
,
SCM_
CHARS
(
car
),
SCM
_CHARS
(
cdr
),
replace
);
header_set_value
(
hdr
,
SCM_
STRING_CHARS
(
car
),
SCM_STRING
_CHARS
(
cdr
),
replace
);
}
return
SCM_UNDEFINED
;
}
...
...
@@ -710,7 +710,7 @@ SCM_DEFINE (mu_message_get_port, "mu-message-get-port", 2, 1, 0,
}
return
mu_port_make_from_stream
(
MESG
,
stream
,
scm_mode_bits
(
SCM_CHARS
(
MODE
)));
scm_mode_bits
(
SCM_
STRING_
CHARS
(
MODE
)));
}
#undef FUNC_NAME
...
...
@@ -810,22 +810,22 @@ SCM_DEFINE (mu_message_send, "mu-message-send", 1, 3, 0,
{
SCM_ASSERT
(
SCM_NIMP
(
MAILER
)
&&
SCM_STRINGP
(
MAILER
),
MAILER
,
SCM_ARG2
,
FUNC_NAME
);
mailer_name
=
SCM_CHARS
(
MAILER
);
mailer_name
=
SCM_
STRING_
CHARS
(
MAILER
);
}
else
mailer_name
=
SCM_CHARS
(
_mu_scm_mailer
);
mailer_name
=
SCM_
STRING_
CHARS
(
_mu_scm_mailer
);
if
(
!
SCM_UNBNDP
(
FROM
)
&&
FROM
!=
SCM_BOOL_F
)
{
SCM_ASSERT
(
SCM_NIMP
(
FROM
)
&&
SCM_STRINGP
(
FROM
)
&&
address_create
(
&
from
,
SCM_CHARS
(
FROM
))
==
0
,
&&
address_create
(
&
from
,
SCM_
STRING_
CHARS
(
FROM
))
==
0
,
FROM
,
SCM_ARG3
,
FUNC_NAME
);
}
if
(
!
SCM_UNBNDP
(
TO
)
&&
TO
!=
SCM_BOOL_F
)
{
SCM_ASSERT
(
SCM_NIMP
(
TO
)
&&
SCM_STRINGP
(
TO
)
&&
address_create
(
&
to
,
SCM_CHARS
(
TO
))
==
0
,
&&
address_create
(
&
to
,
SCM_
STRING_
CHARS
(
TO
))
==
0
,
TO
,
SCM_ARG4
,
FUNC_NAME
);
}
...
...
libmu_scm/mu_scm.c
View file @
19be444
...
...
@@ -21,8 +21,9 @@
# define _PATH_SENDMAIL "/usr/lib/sendmail"
#endif
SCM
SCM
scm_makenum
(
unsigned
long
val
)
#ifndef HAVE_SCM_LONG2NUM
{
if
(
SCM_FIXABLE
((
long
)
val
))
return
SCM_MAKINUM
(
val
);
...
...
@@ -33,6 +34,22 @@ scm_makenum (unsigned long val)
return
scm_make_real
((
double
)
val
);
#endif
/* SCM_BIGDIG */
}
#else
{
return
scm_long2num
(
val
);
}
#endif
void
mu_set_variable
(
const
char
*
name
,
SCM
value
)
{
#if GUILE_VERSION == 14
scm_c_define
(
name
,
value
);
/*FIXME*/
#else
scm_c_define
(
name
,
value
);
#endif
}
SCM
_mu_scm_package
;
/* STRING: PACKAGE */
SCM
_mu_scm_version
;
/* STRING: VERSION */
...
...
@@ -60,30 +77,25 @@ static struct
void
mu_scm_init
()
{
SCM
*
scm_loc
;
char
*
defmailer
;
int
i
;
asprintf
(
&
defmailer
,
"sendmail:%s"
,
_PATH_SENDMAIL
);
_mu_scm_mailer
=
scm_makfrom0str
(
defmailer
);
scm_loc
=
SCM_CDRLOC
(
scm_sysintern
(
"mu-mailer"
,
SCM_EOL
));
*
scm_loc
=
_mu_scm_mailer
;
mu_set_variable
(
"mu-mailer"
,
_mu_scm_mailer
);
_mu_scm_debug
=
scm_makenum
(
0
);
scm_loc
=
SCM_CDRLOC
(
scm_sysintern
(
"mu-debug"
,
SCM_EOL
));
*
scm_loc
=
_mu_scm_debug
;
mu_set_variable
(
"mu-debug"
,
_mu_scm_debug
);
_mu_scm_package
=
scm_makfrom0str
(
PACKAGE
);
scm_loc
=
SCM_CDRLOC
(
scm_sysintern
(
"mu-package"
,
SCM_EOL
));
*
scm_loc
=
_mu_scm_package
;
mu_set_variable
(
"mu-package"
,
_mu_scm_package
);
_mu_scm_version
=
scm_makfrom0str
(
VERSION
);
scm_loc
=
SCM_CDRLOC
(
scm_sysintern
(
"mu-version"
,
SCM_EOL
));
*
scm_loc
=
_mu_scm_version
;
mu_set_variable
(
"mu-version"
,
_mu_scm_version
);
/* Create MU- attribute names */
for
(
i
=
0
;
attr_kw
[
i
].
name
;
i
++
)
scm_
sysintern
(
attr_kw
[
i
].
name
,
SCM_MAKINUM
(
attr_kw
[
i
].
value
));
scm_
c_define
(
attr_kw
[
i
].
name
,
SCM_MAKINUM
(
attr_kw
[
i
].
value
));
mu_scm_mutil_init
();
mu_scm_mailbox_init
();
...
...
libmu_scm/mu_scm.h
View file @
19be444
...
...
@@ -43,6 +43,23 @@
#include <libguile.h>
#if GUILE_VERSION == 14
# define SCM_STRING_CHARS SCM_CHARS
# define scm_list_1 SCM_LIST1
# define scm_list_2 SCM_LIST2
# define scm_list_3 SCM_LIST3
# define scm_list_4 SCM_LIST4
# define scm_list_5 SCM_LIST5
# define scm_list_n SCM_LISTN
# define scm_c_define scm_sysintern
# define scm_primitive_eval_x scm_eval_x
# define scm_i_big2dbl scm_big2dbl
extern
SCM
scm_long2num
(
long
val
);
#endif
typedef
struct
{
int
debug_guile
;
...
...
@@ -60,6 +77,7 @@ extern SCM _mu_scm_mailer;
extern
SCM
_mu_scm_debug
;
extern
SCM
scm_makenum
__P
((
unsigned
long
val
));
extern
void
mu_set_variable
(
const
char
*
name
,
SCM
value
);
extern
void
mu_scm_init
__P
((
void
));
extern
void
mu_scm_mailbox_init
__P
((
void
));
...
...
Please
register
or
sign in
to post a comment