1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: init.c |
2 | * File: init.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: init.C,v 1.7 2003/11/26 10:42:34 pcg Exp $ |
4 | * $Id: init.C,v 1.8 2003/11/27 10:12:10 pcg Exp $ |
5 | * |
5 | * |
6 | * All portions of code are copyright by their respective author/s. |
6 | * All portions of code are copyright by their respective author/s. |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
8 | * - original version |
8 | * - original version |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
… | |
… | |
1301 | else if (STRCMP(R->key_backspace, "DEC") == 0) |
1301 | else if (STRCMP(R->key_backspace, "DEC") == 0) |
1302 | er = '\177'; /* the initial state anyway */ |
1302 | er = '\177'; /* the initial state anyway */ |
1303 | else |
1303 | else |
1304 | #endif |
1304 | #endif |
1305 | er = -1; |
1305 | er = -1; |
|
|
1306 | |
1306 | rxvt_get_ttymode(&(R->tio), er); |
1307 | rxvt_get_ttymode(&(R->tio), er); |
1307 | |
|
|
1308 | /* install exit handler for cleanup */ |
|
|
1309 | #ifdef HAVE_ATEXIT |
|
|
1310 | atexit(rxvt_clean_exit); |
|
|
1311 | #else |
|
|
1312 | # ifdef HAVE_ON_EXIT |
|
|
1313 | on_exit(rxvt_clean_exit, NULL); /* non-ANSI exit handler */ |
|
|
1314 | # endif |
|
|
1315 | #endif |
|
|
1316 | |
|
|
1317 | signal(SIGHUP, rxvt_Exit_signal); |
|
|
1318 | #ifndef __svr4__ |
|
|
1319 | signal(SIGINT, rxvt_Exit_signal); |
|
|
1320 | #endif |
|
|
1321 | signal(SIGQUIT, rxvt_Exit_signal); |
|
|
1322 | signal(SIGTERM, rxvt_Exit_signal); |
|
|
1323 | signal(SIGCHLD, rxvt_Child_signal); |
|
|
1324 | |
|
|
1325 | /* need to trap SIGURG for SVR4 (Unixware) rlogin */ |
|
|
1326 | /* signal (SIGURG, SIG_DFL); */ |
|
|
1327 | |
1308 | |
1328 | #ifndef __QNX__ |
1309 | #ifndef __QNX__ |
1329 | /* spin off the command interpreter */ |
1310 | /* spin off the command interpreter */ |
1330 | switch (R->cmd_pid = fork()) { |
1311 | switch (R->cmd_pid = fork()) { |
1331 | case -1: |
1312 | case -1: |
… | |
… | |
1415 | } |
1396 | } |
1416 | #endif /* SRIOCSREDIR */ |
1397 | #endif /* SRIOCSREDIR */ |
1417 | } |
1398 | } |
1418 | |
1399 | |
1419 | /* reset signals and spin off the command interpreter */ |
1400 | /* reset signals and spin off the command interpreter */ |
1420 | signal(SIGINT, SIG_DFL); |
1401 | signal (SIGINT, SIG_DFL); |
1421 | signal(SIGQUIT, SIG_DFL); |
1402 | signal (SIGQUIT, SIG_DFL); |
1422 | signal(SIGCHLD, SIG_DFL); |
1403 | signal (SIGCHLD, SIG_DFL); |
1423 | /* |
1404 | /* |
1424 | * mimick login's behavior by disabling the job control signals |
1405 | * mimick login's behavior by disabling the job control signals |
1425 | * a shell that wants them can turn them back on |
1406 | * a shell that wants them can turn them back on |
1426 | */ |
1407 | */ |
1427 | #ifdef SIGTSTP |
1408 | #ifdef SIGTSTP |
1428 | signal(SIGTSTP, SIG_IGN); |
1409 | signal (SIGTSTP, SIG_IGN); |
1429 | signal(SIGTTIN, SIG_IGN); |
1410 | signal (SIGTTIN, SIG_IGN); |
1430 | signal(SIGTTOU, SIG_IGN); |
1411 | signal (SIGTTOU, SIG_IGN); |
1431 | #endif /* SIGTSTP */ |
1412 | #endif /* SIGTSTP */ |
1432 | |
1413 | |
1433 | /* set window size */ |
1414 | /* set window size */ |
1434 | rxvt_tt_winsize(STDIN_FILENO, R->TermWin.ncol, R->TermWin.nrow, 0); |
1415 | rxvt_tt_winsize(STDIN_FILENO, R->TermWin.ncol, R->TermWin.nrow, 0); |
1435 | |
1416 | |