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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/bin/files.cc
          +++ new/usr/src/cmd/make/bin/files.cc
↓ open down ↓ 223 lines elided ↑ open up ↑
 224  224  
 225  225          vpath = wcb.get_string();
 226  226  
 227  227          while (*vpath != (int) nul_char) {
 228  228                  name_p = file_name;
 229  229                  while ((*vpath != (int) colon_char) &&
 230  230                         (*vpath != (int) nul_char)) {
 231  231                          *name_p++ = *vpath++;
 232  232                  }
 233  233                  *name_p++ = (int) slash_char;
 234      -                (void) wscpy(name_p, wcb1.get_string());
      234 +                (void) wcscpy(name_p, wcb1.get_string());
 235  235                  alias = GETNAME(file_name, FIND_LENGTH);
 236  236                  if (exists(alias) != file_doesnt_exist) {
 237  237                          target->stat.is_file = true;
 238  238                          target->stat.mode = alias->stat.mode;
 239  239                          target->stat.size = alias->stat.size;
 240  240                          target->stat.is_dir = alias->stat.is_dir;
 241  241                          target->stat.time = alias->stat.time;
 242  242                          maybe_append_prop(target, vpath_alias_prop)->
 243  243                                                  body.vpath_alias.alias = alias;
 244  244                          target->has_vpath_alias_prop = true;
↓ open down ↓ 72 lines elided ↑ open up ↑
 317  317          if (vpath_defined && (dir == dot)) {
 318  318                  vps.init(getvar(vpath_name));
 319  319                  vpath = vps.get_string();
 320  320          }
 321  321  
 322  322          /*
 323  323           * Prepare the string where we build the full name of the
 324  324           * files in the directory.
 325  325           */
 326  326          if ((dir->hash.length > 1) || (wcb.get_string()[0] != (int) period_char)) {
 327      -                (void) wscpy(file_name, wcb.get_string());
      327 +                (void) wcscpy(file_name, wcb.get_string());
 328  328                  MBSTOWCS(wcs_buffer, "/");
 329      -                (void) wscat(file_name, wcs_buffer);
 330      -                file_name_p = file_name + wslen(file_name);
      329 +                (void) wcscat(file_name, wcs_buffer);
      330 +                file_name_p = file_name + wcslen(file_name);
 331  331          }
 332  332  
 333  333          /* Open the directory. */
 334  334  vpath_loop:
 335  335          dir_fd = opendir(dir->string_mb);
 336  336          if (dir_fd == NULL) {
 337  337                  return 0;
 338  338          }
 339  339  
 340  340          /* Read all the directory entries. */
↓ open down ↓ 4 lines elided ↑ open up ↑
 345  345                       ((dp->d_name[1] == 0) ||
 346  346                        ((dp->d_name[1] == (int) period_char) &&
 347  347                         (dp->d_name[2] == 0))))) {
 348  348                          continue;
 349  349                  }
 350  350                  /*
 351  351                   * Build the full name of the file using whatever
 352  352                   * path supplied to the function.
 353  353                   */
 354  354                  MBSTOWCS(tmp_wcs_buffer, dp->d_name);
 355      -                (void) wscpy(file_name_p, tmp_wcs_buffer);
      355 +                (void) wcscpy(file_name_p, tmp_wcs_buffer);
 356  356                  file = enter_file_name(file_name, library);
 357  357                  if ((pattern != NULL) && amatch(tmp_wcs_buffer, pattern)) {
 358  358                          /*
 359  359                           * If we are expanding a wildcard pattern, we
 360  360                           * enter the file as a dependency for the target.
 361  361                           */
 362  362                          if (debug_level > 0){
 363  363                                  WCSTOMBS(mbs_buffer, pattern);
 364  364                                  (void) printf(gettext("'%s: %s' due to %s expansion\n"),
 365  365                                                line->body.line.target->string_mb,
↓ open down ↓ 10 lines elided ↑ open up ↑
 376  376                          file->stat.has_sccs = NO_SCCS;
 377  377                  /*
 378  378                   * If this is an s. file, we also enter it as if it
 379  379                   * existed in the plain directory.
 380  380                   */
 381  381                  if ((dp->d_name[0] == 's') &&
 382  382                      (dp->d_name[1] == (int) period_char)) {
 383  383          
 384  384                          MBSTOWCS(tmp_wcs_buffer, dp->d_name + 2);
 385  385                          plain_file_name_p = plain_file_name;
 386      -                        (void) wscpy(plain_file_name_p, tmp_wcs_buffer);
      386 +                        (void) wcscpy(plain_file_name_p, tmp_wcs_buffer);
 387  387                          plain_file = GETNAME(plain_file_name, FIND_LENGTH);
 388  388                          plain_file->stat.is_file = true;
 389  389                          plain_file->stat.has_sccs = HAS_SCCS;
 390  390                          /*
 391  391                           * Enter the s. file as a dependency for the
 392  392                           * plain file.
 393  393                           */
 394  394                          maybe_append_prop(plain_file, sccs_prop)->
 395  395                            body.sccs.file = file;
 396  396                          MBSTOWCS(tmp_wcs_buffer, dp->d_name + 2);
↓ open down ↓ 32 lines elided ↑ open up ↑
 429  429  /*
 430  430   * look into SCCS directory only if it's not svr4. For svr4 dont do that.
 431  431   */
 432  432  
 433  433  /*
 434  434   * Now read the SCCS directory.
 435  435   * Files in the SCSC directory are considered to be part of the set of
 436  436   * files in the plain directory. They are also entered in their own right.
 437  437   * Prepare the string where we build the true name of the SCCS files.
 438  438   */
 439      -        (void) wsncpy(plain_file_name,
      439 +        (void) wcsncpy(plain_file_name,
 440  440                        file_name,
 441  441                        file_name_p - file_name);
 442  442          plain_file_name[file_name_p - file_name] = 0;
 443      -        plain_file_name_p = plain_file_name + wslen(plain_file_name);
      443 +        plain_file_name_p = plain_file_name + wcslen(plain_file_name);
 444  444  
 445  445          if(!svr4) {
 446  446  
 447  447            if (sccs_dir_path != NULL) {
 448  448                  wchar_t         tmp_wchar;
 449  449                  wchar_t         path[MAXPATHLEN];
 450  450                  char            mb_path[MAXPATHLEN];
 451  451  
 452  452                  if (file_name_p - file_name > 0) {
 453  453                          tmp_wchar = *file_name_p;
 454  454                          *file_name_p = 0;
 455  455                          WCSTOMBS(mbs_buffer, file_name);
 456  456                          (void) sprintf(mb_path, "%s/%s/SCCS",
 457  457                                          sccs_dir_path,
 458  458                                          mbs_buffer);
 459  459                          *file_name_p = tmp_wchar;
 460  460                  } else {
 461  461                          (void) sprintf(mb_path, "%s/SCCS", sccs_dir_path);
 462  462                  }
 463  463                  MBSTOWCS(path, mb_path);
 464      -                (void) wscpy(file_name, path);
      464 +                (void) wcscpy(file_name, path);
 465  465            } else {
 466  466                  MBSTOWCS(wcs_buffer, "SCCS");
 467      -                (void) wscpy(file_name_p, wcs_buffer);
      467 +                (void) wcscpy(file_name_p, wcs_buffer);
 468  468            }
 469  469          } else {
 470  470                  MBSTOWCS(wcs_buffer, ".");
 471      -                (void) wscpy(file_name_p, wcs_buffer);
      471 +                (void) wcscpy(file_name_p, wcs_buffer);
 472  472          }
 473  473          /* Internalize the constructed SCCS dir name. */
 474  474          (void) exists(dir = GETNAME(file_name, FIND_LENGTH));
 475  475          /* Just give up if the directory file doesnt exist. */
 476  476          if (!dir->stat.is_file) {
 477  477                  return result;
 478  478          }
 479  479          /* Open the directory. */
 480  480          dir_fd = opendir(dir->string_mb);
 481  481          if (dir_fd == NULL) {
 482  482                  return result;
 483  483          }
 484  484          MBSTOWCS(wcs_buffer, "/");
 485      -        (void) wscat(file_name, wcs_buffer);
 486      -        file_name_p = file_name + wslen(file_name);
      485 +        (void) wcscat(file_name, wcs_buffer);
      486 +        file_name_p = file_name + wcslen(file_name);
 487  487  
 488  488          while ((dp = readdir(dir_fd)) != NULL) {
 489  489                  if ((dp->d_fileno == 0) ||
 490  490                      ((dp->d_name[0] == (int) period_char) &&
 491  491                       ((dp->d_name[1] == 0) ||
 492  492                        ((dp->d_name[1] == (int) period_char) &&
 493  493                         (dp->d_name[2] == 0))))) {
 494  494                          continue;
 495  495                  }
 496  496                  /* Construct and internalize the true name of the SCCS file. */
 497  497                  MBSTOWCS(wcs_buffer, dp->d_name);
 498      -                (void) wscpy(file_name_p, wcs_buffer);
      498 +                (void) wcscpy(file_name_p, wcs_buffer);
 499  499                  file = GETNAME(file_name, FIND_LENGTH);
 500  500                  file->stat.is_file = true;
 501  501                  file->stat.has_sccs = NO_SCCS;
 502  502                  /*
 503  503                   * If this is an s. file, we also enter it as if it
 504  504                   * existed in the plain directory.
 505  505                   */
 506  506                  if ((dp->d_name[0] == 's') &&
 507  507                      (dp->d_name[1] == (int) period_char)) {
 508  508          
 509  509                          MBSTOWCS(wcs_buffer, dp->d_name + 2);
 510      -                        (void) wscpy(plain_file_name_p, wcs_buffer);
      510 +                        (void) wcscpy(plain_file_name_p, wcs_buffer);
 511  511                          plain_file = GETNAME(plain_file_name, FIND_LENGTH);
 512  512                          plain_file->stat.is_file = true;
 513  513                          plain_file->stat.has_sccs = HAS_SCCS;
 514  514                                  /* if sccs dependency is already set,skip */
 515  515                          if(plain_file->prop) {
 516  516                                  Property sprop = get_prop(plain_file->prop,sccs_prop);
 517  517                                  if(sprop != NULL) {
 518  518                                          if (sprop->body.sccs.file) {
 519  519                                                  goto try_pattern;
 520  520                                          }
↓ open down ↓ 191 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX