httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@hyperreal.org
Subject cvs commit: apache-1.3/src/os/os2 os.c os.h util_os2.c
Date Fri, 07 May 1999 05:49:47 GMT
bjh         99/05/06 22:49:47

  Modified:    src/os/os2 os.c os.h util_os2.c
  Log:
  Provide system error messages instead of just OS/2 error codes for dynamic
  linking errors. I don't particularly like using static char buffers like
  this but ap_os_dso_error() doesn't take a pool.
  
  Revision  Changes    Path
  1.3       +1 -3      apache-1.3/src/os/os2/os.c
  
  Index: os.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/os2/os.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- os.c	1999/05/04 11:21:15	1.2
  +++ os.c	1999/05/07 05:49:46	1.3
  @@ -54,7 +54,5 @@
   
   const char *ap_os_dso_error(void)
   {
  -    static char message[30];
  -    sprintf( message, "OS/2 error code %d", rc );
  -    return message;
  +    return ap_os_error_message(rc);
   }
  
  
  
  1.15      +3 -0      apache-1.3/src/os/os2/os.h
  
  Index: os.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/os2/os.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- os.h	1999/05/04 11:21:16	1.14
  +++ os.h	1999/05/07 05:49:46	1.15
  @@ -35,6 +35,9 @@
   /* Use a specialized kill() function */
   int ap_os_kill(int pid, int sig);
   
  +/* Maps an OS error code to an error message */
  +char *ap_os_error_message(int err);
  +
   /* OS/2 doesn't have symlinks so S_ISLNK is always false */
   #define S_ISLNK(m) 0
   
  
  
  
  1.4       +32 -0     apache-1.3/src/os/os2/util_os2.c
  
  Index: util_os2.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/os2/util_os2.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- util_os2.c	1999/05/01 05:15:52	1.3
  +++ util_os2.c	1999/05/07 05:49:46	1.4
  @@ -63,3 +63,35 @@
       
       return rc;
   }
  +
  +
  +
  +char *ap_os_error_message(int err)
  +{
  +  static char result[200];
  +  char message[HUGE_STRING_LEN];
  +  ULONG len;
  +  char *pos;
  +  int c;
  +  
  +  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 (isspace(message[c]) && isspace(message[c+1])) /* skip multiple
whitespace */
  +              c++;
  +          *(pos++) = isspace(message[c]) ? ' ' : message[c];
  +      }
  +  
  +      *pos = 0;
  +  } else {
  +      sprintf(result, "OS/2 error %d", err);
  +  }
  +  
  +  return result;
  +}
  
  
  

Mime
View raw message