From 4aa7fce693904721d89aa92ed01b89266e3bed1a Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 17 Jul 2019 23:08:28 -0400 Subject: sgr(): Add reset code --- (limited to 'src') diff --git a/src/sgr.c b/src/sgr.c index baec803..9e77f18 100644 --- a/src/sgr.c +++ b/src/sgr.c @@ -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)); } -- cgit v0.9.1