[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: template library or mailbox library for C
From: |
Andraž 'ruskie' Levstik |
Subject: |
Re: template library or mailbox library for C |
Date: |
Mon, 15 Oct 2007 20:43:26 +0200 |
On 20:24:56 2007-10-15 "Pawel Kot" <address@hidden> wrote:
> Hi,
>
> Is there any good text template library for C? To be clear, I mean
> library that would help me in the following situation:
>
> I want to output (or rather return as char *) an SMS as an email in
> mbox format. Straightforward way is:
>
> sprintf(tmp, "From address@hidden %s", number, date);
> strcat(buf, tmp);
> sprintf(tmp, "From: address@hidden", number);
> strcat(buf, tmp);
> ...
>
> And all the ugly stuff wrt allocating memory.
>
> Other solution I could think of is:
> #define MAIL_TEMPLATE \
> "From address@hidden %s" \
> "From: address@hidden" \
> ....
> sprintf(buf, MAIL_TEMPLATE, number, date, number, ...);
>
> That's still ugly but somehow better. And allocating stuff is not that
> bad.
>
> Is there any library that would allow me to create such email in an
> easy way? Or more generic solution that would allow me to define a
> template:
> #define MAIL_TEMPLATE \
> "From address@hidden %date%" \
> "From: address@hidden" \
>
> replace(buf, MAIL_TEMPLATE, number, date, ...);
> that would do everything for me?
>
Might try libetpan
http://libetpan.sourceforge.net
--
Andraž "ruskie" Levstik
Source Mage GNU/Linux Games grimoire guru
Geek/Hacker/Tinker
Be sure brain is in gear before engaging mouth.
Key id = F4C1F89C
Key fingerprint = 6FF2 8F20 4C9D DB36 B5B6 F134 884D 72CC F4C1 F89C