Skip to content

Commit

Permalink
Add config option "flowcontrol" to disable XON/XOFF.
Browse files Browse the repository at this point in the history
  • Loading branch information
paxed committed Dec 18, 2012
1 parent d30dbda commit 768cddf
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.l
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ encoding { return TYPE_ENCODING; }
locale { return TYPE_LOCALE; }
default_term { return TYPE_DEFTERM; }
utf8esc { return TYPE_UTF8ESC; }
flowcontrol { return TYPE_FLOWCTRL; }
filemode { return TYPE_FILEMODE; }
yes { yylval.i = 1; return TYPE_BOOL; }
no { yylval.i = 0; return TYPE_BOOL; }
Expand Down
6 changes: 6 additions & 0 deletions config.y
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static int sortmode_number(const char *sortmode_name) {
%token TYPE_POSTCMDQUEUE TYPE_TIMEFORMAT
%token TYPE_MAX_IDLE_TIME TYPE_MENU_MAX_IDLE_TIME TYPE_EXTRA_INFO_FILE
%token TYPE_ENCODING TYPE_LOCALE TYPE_UTF8ESC TYPE_FILEMODE TYPE_DEFTERM
%token TYPE_FLOWCTRL
%token <s> TYPE_VALUE
%token <i> TYPE_NUMBER TYPE_CMDQUEUENAME
%type <kt> KeyType
Expand Down Expand Up @@ -233,6 +234,9 @@ KeyPair: TYPE_CMDQUEUE '[' TYPE_CMDQUEUENAME ']'
case TYPE_UTF8ESC:
globalconfig.utf8esc = $<i>3;
break;
case TYPE_FLOWCTRL:
globalconfig.flowctrl = $<i>3;
break;
default:
fprintf(stderr, "%s:%d: token %s does not take a boolean, bailing out\n",
config, line, lookup_token($1));
Expand Down Expand Up @@ -652,6 +656,7 @@ KeyType : TYPE_SUSER { $$ = TYPE_SUSER; }
| TYPE_LOCALE { $$ = TYPE_LOCALE; }
| TYPE_DEFTERM { $$ = TYPE_DEFTERM; }
| TYPE_UTF8ESC { $$ = TYPE_UTF8ESC; }
| TYPE_FLOWCTRL { $$ = TYPE_FLOWCTRL; }
| TYPE_RC_FMT { $$ = TYPE_RC_FMT; }
| TYPE_WATCH_SORTMODE { $$ = TYPE_WATCH_SORTMODE; }
| TYPE_FILEMODE { $$ = TYPE_FILEMODE; }
Expand Down Expand Up @@ -690,6 +695,7 @@ const char* lookup_token (int t)
case TYPE_LOCALE: return "locale";
case TYPE_DEFTERM: return "default_term";
case TYPE_UTF8ESC: return "utf8esc";
case TYPE_FLOWCTRL: return "flowcontrol";
case TYPE_FILEMODE: return "filemode";
default: abort();
}
Expand Down
6 changes: 6 additions & 0 deletions dgamelaunch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2791,6 +2791,12 @@ main (int argc, char** argv)
signal (SIGTERM, catch_sighup);

(void) tcgetattr (0, &tt);

if (!globalconfig.flowctrl) {
tt.c_iflag &= ~(IXON | IXOFF | IXANY); /* Disable XON/XOFF */
(void) tcsetattr(0, TCSANOW, &tt);
}

if (-1 == ioctl (0, TIOCGWINSZ, (char *) &win) || win.ws_row < 4 ||
win.ws_col < 4) /* Rudimentary validity check */
{
Expand Down
1 change: 1 addition & 0 deletions dgamelaunch.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ struct dg_globalconfig
char *locale;
int utf8esc; /* send select-utf8-charset escape code */
char *defterm; /* default TERM in case user TERM is unknown */
int flowctrl; /* XON/XOFF for games? */

struct dg_cmdpart *cmdqueue[NUM_DGLTIMES];

Expand Down
1 change: 1 addition & 0 deletions dgl-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ create_config ()

globalconfig.sortmode = SORTMODE_USERNAME;
globalconfig.utf8esc = 0;
globalconfig.flowctrl = -1; /* undefined, don't touch it */

if (config)
{
Expand Down
4 changes: 4 additions & 0 deletions examples/dgamelaunch.conf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ default_term = "xterm"
# default is no.
#utf8esc = yes

# Should dgl allow XON/XOFF? Default is "yes", meaning "don't touch it".
# "no" disables XON/XOFF
#flowcontrol = no

# Maximum time in seconds user can idle in the dgamelaunch menus
# before dgl exits. Default value is 0, which disables the idling timer.
# Does not apply to external programs or config editors.
Expand Down

0 comments on commit 768cddf

Please sign in to comment.