[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev [PATCH 2.8.3.15] mail on OS/2
From: |
Ilya Zakharevich |
Subject: |
lynx-dev [PATCH 2.8.3.15] mail on OS/2 |
Date: |
Thu, 18 Nov 1999 02:47:03 -0500 (EST) |
This patch enables mailto: on OS/2.
Enjoy,
Ilya
--- ./src/LYUtils.c-pre Wed Nov 17 23:08:08 1999
+++ ./src/LYUtils.c Thu Nov 18 02:34:44 1999
@@ -7149,6 +7149,33 @@ PUBLIC int LYCopyFile ARGS2(
#endif
}
+PRIVATE void
+convert_slash(char **cmd, int *do_free)
+{
+# ifdef __EMX__ /* FIXME: Should be LY_CONVERT_SLASH? */
+ /* Configure writes commands which contain direct slashes.
+ Native command-(non)-shell will not tolerate this. */
+ char *space = *cmd, *slash = *cmd;
+
+ while (*space && *space != ' ' && *space != '\t')
+ space++;
+ while (slash < space && *slash != '/')
+ slash++;
+ if (slash != space) {
+ char *old = *cmd;
+
+ *cmd = NULL;
+ StrAllocCopy(*cmd, old);
+ *do_free = 1;
+ slash = (slash - old) + *cmd - 1;
+ space = (space - old) + *cmd;
+ while (++slash < space)
+ if (*slash == '/')
+ *slash = '\\';
+ }
+# endif
+}
+
/*
* Invoke a shell command, return nonzero on error.
*/
@@ -7176,29 +7203,7 @@ PUBLIC int LYSystem ARGS1(
#ifdef VMS
code = DCLsystem(command);
#else
-# ifdef __EMX__ /* FIXME: Should be LY_CONVERT_SLASH? */
- /* Configure writes commands which contain direct slashes.
- Native command-(non)-shell will not tolerate this. */
- {
- char *space = command, *slash = command;
- while (*space && *space != ' ' && *space != '\t')
- space++;
- while (slash < space && *slash != '/')
- slash++;
- if (slash != space) {
- char *old = command;
-
- command = NULL;
- StrAllocCopy(command, old);
- do_free = 1;
- slash = (slash - old) + command - 1;
- space = (space - old) + command;
- while (++slash < space)
- if (*slash == '/')
- *slash = '\\';
- }
- }
-# endif
+ convert_slash(&command, &do_free);
#if defined(__CYGWIN__) && defined(DOSPATH) /* 1999/02/26 (Fri) */
{
@@ -7284,6 +7289,22 @@ PUBLIC int LYSystem ARGS1(
errno = saved_errno; /* may have been clobbered */
#endif
return code;
+}
+
+/*
+ * Invoke a pipe, return a file handle.
+ */
+PUBLIC FILE *LYPopen ARGS2(
+ char *, command, char *, mode)
+{
+ int do_free = 0;
+ FILE *fp;
+
+ convert_slash(&command, &do_free);
+ fp = popen(command, mode);
+ if (do_free)
+ FREE(command);
+ return fp;
}
/*
--- ./src/LYUtils.h-pre Wed Nov 17 23:08:08 1999
+++ ./src/LYUtils.h Thu Nov 18 02:26:42 1999
@@ -84,6 +84,7 @@ extern int LYConsoleInputFD PARAMS((BOOL
extern int LYCopyFile PARAMS((char *src, char *dst));
extern int LYOpenInternalPage PARAMS((FILE **fp0, char **newfile));
extern int LYSystem PARAMS((char *command));
+extern FILE *LYPopen PARAMS((char *command, char *mode));
extern int LYValidateOutput PARAMS((char * filename));
extern int is_url PARAMS((char *filename));
extern int number2arrows PARAMS((int number));
--- ./src/LYPrint.c-pre Thu Nov 18 02:25:04 1999
+++ ./src/LYPrint.c Thu Nov 18 02:25:20 1999
@@ -373,7 +373,7 @@ check_recall:
FirstRecall = TRUE;
FnameNum = FnameTotal;
goto retry;
- } else if ((outfile_fp = popen(buffer+1, "w")) == NULL) {
+ } else if ((outfile_fp = LYPopen(buffer+1, "w")) == NULL) {
CTRACE((tfp, "LYPrint: errno is %d\n", errno));
HTAlert(CANNOT_WRITE_TO_FILE);
_statusline(NEW_FILENAME_PROMPT);
@@ -672,7 +672,7 @@ PRIVATE void send_file_to_mail ARGS3(
outfile_fp = LYOpenTemp(my_temp, ".txt", "w");
#else
HTSprintf0(&buffer, "%s %s", system_mail, system_mail_flags);
- outfile_fp = popen(buffer, "w");
+ outfile_fp = LYPopen(buffer, "w");
#endif
if (outfile_fp == NULL) {
CannotPrint(MAIL_REQUEST_FAILED);
--- ./src/LYMail.c-pre Thu Nov 18 02:23:42 1999
+++ ./src/LYMail.c Thu Nov 18 02:24:08 1999
@@ -488,7 +488,7 @@ PUBLIC void mailform ARGS4(
#else /* !(defined(VMS) || defined(DOSPATH) || defined(SH_EX)) */
sprintf(cmd, "%s %s", system_mail, system_mail_flags);
- if ((fd = popen(cmd, "w")) == NULL) {
+ if ((fd = LYPopen(cmd, "w")) == NULL) {
HTAlert(FORM_MAILTO_FAILED);
FREE(address);
FREE(ccaddr);
@@ -863,7 +863,7 @@ PUBLIC void mailmsg ARGS4(
#if defined(UNIX) && !defined(__CYGWIN__)
HTSprintf0(&cmd, "%s %s", system_mail, system_mail_flags);
- if ((fd = popen(cmd, "w")) == NULL) {
+ if ((fd = LYPopen(cmd, "w")) == NULL) {
FREE(address);
CTRACE((tfp, "mailmsg: '%s' failed.\n", cmd));
return;
@@ -2027,7 +2027,7 @@ PUBLIC void reply_by_mail ARGS4(
}
#else
signal(SIGINT, SIG_IGN);
- fp = popen(cmd, "w");
+ fp = LYPopen(cmd, "w");
if (fp == NULL) {
HTInfoMsg(COMMENT_REQUEST_CANCELLED);
goto cleanup;
- lynx-dev [PATCH 2.8.3.15] mail on OS/2,
Ilya Zakharevich <=