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/doname.cc
          +++ new/usr/src/cmd/make/bin/doname.cc
↓ open down ↓ 1480 lines elided ↑ open up ↑
1481 1481               dependency != NULL;
1482 1482               dependency = *remove) {
1483 1483                  if (dependency->name == NULL) {
1484 1484                          dependency = *remove = (*remove)->next;
1485 1485                          continue;
1486 1486                  }
1487 1487                  /* If dependency name string contains shell wildcards */
1488 1488                  /* replace the name with the expansion */
1489 1489                  if (dependency->name->wildcard) {
1490 1490                          wcb.init(dependency->name);
1491      -                        if ((start = (wchar_t *) wschr(wcb.get_string(),
     1491 +                        if ((start = (wchar_t *) wcschr(wcb.get_string(),
1492 1492                                             (int) parenleft_char)) != NULL) {
1493 1493                                  /* lib(*) type pattern */
1494 1494                                  library = buffer;
1495      -                                (void) wsncpy(buffer,
     1495 +                                (void) wcsncpy(buffer,
1496 1496                                                wcb.get_string(),
1497 1497                                                start - wcb.get_string());
1498 1498                                  buffer[start-wcb.get_string()] =
1499 1499                                    (int) nul_char;
1500      -                                (void) wsncpy(pattern,
     1500 +                                (void) wcsncpy(pattern,
1501 1501                                                start + 1,
1502 1502  (int) (dependency->name->hash.length-(start-wcb.get_string())-2));
1503 1503                                  pattern[dependency->name->hash.length -
1504 1504                                          (start-wcb.get_string()) - 2] =
1505 1505                                            (int) nul_char;
1506 1506                          } else {
1507 1507                                  library = NULL;
1508      -                                (void) wsncpy(pattern,
     1508 +                                (void) wcsncpy(pattern,
1509 1509                                                wcb.get_string(),
1510 1510                                                (int) dependency->name->hash.length);
1511 1511                                  pattern[dependency->name->hash.length] =
1512 1512                                    (int) nul_char;
1513 1513                          }
1514      -                        start = (wchar_t *) wsrchr(pattern, (int) slash_char);
     1514 +                        start = (wchar_t *) wcsrchr(pattern, (int) slash_char);
1515 1515                          if (start == NULL) {
1516 1516                                  directory = dot;
1517 1517                                  p = pattern;
1518 1518                          } else {
1519 1519                                  directory = GETNAME(pattern, start-pattern);
1520 1520                                  p = start+1;
1521 1521                          }
1522 1522                          /* The expansion is handled by the read_dir() routine*/
1523 1523                          if (read_dir(directory, p, line, library)) {
1524 1524                                  *remove = (*remove)->next;
↓ open down ↓ 1168 lines elided ↑ open up ↑
2693 2693                  if (result == -1) {
2694 2694                          fatal(gettext("Can't read symbolic link `%s': %s"),
2695 2695                                target->string_mb, errmsg(errno));
2696 2696                  }
2697 2697                  link[result] = 0;
2698 2698                  /* Use the value to build the proper filename. */
2699 2699                  INIT_STRING_FROM_STACK(string, name);
2700 2700  
2701 2701                  Wstring wcb(target);
2702 2702                  if ((link[0] != slash_char) &&
2703      -                    ((p = (wchar_t *) wsrchr(wcb.get_string(), slash_char)) != NULL)) {
     2703 +                    ((p = (wchar_t *) wcsrchr(wcb.get_string(), slash_char)) != NULL)) {
2704 2704                          append_string(wcb.get_string(), &string, p - wcb.get_string() + 1);
2705 2705                  }
2706 2706                  append_string(link, &string, result);
2707 2707                  /* Replace the old name with the translated name. */
2708 2708                  target = normalize_name(string.buffer.start, string.text.p - string.buffer.start);
2709 2709                  (void) exists(target);
2710 2710                  if (string.free_after_use) {
2711 2711                          retmem(string.buffer.start);
2712 2712                  }
2713 2713          }
↓ open down ↓ 97 lines elided ↑ open up ↑
2811 2811  void
2812 2812  read_directory_of_file(register Name file)
2813 2813  {
2814 2814  
2815 2815          Wstring file_string(file);
2816 2816          wchar_t * wcb = file_string.get_string();
2817 2817          wchar_t usr_include_buf[MAXPATHLEN];
2818 2818          wchar_t usr_include_sys_buf[MAXPATHLEN];
2819 2819  
2820 2820          register Name           directory = dot;
2821      -        register wchar_t        *p = (wchar_t *) wsrchr(wcb,
     2821 +        register wchar_t        *p = (wchar_t *) wcsrchr(wcb,
2822 2822                                                          (int) slash_char);
2823 2823          register int            length = p - wcb;
2824 2824          static Name             usr_include;
2825 2825          static Name             usr_include_sys;
2826 2826  
2827 2827          if (usr_include == NULL) {
2828 2828                  MBSTOWCS(usr_include_buf, "/usr/include");
2829 2829                  usr_include = GETNAME(usr_include_buf, FIND_LENGTH);
2830 2830                  MBSTOWCS(usr_include_sys_buf, "/usr/include/sys");
2831 2831                  usr_include_sys = GETNAME(usr_include_sys_buf, FIND_LENGTH);
↓ open down ↓ 53 lines elided ↑ open up ↑
2885 2885  
2886 2886          Wstring wcb(target);
2887 2887          Wstring wcb1;
2888 2888  
2889 2889          for (conditional = get_prop(conditionals->prop, conditional_prop);
2890 2890               conditional != NULL;
2891 2891               conditional = get_prop(conditional->next, conditional_prop)) {
2892 2892                  wcb1.init(conditional->body.conditional.target);
2893 2893                  pattern = wcb1.get_string();
2894 2894                  if (pattern[1] != 0) {
2895      -                        percent = (wchar_t *) wschr(pattern, (int) percent_char);
     2895 +                        percent = (wchar_t *) wcschr(pattern, (int) percent_char);
2896 2896                          if (!wcb.equaln(pattern, percent-pattern) ||
2897      -                            !IS_WEQUAL(wcb.get_string(wcb.length()-wslen(percent+1)), percent+1)) {
     2897 +                            !IS_WEQUAL(wcb.get_string(wcb.length()-wcslen(percent+1)), percent+1)) {
2898 2898                                  continue;
2899 2899                          }
2900 2900                  }
2901 2901                  for (previous = &target->prop;
2902 2902                       *previous != NULL;
2903 2903                       previous = &(*previous)->next) {
2904 2904                          if (((*previous)->type == conditional_prop) &&
2905 2905                              ((*previous)->body.conditional.sequence >
2906 2906                               conditional->body.conditional.sequence)) {
2907 2907                                  break;
↓ open down ↓ 296 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX