diff --git a/ChangeLog b/ChangeLog index 281535d355..901340df7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon May 17 14:25:11 1999 ape@lrdpf.spacetec.no (Asbjorn Pettersen) + + * plug-ins/mail/mail.c (save_image): Add OS/2 patches. popen(),spawnl,, + 1999-05-17 Jay Cox * app/xcf.c: fixed bogus computation of the maximum size diff --git a/plug-ins/common/mail.c b/plug-ins/common/mail.c index 3fb4e531a5..858ed66d89 100644 --- a/plug-ins/common/mail.c +++ b/plug-ins/common/mail.c @@ -104,12 +104,17 @@ #include #include +#include #include #include #include #include #include #include +#ifdef __EMX__ +#include +#include +#endif #include "gtk/gtk.h" #include "libgimp/gimp.h" @@ -320,7 +325,11 @@ save_image (char *filename, strcat (mailcmdline, mail_info.receipt); /* create a pipe to sendmail */ +#ifndef __EMX__ mailpipe = popen (mailcmdline, "w"); +#else + mailpipe = popen (mailcmdline, "wb"); +#endif create_headers (mailpipe); /* This is necessary to make the comments and headers work correctly. Not real sure why */ @@ -347,6 +356,7 @@ save_image (char *filename, } if( mail_info.encapsulation == ENCAPSULATION_UUENCODE ) { +#ifndef __EMX__ /* fork off a uuencode process */ if ((pid = fork ()) < 0) { @@ -370,6 +380,27 @@ save_image (char *filename, _exit (127); } else +#else /* __EMX__ */ + int tfd; + /* save fileno(stdout) */ + tfd = dup (fileno (stdout)); + if (dup2 (fileno (mailpipe), fileno (stdout)) == -1) + { + g_message ("mail: dup2 failed: %s\n", g_strerror (errno)); + close(tfd); + return -1; + } + fcntl(tfd, F_SETFD, FD_CLOEXEC); + pid = spawnlp (P_NOWAIT, UUENCODE, UUENCODE, tmpname, filename, NULL); + /* restore fileno(stdout) */ + dup2 (tfd, fileno (stdout)); + close(tfd); + if (pid == -1) + { + g_message ("mail: spawn failed: %s\n", g_strerror (errno)); + return -1; + } +#endif { waitpid (pid, &status, 0); diff --git a/plug-ins/mail/mail.c b/plug-ins/mail/mail.c index 3fb4e531a5..858ed66d89 100644 --- a/plug-ins/mail/mail.c +++ b/plug-ins/mail/mail.c @@ -104,12 +104,17 @@ #include #include +#include #include #include #include #include #include #include +#ifdef __EMX__ +#include +#include +#endif #include "gtk/gtk.h" #include "libgimp/gimp.h" @@ -320,7 +325,11 @@ save_image (char *filename, strcat (mailcmdline, mail_info.receipt); /* create a pipe to sendmail */ +#ifndef __EMX__ mailpipe = popen (mailcmdline, "w"); +#else + mailpipe = popen (mailcmdline, "wb"); +#endif create_headers (mailpipe); /* This is necessary to make the comments and headers work correctly. Not real sure why */ @@ -347,6 +356,7 @@ save_image (char *filename, } if( mail_info.encapsulation == ENCAPSULATION_UUENCODE ) { +#ifndef __EMX__ /* fork off a uuencode process */ if ((pid = fork ()) < 0) { @@ -370,6 +380,27 @@ save_image (char *filename, _exit (127); } else +#else /* __EMX__ */ + int tfd; + /* save fileno(stdout) */ + tfd = dup (fileno (stdout)); + if (dup2 (fileno (mailpipe), fileno (stdout)) == -1) + { + g_message ("mail: dup2 failed: %s\n", g_strerror (errno)); + close(tfd); + return -1; + } + fcntl(tfd, F_SETFD, FD_CLOEXEC); + pid = spawnlp (P_NOWAIT, UUENCODE, UUENCODE, tmpname, filename, NULL); + /* restore fileno(stdout) */ + dup2 (tfd, fileno (stdout)); + close(tfd); + if (pid == -1) + { + g_message ("mail: spawn failed: %s\n", g_strerror (errno)); + return -1; + } +#endif { waitpid (pid, &status, 0);