httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/misc/unix errorcodes.c
Date Thu, 20 Apr 2000 14:27:56 GMT
bjh         00/04/20 07:27:56

  Modified:    src/lib/apr/misc/unix errorcodes.c
  Log:
  Add error messages for OS/2 error codes.
  
  Revision  Changes    Path
  1.3       +45 -2     apache-2.0/src/lib/apr/misc/unix/errorcodes.c
  
  Index: errorcodes.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/unix/errorcodes.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- errorcodes.c	2000/04/19 22:50:13	1.2
  +++ errorcodes.c	2000/04/20 14:27:55	1.3
  @@ -56,8 +56,9 @@
   
   #ifdef WIN32
   #error "not implemented yet"
  -#elif OS/2
  -#error "not implemented yet"
  +#elif OS2
  +const char *ap_os_strerror(int err, ap_pool_t *p);
  +#define SYS_ERR_STRING(code, p) { errstr = ap_os_strerror(code, p); }
   #elif BEOS    
   #error "not implemented yet"
   #else
  @@ -160,3 +161,45 @@
           return errstr;
       }
   }
  +
  +
  +
  +#ifdef OS2
  +#define INCL_DOS
  +#include <os2.h>
  +#include <ctype.h>
  +
  +const char *ap_os_strerror(int err, ap_pool_t *p)
  +{
  +  char result[200];
  +  unsigned char message[HUGE_STRING_LEN];
  +  ULONG len;
  +  char *pos;
  +  int c;
  +  
  +  if (err >= 10000 && err < 12000) {  /* socket error codes */
  +      return strerror(ap_canonical_error(err+APR_OS_START_SYSERR));
  +  } 
  +  else if (DosGetMessage(NULL, 0, message, HUGE_STRING_LEN, err, "OSO001.MSG", &len)
== 0) {
  +      len--;
  +      message[len] = 0;
  +      pos = result;
  +  
  +      if (len >= sizeof(result))
  +        len = sizeof(result-1);
  +
  +      for (c=0; c<len; c++) {
  +          while (ap_isspace(message[c]) && ap_isspace(message[c+1])) /* skip multiple
whitespace */
  +              c++;
  +          *(pos++) = ap_isspace(message[c]) ? ' ' : message[c];
  +      }
  +  
  +      *pos = 0;
  +  } 
  +  else {
  +      sprintf(result, "OS/2 error %d", err);
  +  }
  +  
  +  return ap_pstrdup(p, result);
  +}
  +#endif
  
  
  

Mime
View raw message