Skip to content

Commit

Permalink
fix error message formatting. All tests pass now
Browse files Browse the repository at this point in the history
  • Loading branch information
Whiteknight committed Dec 4, 2010
1 parent e1ced3e commit f6b62ed
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ static void parseflags_minimal(
static void print_parrot_string(
Parrot_PMC interp,
FILE *vector,
Parrot_String str);
Parrot_String str,
int newline);

static void show_last_error_and_exit(Parrot_PMC interp);
static void usage(ARGMOD(FILE *fp))
Expand Down Expand Up @@ -176,21 +177,21 @@ show_last_error_and_exit(Parrot_PMC interp)
exit(EXIT_FAILURE);
}

print_parrot_string(interp, stderr, errmsg);
print_parrot_string(interp, stderr, backtrace);
print_parrot_string(interp, stderr, errmsg, 1);
print_parrot_string(interp, stderr, backtrace, 0);

exit(exit_code);
}

static void
print_parrot_string(Parrot_PMC interp, FILE *vector, Parrot_String str)
print_parrot_string(Parrot_PMC interp, FILE *vector, Parrot_String str, int newline)
{
char * msg_raw;
if (!str)
return;
Parrot_api_string_export_ascii(interp, str, &msg_raw);
if (msg_raw) {
fprintf(vector, "%s\n", msg_raw);
fprintf(vector, "%s%s", msg_raw, newline ? "\n" : "");
Parrot_api_string_free_exported_ascii(interp, msg_raw);
}
}
Expand Down

0 comments on commit f6b62ed

Please sign in to comment.