Commit daf9fced daf9fceded320cdd2f3d1bac1fe92ec665b69780 by Sergey Poznyakoff

(print_simple_segment): Bugfix.

1 parent 9a1a450b
...@@ -261,7 +261,12 @@ print_simple_segment (struct mh_machine *mach, size_t width, ...@@ -261,7 +261,12 @@ print_simple_segment (struct mh_machine *mach, size_t width,
261 261
262 rest = width - mach->ind; 262 rest = width - mach->ind;
263 if (rest == 0) 263 if (rest == 0)
264 return; 264 {
265 if (len == 1 && str[0] == '\n')
266 put_string (mach, str, len);
267 return;
268 }
269
265 if (len > rest) 270 if (len > rest)
266 len = rest; 271 len = rest;
267 272
...@@ -1879,10 +1884,27 @@ builtin_concat (struct mh_machine *mach) ...@@ -1879,10 +1884,27 @@ builtin_concat (struct mh_machine *mach)
1879 static void 1884 static void
1880 builtin_printhdr (struct mh_machine *mach) 1885 builtin_printhdr (struct mh_machine *mach)
1881 { 1886 {
1887 char *tmp = NULL;
1888 size_t s = 0;
1889
1882 if (!strobj_is_null (&mach->arg_str)) 1890 if (!strobj_is_null (&mach->arg_str))
1883 print_hdr_string (mach, strobj_ptr (&mach->arg_str)); 1891 {
1892 s = strobj_len (&mach->arg_str);
1893 tmp = strdup (strobj_ptr (&mach->arg_str));
1894 }
1895
1884 if (!strobj_is_null (&mach->reg_str)) 1896 if (!strobj_is_null (&mach->reg_str))
1885 print_hdr_string (mach, strobj_ptr (&mach->reg_str)); 1897 {
1898 s += strobj_len (&mach->reg_str) + 1;
1899 tmp = realloc (tmp, s);
1900 strcat (tmp, strobj_ptr (&mach->reg_str));
1901 }
1902
1903 if (tmp)
1904 {
1905 print_hdr_string (mach, tmp);
1906 free (tmp);
1907 }
1886 } 1908 }
1887 1909
1888 static void 1910 static void
......