]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Marco G. Salvagno's OS/2 fixes
authorDaniel Stenberg <daniel@haxx.se>
Sun, 19 Mar 2000 19:54:13 +0000 (19:54 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 19 Mar 2000 19:54:13 +0000 (19:54 +0000)
lib/file.c
lib/getpass.c
lib/progress.c

index 99759f4770090125446fddcd5b4a50eebd009ccb..af966016b3dc2c5dfe6790aa9f14ff032b46c331 100644 (file)
@@ -118,10 +118,10 @@ UrgError file(struct UrlData *data, char *path, long *bytecountp)
   int fd;
   char *actual_path = curl_unescape(path);
 
-#ifdef WIN32
+#if defined(WIN32) || defined(__EMX__)
   int i;
 
-  /* change path separators from '/' to '\\' for Windows */
+  /* change path separators from '/' to '\\' for Windows and OS/2 */
   for (i=0; actual_path[i] != '\0'; ++i)
     if (actual_path[i] == '/')
       actual_path[i] = '\\';
index c0c7bf97bfd4781f17a1e4ec5059ecc49339978c..4a87145ab41e3780f7268f28d67a50529709e9c8 100644 (file)
@@ -76,7 +76,9 @@ char *getpass(const char *prompt)
   FILE *outfp;
   static char buf[INPUT_BUFFER];
   RETSIGTYPE (*sigint)();
+#ifndef __EMX__
   RETSIGTYPE (*sigtstp)();
+#endif
   size_t bytes_read;
   int infd;
   int outfd;
@@ -92,7 +94,11 @@ char *getpass(const char *prompt)
 #endif
 
   sigint = signal(SIGINT, SIG_IGN);
+  /* 20000318 mgs
+   * this is needed by the emx system, SIGTSTP is not a supported signal */
+#ifndef __EMX__
   sigtstp = signal(SIGTSTP, SIG_IGN);
+#endif
 
   if( (infp=fopen("/dev/tty", "r")) == NULL )
   {
index 4307be35ec3c5b0a94a60d5288c8e5be7deaf809..1bd5b470c176c21f27c646674b70b0dc0241cd72 100644 (file)
 #include <time.h>
 #endif
 
+/* 20000318 mgs
+ * later we use _scrsize to determine the screen width, this emx library
+ * function needs stdlib.h to be included */
+#if defined(__EMX__)
+#include <stdlib.h>
+#endif
+
 #include <curl/curl.h>
 #include "urldata.h"
 
@@ -365,6 +372,11 @@ static int width = 0;
 
 void ProgressInit(struct UrlData *data, int max/*, int options, int moremax*/)
 {
+#ifdef __EMX__
+  /* 20000318 mgs */
+  int scr_size [2];
+#endif
+
   if(data->conf&(CONF_NOPROGRESS|CONF_MUTE))
     return;
 
@@ -372,10 +384,25 @@ void ProgressInit(struct UrlData *data, int max/*, int options, int moremax*/)
 
 /* TODO: get terminal width through ansi escapes or something similar.
          try to update width when xterm is resized... - 19990617 larsa */
+#ifndef __EMX__
+  /* 20000318 mgs
+   * OS/2 users most likely won't have this env var set, and besides that
+   * we're using our own way to determine screen width */
   if (curl_GetEnv("COLUMNS") != NULL)
     width = atoi(curl_GetEnv("COLUMNS"));
   else
     width = 79;
+#else
+  /* 20000318 mgs
+   * We use this emx library call to get the screen width, and subtract
+   * one from what we got in order to avoid a problem with the cursor
+   * advancing to the next line if we print a string that is as long as
+   * the screen is wide. */
+  _scrsize(scr_size);
+  width = scr_size[0] - 1;
+#endif
+
 
   progressmax = max;
   if(-1 == max)