(mh_format): Count the newline as output
character (for compatibility with other implementations). Set arg_num whe evaluating headers. (mh_format,mh_format_dump): Handle mhop_nop.
Showing
1 changed file
with
11 additions
and
1 deletions
... | @@ -442,7 +442,7 @@ mh_format (mh_format_t *fmt, message_t msg, size_t msgno, | ... | @@ -442,7 +442,7 @@ mh_format (mh_format_t *fmt, message_t msg, size_t msgno, |
442 | mach.message = msg; | 442 | mach.message = msg; |
443 | mach.msgno = msgno; | 443 | mach.msgno = msgno; |
444 | 444 | ||
445 | mach.width = width; | 445 | mach.width = width - 1; /* Do not count newlines */ |
446 | mach.pc = 1; | 446 | mach.pc = 1; |
447 | obstack_init (&mach.stk); | 447 | obstack_init (&mach.stk); |
448 | list_create (&mach.addrlist); | 448 | list_create (&mach.addrlist); |
... | @@ -454,6 +454,9 @@ mh_format (mh_format_t *fmt, message_t msg, size_t msgno, | ... | @@ -454,6 +454,9 @@ mh_format (mh_format_t *fmt, message_t msg, size_t msgno, |
454 | mh_opcode_t opcode; | 454 | mh_opcode_t opcode; |
455 | switch (opcode = MHI_OPCODE(mach.prog[mach.pc++])) | 455 | switch (opcode = MHI_OPCODE(mach.prog[mach.pc++])) |
456 | { | 456 | { |
457 | case mhop_nop: | ||
458 | break; | ||
459 | |||
457 | case mhop_stop: | 460 | case mhop_stop: |
458 | mach.stop = 1; | 461 | mach.stop = 1; |
459 | break; | 462 | break; |
... | @@ -513,7 +516,10 @@ mh_format (mh_format_t *fmt, message_t msg, size_t msgno, | ... | @@ -513,7 +516,10 @@ mh_format (mh_format_t *fmt, message_t msg, size_t msgno, |
513 | mach.arg_str.size = len + 1; | 516 | mach.arg_str.size = len + 1; |
514 | compress_ws (value, &len); | 517 | compress_ws (value, &len); |
515 | mach.arg_str.ptr = value; | 518 | mach.arg_str.ptr = value; |
519 | mach.arg_num = 1; | ||
516 | } | 520 | } |
521 | else | ||
522 | mach.arg_num = 0; | ||
517 | } | 523 | } |
518 | break; | 524 | break; |
519 | 525 | ||
... | @@ -636,6 +642,10 @@ mh_format_dump (mh_format_t *fmt) | ... | @@ -636,6 +642,10 @@ mh_format_dump (mh_format_t *fmt) |
636 | printf ("% 4.4ld: ", (long) pc); | 642 | printf ("% 4.4ld: ", (long) pc); |
637 | switch (opcode = MHI_OPCODE(prog[pc++])) | 643 | switch (opcode = MHI_OPCODE(prog[pc++])) |
638 | { | 644 | { |
645 | case mhop_nop: | ||
646 | printf ("nop"); | ||
647 | break; | ||
648 | |||
639 | case mhop_stop: | 649 | case mhop_stop: |
640 | printf ("stop"); | 650 | printf ("stop"); |
641 | stop = 1; | 651 | stop = 1; | ... | ... |
-
Please register or sign in to post a comment