aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeetz0r <peter@haas-en-berg.nl>2011-12-05 19:37:50 +0100
committerPeetz0r <peter@haas-en-berg.nl>2011-12-05 19:37:50 +0100
commit5cc51e5021c5f12eaa9e3b918bb1b025d6dc27b6 (patch)
tree210a829d90967c9cd8ea3d715f45198ba632366b
parent616b5189fac7f6d6b3b284224ba61bbf21ef61bb (diff)
downloadnyancat-5cc51e5021c5f12eaa9e3b918bb1b025d6dc27b6.tar.gz
Actually limit the terminal width in the right place
-rw-r--r--src/nyancat.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nyancat.c b/src/nyancat.c
index cb71217..70348e2 100644
--- a/src/nyancat.c
+++ b/src/nyancat.c
@@ -121,7 +121,7 @@ int digits(int val) {
* (^C) so that we can restore the cursor.
*/
void SIGINT_handler(int sig){
- printf("\033[?25h\033[0m");
+ printf("\\033[?25h\033[0m");
exit(0);
}
@@ -366,18 +366,19 @@ int main(int argc, char ** argv) {
char * nterm = getenv("TERM");
strcpy(term, nterm);
- /* Also get the number of columns, but not above 80 */
+ /* Also get the number of columns */
struct winsize w;
ioctl(0, TIOCGWINSZ, &w);
terminal_width = w.ws_col;
-
- if(terminal_width > 80) terminal_width = 80;
}
/* Convert the entire terminal string to lower case */
for (k = 0; k < strlen(term); ++k) {
term[k] = tolower(term[k]);
}
+
+ /* We don't want terminals wider than 80 columns */
+ if(terminal_width > 80) terminal_width = 80;
/* Do our terminal detection */
if (strstr(term, "xterm")) {
class='insertions'>+10 2012-03-05Fix copypasta errorv1.1Jonathan McCrohan1-10/+18 2012-03-05Rearrange syslog output to read 8N1 rather than N81Jonathan McCrohan1-2/+2 2012-03-05Refactor codeJonathan McCrohan2-6/+4 2012-03-05Add syslog loggingJonathan McCrohan1-24/+57 2012-03-04Remove unused #define statementsJonathan McCrohan1-3/+0 2012-02-20Prune archive after 3 monthsJonathan McCrohan3-0/+7 2012-02-20Update documentationJonathan McCrohan1-3/+5 2012-02-20Add PHP to make installJonathan McCrohan1-0/+3 2012-02-20Update MakefileJonathan McCrohan1-0/+17 2012-02-20Move interval.txt to src/Jonathan McCrohan2-1/+1 2012-02-19Remove debug/testing files.Jonathan McCrohan50-4742/+0 2012-02-15Archive files after upload.Jonathan McCrohan1-0/+2 2012-02-12Fix typo in README.Jonathan McCrohan1-1/+1 2012-02-12Add ftp upload function + add documentation.Jonathan McCrohan5-3/+151 2012-01-10Handle 32bit signed overflow.Jonathan McCrohan1-1/+6 2012-01-10Update README.Jonathan McCrohan1-1/+3