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/pmake.cc
          +++ new/usr/src/cmd/make/bin/pmake.cc
↓ open down ↓ 182 lines elided ↑ open up ↑
 183  183                                  (void) mbstowcs(make_machines_list,
 184  184                                                  make_machines_list_mb,
 185  185                                                  (strlen(make_machines_list_mb) + 1));
 186  186                          }
 187  187                  }
 188  188          }
 189  189  
 190  190          uname(&uts_info);
 191  191          strcpy(local_host_mb, &uts_info.nodename[0]);
 192  192          MBSTOWCS(local_host, local_host_mb);
 193      -        local_host_wslen = wslen(local_host);
      193 +        local_host_wslen = wcslen(local_host);
 194  194  
 195  195          // There is no getdomainname() function on Solaris.
 196  196          // And netname2host() function does not work on Linux.
 197  197          // So we have to use different APIs.
 198  198          if (host2netname(mbs_buffer, NULL, NULL) &&
 199  199              netname2host(mbs_buffer, mbs_buffer2, MAXNETNAMELEN+1)) {
 200  200                  MBSTOWCS(full_host, mbs_buffer2);
 201      -                full_host_wslen = wslen(full_host);
      201 +                full_host_wslen = wcslen(full_host);
 202  202          }
 203  203  
 204  204          for (ms = make_machines_list;
 205  205               (ms) && (*ms );
 206  206               ) {
 207  207                  /*
 208  208                   * Skip white space and comments till you reach
 209  209                   * a machine name.
 210  210                   */
 211  211                  pskip_till_next_word(&ms);
↓ open down ↓ 18 lines elided ↑ open up ↑
 230  230                           */
 231  231                          if ((c == '#') && (*ms != '\n') && (*ms)) {
 232  232                                  *ms = '#';
 233  233                          }
 234  234                          WCSTOMBS(mbs_buffer, mp);
 235  235                          /*
 236  236                           * Print "Ignoring unknown host" if:
 237  237                           * 1) hostname is longer than MAX_HOSTNAMELEN, or
 238  238                           * 2) hostname is unknown
 239  239                           */
 240      -                        if ((wslen(mp) > MAX_HOSTNAMELEN) ||
      240 +                        if ((wcslen(mp) > MAX_HOSTNAMELEN) ||
 241  241                              ((hp = gethostbyname(mbs_buffer)) == NULL)) {
 242  242                                  warning(gettext("Ignoring unknown host %s"),
 243  243                                          mbs_buffer);
 244  244                                  SKIPTOEND(ms);
 245  245                                  /* Increment ptr if not end of file. */
 246  246                                  if (*ms) {
 247  247                                          ms++;
 248  248                                  }
 249  249                          } else {
 250  250                                  /* Compare current hostname with local_host. */
 251      -                                if (wslen(mp) == local_host_wslen &&
      251 +                                if (wcslen(mp) == local_host_wslen &&
 252  252                                      IS_WEQUALN(mp, local_host, local_host_wslen)) {
 253  253                                          /*
 254  254                                           * Bingo, local_host is in .make.machines.
 255  255                                           * Continue reading.
 256  256                                           */
 257  257                                          pmake_max_jobs = PMAKE_DEF_MAX_JOBS;
 258  258                                  /* Compare current hostname with full_host. */
 259      -                                } else if (wslen(mp) == full_host_wslen &&
      259 +                                } else if (wcslen(mp) == full_host_wslen &&
 260  260                                             IS_WEQUALN(mp, full_host, full_host_wslen)) {
 261  261                                          /*
 262  262                                           * Bingo, full_host is in .make.machines.
 263  263                                           * Continue reading.
 264  264                                           */
 265  265                                          pmake_max_jobs = PMAKE_DEF_MAX_JOBS;
 266  266                                  } else {
 267  267                                          if (c != '\n') {
 268  268                                              SKIPTOEND(ms);
 269  269                                              if (*ms) {
↓ open down ↓ 151 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX