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/main.cc
          +++ new/usr/src/cmd/make/bin/main.cc
↓ open down ↓ 1822 lines elided ↑ open up ↑
1823 1823                                       true);
1824 1824          }
1825 1825  
1826 1826          /*
1827 1827           * If the user did not redefine the MAKE macro in the
1828 1828           * default makefile (make.rules), then we'd like to
1829 1829           * change the macro value of MAKE to be some form
1830 1830           * of argv[0] for recursive MAKE builds.
1831 1831           */
1832 1832          MBSTOWCS(wcs_buffer, "MAKE");
1833      -        def_make_name = GETNAME(wcs_buffer, wslen(wcs_buffer));
     1833 +        def_make_name = GETNAME(wcs_buffer, wcslen(wcs_buffer));
1834 1834          def_make_macro = get_prop(def_make_name->prop, macro_prop);
1835 1835          if ((def_make_macro != NULL) &&
1836 1836              (IS_EQUAL(def_make_macro->body.macro.value->string_mb,
1837 1837                        "make"))) {
1838 1838                  MBSTOWCS(wcs_buffer, argv_zero_string);
1839      -                new_make_value = GETNAME(wcs_buffer, wslen(wcs_buffer));
     1839 +                new_make_value = GETNAME(wcs_buffer, wcslen(wcs_buffer));
1840 1840                  (void) SETVAR(def_make_name,
1841 1841                                new_make_value,
1842 1842                                false);
1843 1843          }
1844 1844  
1845 1845          default_target_to_build = NULL;
1846 1846          trace_reader = false;
1847 1847  
1848 1848  /*
1849 1849   *      Read environment args. Let file args which follow override unless
↓ open down ↓ 428 lines elided ↑ open up ↑
2278 2278          makeflags_string_posix.buffer.start = NULL;
2279 2279  
2280 2280          if (posix) {
2281 2281                  /*
2282 2282                   * If the user did not redefine the ARFLAGS macro in the
2283 2283                   * default makefile (make.rules), then we'd like to
2284 2284                   * change the macro value of ARFLAGS to be in accordance
2285 2285                   * with "POSIX" requirements.
2286 2286                   */
2287 2287                  MBSTOWCS(wcs_buffer, "ARFLAGS");
2288      -                name = GETNAME(wcs_buffer, wslen(wcs_buffer));
     2288 +                name = GETNAME(wcs_buffer, wcslen(wcs_buffer));
2289 2289                  macro = get_prop(name->prop, macro_prop);
2290 2290                  if ((macro != NULL) && /* Maybe (macro == NULL) || ? */
2291 2291                      (IS_EQUAL(macro->body.macro.value->string_mb,
2292 2292                                "rv"))) {
2293 2293                          MBSTOWCS(wcs_buffer, "-rv");
2294      -                        value = GETNAME(wcs_buffer, wslen(wcs_buffer));
     2294 +                        value = GETNAME(wcs_buffer, wcslen(wcs_buffer));
2295 2295                          (void) SETVAR(name,
2296 2296                                        value,
2297 2297                                        false);
2298 2298                  }
2299 2299          }
2300 2300  
2301 2301          if (!posix && !svr4) {
2302 2302                  set_sgs_support();
2303 2303          }
2304 2304  
↓ open down ↓ 235 lines elided ↑ open up ↑
2540 2540                          if(!append)
2541 2541                                  append_or_replace_macro_in_dyn_array(makeflags_and_macro, argv[i]);
2542 2542  
2543 2543                          while (isspace(*(cp-1))) {
2544 2544                                  cp--;
2545 2545                          }
2546 2546                          tmp_char = *cp;
2547 2547                          *cp = (int) nul_char;
2548 2548                          MBSTOWCS(wcs_buffer, argv[i]);
2549 2549                          *cp = tmp_char;
2550      -                        name = GETNAME(wcs_buffer, wslen(wcs_buffer));
     2550 +                        name = GETNAME(wcs_buffer, wcslen(wcs_buffer));
2551 2551                          while (*cp != (int) equal_char) {
2552 2552                                  cp++;
2553 2553                          }
2554 2554                          cp++;
2555 2555                          while (isspace(*cp) && (*cp != (int) nul_char)) {
2556 2556                                  cp++;
2557 2557                          }
2558 2558                          if ((length = strlen(cp)) >= MAXPATHLEN) {
2559 2559                                  tmp_wcs_buffer = ALLOC_WC(length + 1);
2560 2560                                  (void) mbstowcs(tmp_wcs_buffer, cp, length + 1);
↓ open down ↓ 89 lines elided ↑ open up ↑
2650 2650                  read_only_saved = read_only;
2651 2651                  if ((length = strlen(*environment)) >= MAXPATHLEN) {
2652 2652                          tmp_wcs_buffer = ALLOC_WC(length + 1);
2653 2653                          alloced_tmp_wcs_buffer = true;
2654 2654                          (void) mbstowcs(tmp_wcs_buffer, *environment, length + 1);
2655 2655                          name = tmp_wcs_buffer;
2656 2656                  } else {
2657 2657                          MBSTOWCS(wcs_buffer, *environment);
2658 2658                          name = wcs_buffer;
2659 2659                  }
2660      -                value = (wchar_t *) wschr(name, (int) equal_char);
     2660 +                value = (wchar_t *) wcschr(name, (int) equal_char);
2661 2661  
2662 2662                  /*
2663 2663                   * Looks like there's a bug in the system, but sometimes
2664 2664                   * you can get blank lines in *environment.
2665 2665                   */
2666 2666                  if (!value) {
2667 2667                          continue;
2668 2668                  }
2669 2669                  MBSTOWCS(wcs_buffer2, "SHELL=");
2670      -                if (IS_WEQUALN(name, wcs_buffer2, wslen(wcs_buffer2))) {
     2670 +                if (IS_WEQUALN(name, wcs_buffer2, wcslen(wcs_buffer2))) {
2671 2671                          continue;
2672 2672                  }
2673 2673                  MBSTOWCS(wcs_buffer2, "MAKEFLAGS=");
2674      -                if (IS_WEQUALN(name, wcs_buffer2, wslen(wcs_buffer2))) {
     2674 +                if (IS_WEQUALN(name, wcs_buffer2, wcslen(wcs_buffer2))) {
2675 2675                          report_pwd = true;
2676 2676                          /*
2677 2677                           * In POSIX mode we do not want MAKEFLAGS to be readonly.
2678 2678                           * If the MAKEFLAGS macro is subsequently set by the makefile,
2679 2679                           * it replaces the MAKEFLAGS variable currently found in the
2680 2680                           * environment.
2681 2681                           * See Assertion 50 in section 6.2.5.3 of standard P1003.3.2/D8.
2682 2682                           */
2683 2683                          if(posix) {
2684 2684                                  read_only_saved = false;
↓ open down ↓ 2 lines elided ↑ open up ↑
2687 2687  
2688 2688                  /*
2689 2689                   * We ignore SUNPRO_DEPENDENCIES. This environment variable is
2690 2690                   * set by make and read by cpp which then writes info to
2691 2691                   * .make.dependency.xxx.  When make is invoked by another make
2692 2692                   * (recursive make), we don't want to read this because then
2693 2693                   * the child make will end up writing to the parent
2694 2694                   * directory's .make.state and clobbering them.
2695 2695                   */
2696 2696                  MBSTOWCS(wcs_buffer2, "SUNPRO_DEPENDENCIES");
2697      -                if (IS_WEQUALN(name, wcs_buffer2, wslen(wcs_buffer2))) {
     2697 +                if (IS_WEQUALN(name, wcs_buffer2, wcslen(wcs_buffer2))) {
2698 2698                          continue;
2699 2699                  }
2700 2700  
2701 2701                  macro = GETNAME(name, value - name);
2702 2702                  maybe_append_prop(macro, macro_prop)->body.macro.exported =
2703 2703                    true;
2704 2704                  if ((value == NULL) || ((value + 1)[0] == (int) nul_char)) {
2705 2705                          val = setvar_daemon(macro,
2706 2706                                              (Name) NULL,
2707 2707                                              false, no_daemon, false, debug_level);
↓ open down ↓ 96 lines elided ↑ open up ↑
2804 2804                                      (cp[1] == (int) '-') &&
2805 2805                                      (cp[2] == (int) ' ') &&
2806 2806                                      (cp[3] == (int) '-')) {
2807 2807                                      argv[i] = NULL;
2808 2808                                          continue;
2809 2809                                  }
2810 2810                                  MBSTOWCS(wcs_buffer, cp);
2811 2811                                  //default_target_to_build = GETNAME(wcs_buffer,
2812 2812                                  //                                FIND_LENGTH);
2813 2813                                  default_target_to_build = normalize_name(wcs_buffer,
2814      -                                                                  wslen(wcs_buffer));
     2814 +                                                                  wcslen(wcs_buffer));
2815 2815                                  if (default_target_to_build == wait_name) {
2816 2816                                          if (parallel_process_cnt > 0) {
2817 2817                                                  finish_running();
2818 2818                                          }
2819 2819                                          continue;
2820 2820                                  }
2821 2821                                  top_level_target = get_wstring(default_target_to_build->string_mb);
2822 2822                                  /*
2823 2823                                   * If we can't execute the current target in
2824 2824                                   * parallel, hold off the target processing
↓ open down ↓ 48 lines elided ↑ open up ↑
2873 2873                                  cp += 2;
2874 2874                          }
2875 2875                                   if((cp[0] == (int) ' ') &&
2876 2876                                      (cp[1] == (int) '-') &&
2877 2877                                      (cp[2] == (int) ' ') &&
2878 2878                                      (cp[3] == (int) '-')) {
2879 2879                                      argv[i] = NULL;
2880 2880                                          continue;
2881 2881                                  }
2882 2882                          MBSTOWCS(wcs_buffer, cp);
2883      -                        default_target_to_build = normalize_name(wcs_buffer, wslen(wcs_buffer));
     2883 +                        default_target_to_build = normalize_name(wcs_buffer, wcslen(wcs_buffer));
2884 2884                          top_level_target = get_wstring(default_target_to_build->string_mb);
2885 2885                          report_recursion(default_target_to_build);
2886 2886                          commands_done = false;
2887 2887                          if (parallel) {
2888 2888                                  result = (Doname) default_target_to_build->state;
2889 2889                          } else {
2890 2890                                  result = doname_check(default_target_to_build,
2891 2891                                                        true,
2892 2892                                                        false,
2893 2893                                                        false);
↓ open down ↓ 322 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX