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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/lib/mksh/dosys.cc
          +++ new/usr/src/cmd/make/lib/mksh/dosys.cc
↓ open down ↓ 171 lines elided ↑ open up ↑
 172  172           * if the nice priority, nice_prio, is NOT zero (0).
 173  173           * Nice priorities can be a positive or a negative number.
 174  174           */
 175  175          if (nice_prio != 0) {
 176  176                  argv[argv_index++] = (char *)"nice";
 177  177                  (void) sprintf(nice_prio_buf, "-%d", nice_prio);
 178  178                  argv[argv_index++] = strdup(nice_prio_buf);
 179  179          }
 180  180          argv[argv_index++] = shellname;
 181  181          argv[argv_index++] = (char*)(ignore_error ? "-c" : "-ce");
 182      -        if ((length = wslen(command)) >= MAXPATHLEN) {
      182 +        if ((length = wcslen(command)) >= MAXPATHLEN) {
 183  183                  tmp_mbs_buffer = getmem((length * MB_LEN_MAX) + 1);
 184  184                  (void) wcstombs(tmp_mbs_buffer, command, (length * MB_LEN_MAX) + 1);
 185  185                  cmd_argv_index = argv_index;
 186  186                  argv[argv_index++] = strdup(tmp_mbs_buffer);
 187  187                  retmem_mb(tmp_mbs_buffer);
 188  188          } else {
 189  189                  WCSTOMBS(mbs_buffer, command);
 190  190                  cmd_argv_index = argv_index;
 191  191                  argv[argv_index++] = strdup(mbs_buffer);
 192  192          }
↓ open down ↓ 142 lines elided ↑ open up ↑
 335  335                          arg_count++;
 336  336                  }
 337  337          }
 338  338          argv = (char **)alloca(arg_count * (sizeof(char *)));
 339  339          /*
 340  340           * Reserve argv[0] for sh in case of exec_vp failure.
 341  341           * Don't worry about prepending /usr/bin/nice command to argv[0].
 342  342           * In fact, doing it may cause the sh command to fail!
 343  343           */
 344  344          p = &argv[1];
 345      -        if ((length = wslen(command)) >= MAXPATHLEN) {
      345 +        if ((length = wcslen(command)) >= MAXPATHLEN) {
 346  346                  tmp_mbs_buffer = getmem((length * MB_LEN_MAX) + 1);
 347  347                  (void) wcstombs(tmp_mbs_buffer, command, (length * MB_LEN_MAX) + 1);
 348  348                  argv[0] = strdup(tmp_mbs_buffer);
 349  349                  retmem_mb(tmp_mbs_buffer);
 350  350          } else {
 351  351                  WCSTOMBS(mbs_buffer, command);
 352  352                  argv[0] = strdup(mbs_buffer);
 353  353          }
 354  354  
 355  355          if (nice_prio != 0) {
↓ open down ↓ 10 lines elided ↑ open up ↑
 366  366                                mbs_buffer,
 367  367                                arg_count);
 368  368                  }
 369  369                  q = t;
 370  370                  while (!iswspace(*t) && (*t != (int) nul_char)) {
 371  371                          t++;
 372  372                  }
 373  373                  if (*t) {
 374  374                          for (*t++ = (int) nul_char; iswspace(*t); t++);
 375  375                  }
 376      -                if ((length = wslen(q)) >= MAXPATHLEN) {
      376 +                if ((length = wcslen(q)) >= MAXPATHLEN) {
 377  377                          tmp_mbs_buffer = getmem((length * MB_LEN_MAX) + 1);
 378  378                          (void) wcstombs(tmp_mbs_buffer, q, (length * MB_LEN_MAX) + 1);
 379  379                          *p++ = strdup(tmp_mbs_buffer);
 380  380                          retmem_mb(tmp_mbs_buffer);
 381  381                  } else {
 382  382                          WCSTOMBS(mbs_buffer, q);
 383  383                          *p++ = strdup(mbs_buffer);
 384  384                  }
 385  385          }
 386  386          *p = NULL;
↓ open down ↓ 192 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX