Changeset 32cb7a in git for Singular/cntrlc.cc
- Timestamp:
- Oct 12, 2012, 5:18:39 PM (12 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- 17874ed75ee295b8f839c9c6087da10a82e6ff2e
- Parents:
- b51d2ccd49597e776969d2543051d6119c88d59b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/cntrlc.cc
rb51d2c r32cb7a 373 373 #endif 374 374 375 376 375 /*2 377 376 * signal handler for SIGINT 378 377 */ 378 int sigint_handler_cnt=0; 379 379 void sigint_handler(int sig) 380 380 { … … 383 383 if (fe_is_raw_tty) fe_temp_reset(); 384 384 #endif /* HAVE_FEREAD */ 385 char default_opt=' '; 386 if ((feOptSpec[FE_OPT_CNTRLC].value!=NULL) 387 && ((char*)(feOptSpec[FE_OPT_CNTRLC].value))[0]) 388 { default_opt=((char*)(feOptSpec[FE_OPT_CNTRLC].value))[0]; } 385 389 loop 386 390 { 387 391 int cnt=0; 388 392 int c; 389 if(singular_in_batchmode) 393 394 if (singular_in_batchmode) 390 395 { 391 396 c = 'q'; 397 } 398 else if (default_opt!=' ') 399 { 400 c = default_opt; 392 401 } 393 402 else … … 397 406 if (feGetOptValue(FE_OPT_EMACS) == NULL) 398 407 { 399 fputs("abort command(a), continue(c) or quit Singular(q) ?",stderr);fflush(stderr);408 fputs("abort after this command(a), abort immediately(r), print backtrace(b), continue(c) or quit Singular(q) ?",stderr);fflush(stderr); 400 409 c = fgetc(stdin); 401 410 } … … 408 417 switch(c) 409 418 { 410 case 'q': 419 case 'q': case EOF: 411 420 m2_end(2); 412 421 case 'r': 413 longjmp(si_start_jmpbuf,1); 422 if (sigint_handler_cnt<3) 423 { 424 sigint_handler_cnt++; 425 fputs("** Warning: Singular should be restarted as soon as possible **\n",stderr); 426 fflush(stderr); 427 longjmp(si_start_jmpbuf,1); 428 } 429 else 430 { 431 fputs("** tried too often, try another possibility **\n",stderr); 432 fflush(stderr); 433 } 434 break; 414 435 case 'b': 415 436 VoiceBackTrack(); … … 418 439 siCntrlc++; 419 440 case 'c': 420 if (feGetOptValue(FE_OPT_EMACS) == NULL) fgetc(stdin); 441 if ((feGetOptValue(FE_OPT_EMACS) == NULL) && (default_opt!=' ')) 442 { 443 /* Read until a newline or EOF */ 444 while (c != EOF && c != '\n') c = fgetc(stdin); 445 } 421 446 si_set_signal(SIGINT ,(si_hdl_typ)sigint_handler); 422 447 return;
Note: See TracChangeset
for help on using the changeset viewer.