mirror of
https://github.com/alrayyes/st.git
synced 2024-11-23 03:36:21 +00:00
Remove duplicated code in strhandle
The error condition was duplicated in two different switches. This new version centralized the error handling in only one place.
This commit is contained in:
parent
21d905c076
commit
a8d5870073
1 changed files with 10 additions and 14 deletions
24
st.c
24
st.c
|
@ -2152,20 +2152,21 @@ csireset(void) {
|
||||||
void
|
void
|
||||||
strhandle(void) {
|
strhandle(void) {
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
int i, j, narg;
|
int j, narg, par;
|
||||||
|
|
||||||
strparse();
|
strparse();
|
||||||
narg = strescseq.narg;
|
narg = strescseq.narg;
|
||||||
|
par = atoi(strescseq.args[0]);
|
||||||
|
|
||||||
switch(strescseq.type) {
|
switch(strescseq.type) {
|
||||||
case ']': /* OSC -- Operating System Command */
|
case ']': /* OSC -- Operating System Command */
|
||||||
switch(i = atoi(strescseq.args[0])) {
|
switch(par) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
if(narg > 1)
|
if(narg > 1)
|
||||||
xsettitle(strescseq.args[1]);
|
xsettitle(strescseq.args[1]);
|
||||||
break;
|
return;
|
||||||
case 4: /* color set */
|
case 4: /* color set */
|
||||||
if(narg < 3)
|
if(narg < 3)
|
||||||
break;
|
break;
|
||||||
|
@ -2182,25 +2183,20 @@ strhandle(void) {
|
||||||
*/
|
*/
|
||||||
redraw(0);
|
redraw(0);
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
default:
|
|
||||||
fprintf(stderr, "erresc: unknown str ");
|
|
||||||
strdump();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'k': /* old title set compatibility */
|
case 'k': /* old title set compatibility */
|
||||||
xsettitle(strescseq.args[0]);
|
xsettitle(strescseq.args[0]);
|
||||||
break;
|
return;
|
||||||
case 'P': /* DSC -- Device Control String */
|
case 'P': /* DSC -- Device Control String */
|
||||||
case '_': /* APC -- Application Program Command */
|
case '_': /* APC -- Application Program Command */
|
||||||
case '^': /* PM -- Privacy Message */
|
case '^': /* PM -- Privacy Message */
|
||||||
default:
|
return;
|
||||||
fprintf(stderr, "erresc: unknown str ");
|
|
||||||
strdump();
|
|
||||||
/* die(""); */
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "erresc: unknown str ");
|
||||||
|
strdump();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue