Skip to content

Commit

Permalink
Merge pull request #65 from ChinYikMing/pr
Browse files Browse the repository at this point in the history
Support conversion specifier "%c" inside printf
  • Loading branch information
jserv authored Jul 27, 2023
2 parents adc6b38 + bc271a0 commit 8655b21
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ void printf(char *str, ...)
int l = strlen(var_args[pi]);
strcpy(buffer + bi, var_args[pi]);
bi += l;
} else if (str[si] == 'c') {
/* append param pi as char */
buffer[bi] = var_args[pi];
bi += 1;
} else if (str[si] == 'd') {
/* append param as decimal */
int v = var_args[pi];
Expand Down

0 comments on commit 8655b21

Please sign in to comment.