*** ../t/ruby-1.9.1-p243/dln.c	Sun Jul 12 09:45:12 2009
--- ./dln.c	Tue Sep  8 10:01:15 2009
***************
*** 1155,1161 ****
  static void
  aix_loaderror(const char *pathname)
  {
!     char *message[8], errbuf[1024];
      int i,j;
  
      struct errtab { 
--- 1155,1162 ----
  static void
  aix_loaderror(const char *pathname)
  {
!     char *message[1024], errbuf[1024];
!     char temp[1024];
      int i,j;
  
      struct errtab { 
***************
*** 1162,1178 ****
  	int errnum;
  	char *errstr;
      } load_errtab[] = {
! 	{L_ERROR_TOOMANY,	"too many errors, rest skipped."},
! 	{L_ERROR_NOLIB,		"can't load library:"},
! 	{L_ERROR_UNDEF,		"can't find symbol in library:"},
  	{L_ERROR_RLDBAD,
! 	     "RLD index out of range or bad relocation type:"},
! 	{L_ERROR_FORMAT,	"not a valid, executable xcoff file:"},
  	{L_ERROR_MEMBER,
! 	     "file not an archive or does not contain requested member:"},
! 	{L_ERROR_TYPE,		"symbol table mismatch:"},
! 	{L_ERROR_ALIGN,		"text alignment in file is wrong."},
! 	{L_ERROR_SYSTEM,	"System error:"},
  	{L_ERROR_ERRNO,		NULL}
      };
  
--- 1163,1179 ----
  	int errnum;
  	char *errstr;
      } load_errtab[] = {
! 	{L_ERROR_TOOMANY,	" too many errors, rest skipped."},
! 	{L_ERROR_NOLIB,		" can't load library:"},
! 	{L_ERROR_UNDEF,		" can't find symbol %s in library: %s"},
  	{L_ERROR_RLDBAD,
! 	     " RLD index out of range or bad relocation type:"},
! 	{L_ERROR_FORMAT,	" not a valid, executable xcoff file:"},
  	{L_ERROR_MEMBER,
! 	     " file not an archive or does not contain requested member:"},
! 	{L_ERROR_TYPE,		" symbol table mismatch:"},
! 	{L_ERROR_ALIGN,		" text alignment in file is wrong."},
! 	{L_ERROR_SYSTEM,	" System error:"},
  	{L_ERROR_ERRNO,		NULL}
      };
  
***************
*** 1181,1197 ****
  
      snprintf(errbuf, 1024, "load failed - %s ", pathname);
  
!     if (!loadquery(1, &message[0], sizeof(message))) 
  	ERRBUF_APPEND(strerror(errno));
!     for(i = 0; message[i] && *message[i]; i++) {
! 	int nerr = atoi(message[i]);
! 	for (j=0; j<LOAD_ERRTAB_LEN; j++) {
!            if (nerr == load_errtab[i].errnum && load_errtab[i].errstr)
! 		ERRBUF_APPEND(load_errtab[i].errstr);
  	}
- 	while (isdigit(*message[i])) message[i]++; 
- 	ERRBUF_APPEND(message[i]);
- 	ERRBUF_APPEND("\n");
      }
      errbuf[strlen(errbuf)-1] = '\0';	/* trim off last newline */
      rb_loaderror(errbuf);
--- 1182,1223 ----
  
      snprintf(errbuf, 1024, "load failed - %s ", pathname);
  
!     if (!loadquery(1, &message[0], sizeof(message))) {
  	ERRBUF_APPEND(strerror(errno));
! 	for(i = 0; message[i] && *message[i]; i++) {
! 	    int nerr;
! 	    char *s = message[i];
!             char *t;
! 	    /*
! 	     * Message can have '(xxx ' in front for some reason.
! 	     */
! 	    if (*s == '(') {
! 		while (*s && (*s++ != ' '));
! 		s[-1] = '\0';
! 	    }
! 	    for (t = s; *t && (*t++ != ' '); );
! 	    t[-1] = '\0';
! 	    nerr = atoi(s);
! 	    for (j=0; j<LOAD_ERRTAB_LEN; j++) {
! 	        if (nerr == load_errtab[j].errnum && load_errtab[j].errstr) {
! 		    if (nerr == L_ERROR_UNDEF) {
! 			char *u, *v;;
! 
! 			for (u = t; *u && (*u++ != ' '); );
! 			u[-1] = '\0';
! 			for (v = u; *v && (*v++ != ' '); );
! 			v[-1] = '\0';
! 			sprintf(temp, load_errtab[j].errstr, u, v);
! 			ERRBUF_APPEND(temp);
! 		    } else {
! 			ERRBUF_APPEND(load_errtab[j].errstr);
! 			ERRBUF_APPEND(t);
! 		    }
! 		    break;
! 		}
! 	    }
! 	    ERRBUF_APPEND("\n");
  	}
      }
      errbuf[strlen(errbuf)-1] = '\0';	/* trim off last newline */
      rb_loaderror(errbuf);
