diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-07-17 23:08:28 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-07-17 23:08:28 (EDT) |
commit | 4aa7fce693904721d89aa92ed01b89266e3bed1a (patch) | |
tree | 896f8d4b052e4bdc7e9be74eb2d6820fd66c468b /src | |
parent | 54e97f3899dd747137f972c80c78196299acb3c5 (diff) |
sgr(): Add reset code
Diffstat (limited to 'src')
-rw-r--r-- | src/sgr.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -61,7 +61,15 @@ sgr(char *param, png_colorp fg, png_colorp bg) end = 1; } *param = '\0'; - i = atoi(p); + if (*p) { + i = atoi(p); + } else { + i = 0; + } + if (i == 0) { /* Reset */ + memcpy(fg, &_4bit[7], sizeof(*fg)); + memcpy(bg, &_4bit[0], sizeof(*bg)); + } if (i >= 30 && i <= 37) { /* Set foreground color */ memcpy(fg, &_4bit[i - 30], sizeof(*fg)); } |