diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-09-25 04:01:20 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-09-25 04:01:20 +0800 |
commit | 3a50fb41b5f51828b5a90243b7170d70e93292dd (patch) | |
tree | 7bca0549a387d8101df42509f3253397976a0190 /composer/e-msg-composer.c | |
parent | fb1cdc02878ea1c6a37671fc326145f8a20ded81 (diff) | |
download | gsoc2013-evolution-3a50fb41b5f51828b5a90243b7170d70e93292dd.tar.gz gsoc2013-evolution-3a50fb41b5f51828b5a90243b7170d70e93292dd.tar.zst gsoc2013-evolution-3a50fb41b5f51828b5a90243b7170d70e93292dd.zip |
Updated to handle FIFO streams.
2000-09-24 Jeffrey Stedfast <fejj@helixcode.com>
* e-msg-composer.c (get_signature): Updated to handle FIFO
streams.
svn path=/trunk/; revision=5563
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r-- | composer/e-msg-composer.c | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 799a4a3180..2e86bf85ed 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -313,50 +313,37 @@ build_message (EMsgComposer *composer) static char * get_signature (const char *sigfile) { - char *rawsig; - static char *htmlsig = NULL; - static time_t sigmodtime = -1; - struct stat st; - int fd; - + GString *rawsig; + char buf[1024]; + char *htmlsig = NULL; + int fd, n; + if (!sigfile || !*sigfile) { return NULL; } - - if (stat (sigfile, &st) == -1) { - char *msg; - - msg = g_strdup_printf ("Could not open signature file %s:\n%s", - sigfile, g_strerror (errno)); - gnome_error_dialog (msg); - g_free (msg); - - return NULL; - } - - if (st.st_mtime == sigmodtime) - return htmlsig; - - rawsig = g_malloc (st.st_size + 1); + fd = open (sigfile, O_RDONLY); if (fd == -1) { char *msg; - + msg = g_strdup_printf ("Could not open signature file %s:\n%s", sigfile, g_strerror (errno)); gnome_error_dialog (msg); g_free (msg); - + return NULL; } - - read (fd, rawsig, st.st_size); - rawsig[st.st_size] = '\0'; + + rawsig = g_string_new (""); + while ((n = read (fd, buf, 1023)) > 0) { + buf[n] = '\0'; + g_string_append (rawsig, buf); + } close (fd); - - htmlsig = e_text_to_html (rawsig, 0); - sigmodtime = st.st_mtime; - + + htmlsig = e_text_to_html (rawsig->str, 0); + g_string_free (rawsig, TRUE); + return htmlsig; } |