View Single Post
Old 2021-06-08, 13:49   #5
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

71408 Posts
Default

Quote:
Originally Posted by kruoli View Post
Maybe you could use the return value of ecm if it is killed by ^C?

Code:
~$ ecm 1e9
GMP-ECM 7.0.4 [configured with GMP 6.2.0, --enable-asm-redc] [ECM]
2^1277-1
Input number is 2^1277-1 (385 digits)
Using B1=1000000000, B2=19071176724616, polynomial Dickson(30), sigma=0:8818687562867645865
^C
~$ echo $?
130
If the return value of ecm is 130, interrupt. Or print a message and wait at least a second or two for the user to hit ^C again. Just an idea.
Good idea, but I've tried that
Quote:
Originally Posted by yafu: ecm.c
// run system command
retcode = system(cmd);

free(tmpstr);
free(cmd);

// this is what I observed ecm returning on ctrl-c. hopefully it is portable.
if (retcode == 33280)
ECM_ABORT = 1;
But it's not portable... I've seen different numbers returned at different times on different systems.

Waiting for a second is a good idea also. Will have to consider that.
bsquared is offline   Reply With Quote