Print this page
make: use the more modern wchar routines, not widec.h


 182 timestruc_t&
 183 read_archive(register Name target)
 184 {
 185         register Property       member;
 186         wchar_t                 *slash;
 187         String_rec              true_member_name;
 188         wchar_t                 buffer[STRING_BUFFER_LENGTH];
 189         register Name           true_member = NULL;
 190         Ar                      ar;
 191         char                    *long_names_table = NULL; /* Table of long
 192                                                              member names */
 193 
 194         member = get_prop(target->prop, member_prop);
 195         /*
 196          * Check if the member has directory component.
 197          * If so, remove the dir and see if we know the date.
 198          */
 199         if (member->body.member.member != NULL) {
 200                 Wstring member_string(member->body.member.member);
 201                 wchar_t * wcb = member_string.get_string();
 202                 if((slash = (wchar_t *) wsrchr(wcb, (int) slash_char)) != NULL) {
 203                         INIT_STRING_FROM_STACK(true_member_name, buffer);
 204                         append_string(member->body.member.library->string_mb,
 205                                       &true_member_name,
 206                                       FIND_LENGTH);
 207                         append_char((int) parenleft_char, &true_member_name);
 208                         append_string(slash + 1, &true_member_name, FIND_LENGTH);
 209                         append_char((int) parenright_char, &true_member_name);
 210                         true_member = GETNAME(true_member_name.buffer.start,
 211                                               FIND_LENGTH);
 212                         if (true_member->stat.time != file_no_time) {
 213                                 target->stat.time = true_member->stat.time;
 214                                 return target->stat.time;
 215                         }
 216                 }
 217         }
 218         if (open_archive(member->body.member.library->string_mb, &ar) == failed) {
 219                 if (errno == ENOENT) {
 220                         target->stat.stat_errno = ENOENT;
 221                         close_archive(&ar);
 222                         if (member->body.member.member == NULL) {


 650                 for (i = 0; i < arp->num_symbols; i++) {
 651                         if (fread((char *) &arp->ars_5,
 652                                   sizeof arp->ars_5,
 653                                   1,
 654                                   arp->fd) != 1) {
 655                                 goto read_error;
 656                         }
 657                         if (IS_EQUALN(arp->ars_5.sym_name,
 658                                       member->body.member.entry->string_mb,
 659                                       len)) {
 660                                 if ((fseek(arp->fd,
 661                                            sgetl(arp->ars_5.sym_ptr),
 662                                            0) != 0) ||
 663                                     (fread((char *) &arp->arf_5,
 664                                            sizeof arp->arf_5,
 665                                            1,
 666                                            arp->fd) != 1)) {
 667                                         goto read_error;
 668                                 }
 669                                 MBSTOWCS(wcs_buffer, arp->arf_5.arf_name);
 670                                 (void) wsncpy(member_string,
 671                                               wcs_buffer,
 672                                               wslen(wcs_buffer));
 673                                 member_string[sizeof(arp->arf_5.arf_name)] =
 674                                                                 (int) nul_char;
 675                                 member->body.member.member =
 676                                         GETNAME(member_string, FIND_LENGTH);
 677                                 target->stat.time.tv_sec = sgetl(arp->arf_5.arf_date);
 678                                 target->stat.time.tv_nsec = LONG_MAX;
 679                                 return;
 680                         }
 681                 }
 682                 break;
 683         case AR_PORT:
 684                 offs = (ar_port_word *) alloca((int) (arp->num_symbols * AR_PORT_WORD));
 685                 if (fread((char *) offs,
 686                           AR_PORT_WORD,
 687                           (int) arp->num_symbols,
 688                           arp->fd) != arp->num_symbols) {
 689                         goto read_error;
 690                 }
 691 
 692                 for(i=0;i<arp->num_symbols;i++) {




 182 timestruc_t&
 183 read_archive(register Name target)
 184 {
 185         register Property       member;
 186         wchar_t                 *slash;
 187         String_rec              true_member_name;
 188         wchar_t                 buffer[STRING_BUFFER_LENGTH];
 189         register Name           true_member = NULL;
 190         Ar                      ar;
 191         char                    *long_names_table = NULL; /* Table of long
 192                                                              member names */
 193 
 194         member = get_prop(target->prop, member_prop);
 195         /*
 196          * Check if the member has directory component.
 197          * If so, remove the dir and see if we know the date.
 198          */
 199         if (member->body.member.member != NULL) {
 200                 Wstring member_string(member->body.member.member);
 201                 wchar_t * wcb = member_string.get_string();
 202                 if((slash = (wchar_t *) wcsrchr(wcb, (int) slash_char)) != NULL) {
 203                         INIT_STRING_FROM_STACK(true_member_name, buffer);
 204                         append_string(member->body.member.library->string_mb,
 205                                       &true_member_name,
 206                                       FIND_LENGTH);
 207                         append_char((int) parenleft_char, &true_member_name);
 208                         append_string(slash + 1, &true_member_name, FIND_LENGTH);
 209                         append_char((int) parenright_char, &true_member_name);
 210                         true_member = GETNAME(true_member_name.buffer.start,
 211                                               FIND_LENGTH);
 212                         if (true_member->stat.time != file_no_time) {
 213                                 target->stat.time = true_member->stat.time;
 214                                 return target->stat.time;
 215                         }
 216                 }
 217         }
 218         if (open_archive(member->body.member.library->string_mb, &ar) == failed) {
 219                 if (errno == ENOENT) {
 220                         target->stat.stat_errno = ENOENT;
 221                         close_archive(&ar);
 222                         if (member->body.member.member == NULL) {


 650                 for (i = 0; i < arp->num_symbols; i++) {
 651                         if (fread((char *) &arp->ars_5,
 652                                   sizeof arp->ars_5,
 653                                   1,
 654                                   arp->fd) != 1) {
 655                                 goto read_error;
 656                         }
 657                         if (IS_EQUALN(arp->ars_5.sym_name,
 658                                       member->body.member.entry->string_mb,
 659                                       len)) {
 660                                 if ((fseek(arp->fd,
 661                                            sgetl(arp->ars_5.sym_ptr),
 662                                            0) != 0) ||
 663                                     (fread((char *) &arp->arf_5,
 664                                            sizeof arp->arf_5,
 665                                            1,
 666                                            arp->fd) != 1)) {
 667                                         goto read_error;
 668                                 }
 669                                 MBSTOWCS(wcs_buffer, arp->arf_5.arf_name);
 670                                 (void) wcsncpy(member_string,
 671                                               wcs_buffer,
 672                                               wcslen(wcs_buffer));
 673                                 member_string[sizeof(arp->arf_5.arf_name)] =
 674                                                                 (int) nul_char;
 675                                 member->body.member.member =
 676                                         GETNAME(member_string, FIND_LENGTH);
 677                                 target->stat.time.tv_sec = sgetl(arp->arf_5.arf_date);
 678                                 target->stat.time.tv_nsec = LONG_MAX;
 679                                 return;
 680                         }
 681                 }
 682                 break;
 683         case AR_PORT:
 684                 offs = (ar_port_word *) alloca((int) (arp->num_symbols * AR_PORT_WORD));
 685                 if (fread((char *) offs,
 686                           AR_PORT_WORD,
 687                           (int) arp->num_symbols,
 688                           arp->fd) != arp->num_symbols) {
 689                         goto read_error;
 690                 }
 691 
 692                 for(i=0;i<arp->num_symbols;i++) {