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

@@ -109,13 +109,13 @@
         *string_end = (int) nul_char;
         /*
          * Check if there are any ( or [ that are not prefixed with $.
          * If there are, we have to deal with the lib.a(members) format.
          */
-        for (cp = (wchar_t *) wschr(string_start, (int) parenleft_char);
+        for (cp = (wchar_t *) wcschr(string_start, (int) parenleft_char);
              cp != NULL;
-             cp = (wchar_t *) wschr(cp + 1, (int) parenleft_char)) {
+             cp = (wchar_t *) wcschr(cp + 1, (int) parenleft_char)) {
                 if (*(cp - 1) != (int) dollar_char) {
                         *string_end = ch;
                         return enter_member_name(string_start,
                                                  cp,
                                                  string_end,

@@ -214,11 +214,11 @@
                 entry = true;
                 member_start++;
         }
         /* Move the library name to the buffer where we intend to build the */
         /* "lib.a(member)" for each member */
-        (void) wsncpy(buffer, lib_start, member_start - lib_start);
+        (void) wcsncpy(buffer, lib_start, member_start - lib_start);
         memberp = buffer + (member_start-lib_start);
         while (1) {
                 long_member_name = NULL;
                 /* Skip leading spaces */
                 for (;

@@ -243,11 +243,11 @@
                         }
                 }
                 /* Internalize the member name */
                 member = GETNAME(memberp, cq - memberp);
                 *cq = 0;
-                if ((q = (wchar_t *) wsrchr(memberp, (int) slash_char)) == NULL) {
+                if ((q = (wchar_t *) wcsrchr(memberp, (int) slash_char)) == NULL) {
                         q = memberp;
                 }
                 if ((cq - q > (int) ar_member_name_len) &&
                     !has_dollar) {
                         *cq++ = (int) parenright_char;

@@ -395,11 +395,11 @@
         name_string = string;
         string2 = name_string;          /*save for free*/
         current_component =
           cdp =
             string =
-              ALLOC_WC((length = wslen(name_string)) + 1);
+              ALLOC_WC((length = wcslen(name_string)) + 1);
         while (length > 0) {
                 if (((length > 3) &&
                      (name_string[0] == (int) slash_char) &&
                      (name_string[1] == (int) period_char) &&
                      (name_string[2] == (int) period_char) &&

@@ -656,11 +656,11 @@
         Wstring tstr(target);
         wchar_t * wcb = tstr.get_string();
         if ((makefile_type == reading_makefile) &&
             (default_target_to_build == NULL) &&
             ((wcb[0] != (int) period_char) ||
-             wschr(wcb, (int) slash_char))) {
+             wcschr(wcb, (int) slash_char))) {
 
 /* BID 1181577: $(EMPTY_MACRO) + $(EMPTY_MACRO):
 ** The target with empty name cannot be default_target_to_build
 */
                 if (target->hash.length != 0)

@@ -745,20 +745,20 @@
                 if (command != NULL) {
                         if (line->body.line.command_template != NULL) {
                                 line->body.line.command_template_redefined =
                                   true;
                                 if ((wcb[0] == (int) period_char) &&
-                                    !wschr(wcb, (int) slash_char)) {
+                                    !wcschr(wcb, (int) slash_char)) {
                                         line->body.line.command_template =
                                           command;
                                 }
                         } else {
                                 line->body.line.command_template = command;
                         }
                 } else {
                         if ((wcb[0] == (int) period_char) &&
-                            !wschr(wcb, (int) slash_char)) {
+                            !wcschr(wcb, (int) slash_char)) {
                                 line->body.line.command_template = command;
                         }
                 }
                 break;
         case rereading_statefile:

@@ -945,11 +945,11 @@
 
         /* get patterns count */
         Wstring wcb(target);
         cp = wcb.get_string();
         while (true) {
-                cp = (wchar_t *) wschr(cp, (int) percent_char);
+                cp = (wchar_t *) wcschr(cp, (int) percent_char);
                 if (cp != NULL) {
                         result->patterns_total++;
                         cp++;
                 } else {
                         break;

@@ -962,11 +962,11 @@
 
         /* then create patterns */
         cp = wcb.get_string();
         pattern = 0;
         while (true) {
-                cp1 = (wchar_t *) wschr(cp, (int) percent_char);
+                cp1 = (wchar_t *) wcschr(cp, (int) percent_char);
                 if (cp1 != NULL) {
                         result->patterns[pattern] = GETNAME(cp, cp1 - cp);
                         cp = cp1 + 1;
                         pattern++;
                 } else {

@@ -996,11 +996,11 @@
                         if (depe->name->percent) {
                                 /* get patterns count */
                                 wcb1.init(depe->name);
                                 cp = wcb1.get_string();
                                 while (true) {
-                                        cp = (wchar_t *) wschr(cp, (int) percent_char);
+                                        cp = (wchar_t *) wcschr(cp, (int) percent_char);
                                         if (cp != NULL) {
                                                 depe->patterns_total++;
                                                 cp++;
                                         } else {
                                                 break;

@@ -1013,11 +1013,11 @@
 
                                 /* then create patterns */
                                 cp = wcb1.get_string();
                                 pattern = 0;
                                 while (true) {
-                                        cp1 = (wchar_t *) wschr(cp, (int) percent_char);
+                                        cp1 = (wchar_t *) wcschr(cp, (int) percent_char);
                                         if (cp1 != NULL) {
                                                 depe->patterns[pattern] = GETNAME(cp, cp1 - cp);
                                                 cp = cp1 + 1;
                                                 pattern++;
                                         } else {

@@ -1566,16 +1566,16 @@
         int                     i;
         int                     len;
 
         /* Check if the path is already relative. */
         if (to[0] != (int) slash_char) {
-                (void) wscpy(result, to);
+                (void) wcscpy(result, to);
                 return;
         }
 
         MBSTOWCS(wcs_buffer, get_current_path());
-        from = allocated = (wchar_t *) wsdup(wcs_buffer);
+        from = allocated = (wchar_t *) wcsdup(wcs_buffer);
 
         /*
          * Find the number of components in the from name.
          * ncomp = number of slashes + 1.
          */

@@ -1606,11 +1606,11 @@
          * for either name terminating exactly.
          */
         if (*from == (int) nul_char) {
                 if (*to == (int) nul_char) {
                         MBSTOWCS(wcs_buffer, ".");
-                        (void) wscpy(result, wcs_buffer);
+                        (void) wcscpy(result, wcs_buffer);
                         retmem(allocated);
                         return;
                 }
                 if (*to == (int) slash_char) {
                         ncomps--;

@@ -1621,19 +1621,19 @@
                 tocomp = to;
         }
         /* Add on the ".."s. */
         for (i = 0; i < ncomps; i++) {
                 MBSTOWCS(wcs_buffer, "../");
-                (void) wscat(result, wcs_buffer);
+                (void) wcscat(result, wcs_buffer);
         }
 
         /* Add on the remainder of the to name, if any. */
         if (*tocomp == (int) nul_char) {
-                len = wslen(result);
+                len = wcslen(result);
                 result[len - 1] = (int) nul_char;
         } else {
-                (void) wscat(result, tocomp);
+                (void) wcscat(result, tocomp);
         }
         retmem(allocated);
         return;
 }
 

@@ -1804,11 +1804,11 @@
                 MBSTOWCS(colon_shell, ":shell");
         }
         Wstring nms((*name));
         wchar_t * wcb = nms.get_string();
 
-        colon = (wchar_t *) wsrchr(wcb, (int) colon_char);
+        colon = (wchar_t *) wcsrchr(wcb, (int) colon_char);
         if ((colon != NULL) && (IS_WEQUAL(colon, colon_sh) || IS_WEQUAL(colon, colon_shell))) {
                 INIT_STRING_FROM_STACK(destination, buffer);
 
                 if(*value == NULL) {
                         buffer[0] = 0;