From 3c2f770be2fd8d57245755cbcca85cc972c57677 Mon Sep 17 00:00:00 2001 From: Kevin Lange Date: Sun, 9 Feb 2014 00:32:35 -0800 Subject: [PATCH] Add option to skip intro in telnet mode. I am dropping the intro from my instance and also making it not run permanently (sorry, limited bandwidth until I get this on a dedicated cloud instance somewhere). --- src/nyancat.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/nyancat.c b/src/nyancat.c index f35f1c6..98b0192 100644 --- a/src/nyancat.c +++ b/src/nyancat.c @@ -319,6 +319,7 @@ int main(int argc, char ** argv) { /* Whether or not to show the MOTD intro */ char show_intro = 0; + char skip_intro = 0; /* Long option names */ static struct option long_opts[] = { @@ -340,7 +341,7 @@ int main(int argc, char ** argv) { /* Process arguments */ int index, c; - while ((c = getopt_long(argc, argv, "eshitnf:r:R:c:C:W:H:", long_opts, &index)) != -1) { + while ((c = getopt_long(argc, argv, "eshiItnf:r:R:c:C:W:H:", long_opts, &index)) != -1) { if (!c) { if (long_opts[index].flag == 0) { c = long_opts[index].val; @@ -356,6 +357,9 @@ int main(int argc, char ** argv) { case 'i': /* Show introduction */ show_intro = 1; break; + case 'I': + skip_intro = 1; + break; case 't': /* Expect telnet bits */ telnet = 1; break; @@ -397,8 +401,8 @@ int main(int argc, char ** argv) { if (telnet) { /* Telnet mode */ - /* Intro is implied by telnet mode, so override whatever was asked for. */ - show_intro = 1; + /* show_intro is implied unless skip_intro was set */ + show_intro = (skip_intro == 0) ? 1 : 0; /* Set the default options */ set_options();