| 367 | |
| 368 | #if defined(SHELL) || defined(DEF_PAGER) || defined(DEF_MAILREADER) |
| 369 | int |
| 370 | child(int wt) |
| 371 | { |
| 372 | int f; |
| 373 | |
| 374 | suspend_nhwindows((char *) 0); /* also calls end_screen() */ |
| 375 | #ifdef _M_UNIX |
| 376 | sco_mapon(); |
| 377 | #endif |
| 378 | #ifdef __linux__ |
| 379 | linux_mapon(); |
| 380 | #endif |
| 381 | if ((f = fork()) == 0) { /* child */ |
| 382 | (void) setgid(getgid()); |
| 383 | (void) setuid(getuid()); |
| 384 | #ifdef CHDIR |
| 385 | (void) chdir(getenv("HOME")); |
| 386 | #endif |
| 387 | return 1; |
| 388 | } |
| 389 | if (f == -1) { /* cannot fork */ |
| 390 | pline("Fork failed. Try again."); |
| 391 | return 0; |
| 392 | } |
| 393 | /* fork succeeded; wait for child to exit */ |
| 394 | #ifndef NO_SIGNAL |
| 395 | (void) signal(SIGINT, SIG_IGN); |
| 396 | (void) signal(SIGQUIT, SIG_IGN); |
| 397 | #endif |
| 398 | (void) wait((int *) 0); |
| 399 | #ifdef _M_UNIX |
| 400 | sco_mapoff(); |
| 401 | #endif |
| 402 | #ifdef __linux__ |
| 403 | linux_mapoff(); |
| 404 | #endif |
| 405 | #ifndef NO_SIGNAL |
| 406 | (void) signal(SIGINT, (SIG_RET_TYPE) done1); |
| 407 | if (wizard) |
| 408 | (void) signal(SIGQUIT, SIG_DFL); |
| 409 | #endif |
| 410 | if (wt) { |
| 411 | raw_print(""); |
| 412 | wait_synch(); |
| 413 | } |
| 414 | resume_nhwindows(); |
| 415 | return 0; |
| 416 | } |
| 417 | #endif /* SHELL || DEF_PAGER || DEF_MAILREADER */ |
| 418 | |
| 419 | #ifdef GETRES_SUPPORT |
no test coverage detected