exit(8);
}
+static sig_atomic_t quit_requested;
+
+static void sigint_handler(int ignored) {
+ quit_requested= 1;
+}
+
int main(int argc, const char *const *argv) {
gsl_multimin_function multimin_function;
double size;
FILE *initial_f;
gsl_vector initial_gsl, step_size_gsl;
int r, i, size_check_counter= 0;
+ struct sigaction sa;
if (argc==3) {
input_file= argv[1];
if (final_file)
if (asprintf(&final_file_tmp,"%s.new",final_file) <= 0) diee("asprintf");
+ memset(&sa,0,sizeof(sa));
+ sa.sa_handler= sigint_handler;
+ sa.sa_flags= SA_RESETHAND;
+ r= sigaction(SIGINT,&sa,0);
+ if (r) diee("sigaction SIGINT");
+
+ mgraph_prepare();
graph_layout_prepare();
printing_init();
energy_init();
&initial_gsl, &step_size_gsl) );
for (;;) {
+ if (quit_requested) {
+ fprintf(stderr,"SIGINT caught.\n");
+ exit(1);
+ }
+
GA( gsl_multimin_fminimizer_iterate(minimiser) );
if (!(size_check_counter++ % DIM)) {