make: use the more modern wchar routines, not widec.h
334 file_being_read = wcb;
335 } else {
336 char *stdin_text_p;
337 char *stdin_text_end;
338 char *stdin_buffer_start;
339 char *stdin_buffer_end;
340 char *p_mb;
341 int num_mb_chars;
342 size_t num_wc_chars;
343
344 MBSTOWCS(wcs_buffer, "Standard in");
345 makefile_name = GETNAME(wcs_buffer, FIND_LENGTH);
346 /*
347 * Memory to read standard in, then convert it
348 * to wide char strings.
349 */
350 stdin_buffer_start =
351 stdin_text_p = getmem(length = 1024);
352 stdin_buffer_end = stdin_text_p + length;
353 MBSTOWCS(wcs_buffer, "standard input");
354 file_being_read = (wchar_t *) wsdup(wcs_buffer);
355 line_number = 0;
356 while ((n = read(fileno(stdin),
357 stdin_text_p,
358 length)) > 0) {
359 length -= n;
360 stdin_text_p += n;
361 if (length == 0) {
362 p_mb = getmem(length = 1024 +
363 (stdin_buffer_end -
364 stdin_buffer_start));
365 (void) strncpy(p_mb,
366 stdin_buffer_start,
367 (stdin_buffer_end -
368 stdin_buffer_start));
369 retmem_mb(stdin_buffer_start);
370 stdin_text_p = p_mb +
371 (stdin_buffer_end - stdin_buffer_start);
372 stdin_buffer_start = p_mb;
373 stdin_buffer_end =
374 stdin_buffer_start + length;
810 }
811 /* if include file name is surrounded by double quotes */
812 if ((name_start[0] == (int) doublequote_char) &&
813 (name_start[name_length - 1] == (int) doublequote_char)) {
814 name_start += 1;
815 name_length -= 2;
816
817 /* if name does not begin with a slash char */
818 if (name_start[0] != (int) slash_char) {
819 if ((name_start[0] == (int) period_char) &&
820 (name_start[1] == (int) slash_char)) {
821 name_start += 2;
822 name_length -= 2;
823 }
824
825 INIT_STRING_FROM_STACK(include_name, include_buffer);
826 APPEND_NAME(true_makefile_name,
827 &include_name,
828 true_makefile_name->hash.length);
829
830 wchar_t *slash = wsrchr(include_name.buffer.start, (int) slash_char);
831 if (slash != NULL) {
832 include_name.text.p = slash + 1;
833 append_string(name_start,
834 &include_name,
835 name_length);
836
837 name_start = include_name.buffer.start;
838 name_length = include_name.text.p - name_start;
839 }
840 }
841 }
842
843 /* Even when we run -n we want to create makefiles */
844 do_not_exec_rule = false;
845 makefile_name = GETNAME(name_start, name_length);
846 if (makefile_name->dollar) {
847 String_rec destination;
848 wchar_t buffer[STRING_BUFFER_LENGTH];
849 wchar_t *p;
850 wchar_t *q;
|
334 file_being_read = wcb;
335 } else {
336 char *stdin_text_p;
337 char *stdin_text_end;
338 char *stdin_buffer_start;
339 char *stdin_buffer_end;
340 char *p_mb;
341 int num_mb_chars;
342 size_t num_wc_chars;
343
344 MBSTOWCS(wcs_buffer, "Standard in");
345 makefile_name = GETNAME(wcs_buffer, FIND_LENGTH);
346 /*
347 * Memory to read standard in, then convert it
348 * to wide char strings.
349 */
350 stdin_buffer_start =
351 stdin_text_p = getmem(length = 1024);
352 stdin_buffer_end = stdin_text_p + length;
353 MBSTOWCS(wcs_buffer, "standard input");
354 file_being_read = (wchar_t *) wcsdup(wcs_buffer);
355 line_number = 0;
356 while ((n = read(fileno(stdin),
357 stdin_text_p,
358 length)) > 0) {
359 length -= n;
360 stdin_text_p += n;
361 if (length == 0) {
362 p_mb = getmem(length = 1024 +
363 (stdin_buffer_end -
364 stdin_buffer_start));
365 (void) strncpy(p_mb,
366 stdin_buffer_start,
367 (stdin_buffer_end -
368 stdin_buffer_start));
369 retmem_mb(stdin_buffer_start);
370 stdin_text_p = p_mb +
371 (stdin_buffer_end - stdin_buffer_start);
372 stdin_buffer_start = p_mb;
373 stdin_buffer_end =
374 stdin_buffer_start + length;
810 }
811 /* if include file name is surrounded by double quotes */
812 if ((name_start[0] == (int) doublequote_char) &&
813 (name_start[name_length - 1] == (int) doublequote_char)) {
814 name_start += 1;
815 name_length -= 2;
816
817 /* if name does not begin with a slash char */
818 if (name_start[0] != (int) slash_char) {
819 if ((name_start[0] == (int) period_char) &&
820 (name_start[1] == (int) slash_char)) {
821 name_start += 2;
822 name_length -= 2;
823 }
824
825 INIT_STRING_FROM_STACK(include_name, include_buffer);
826 APPEND_NAME(true_makefile_name,
827 &include_name,
828 true_makefile_name->hash.length);
829
830 wchar_t *slash = wcsrchr(include_name.buffer.start, (int) slash_char);
831 if (slash != NULL) {
832 include_name.text.p = slash + 1;
833 append_string(name_start,
834 &include_name,
835 name_length);
836
837 name_start = include_name.buffer.start;
838 name_length = include_name.text.p - name_start;
839 }
840 }
841 }
842
843 /* Even when we run -n we want to create makefiles */
844 do_not_exec_rule = false;
845 makefile_name = GETNAME(name_start, name_length);
846 if (makefile_name->dollar) {
847 String_rec destination;
848 wchar_t buffer[STRING_BUFFER_LENGTH];
849 wchar_t *p;
850 wchar_t *q;
|