Ticket #10476: singular-3-1-3-3.p7.diff
File singular-3-1-3-3.p7.diff, 8.4 KB (added by , 10 years ago) |
---|
-
SPKG.txt
# HG changeset patch # User Jeroen Demeyer <jdemeyer@cage.ugent.be> # Date 1340053245 -7200 # Node ID 8b9a7066b2afb196ef52ccda54e5a1b7b3100557 # Parent 1275ac543b538d5c59d6a2dddc94cb2d1475b493 Trac #10476: Add patch cntrlc.patch to disable the CTRL-C prompt diff --git a/SPKG.txt b/SPKG.txt
a b 38 38 autoconf-2.68 instead of autoconf-2.13. This fixes a build failure 39 39 on OS X 10.4 (Trac #12304). 40 40 * factory.GNUmakefile.in.patch to fix a hardcoded 'g++'. 41 * cntrlc.patch: Implement a --cntrlc option to disable the CTRL-C prompt. 41 42 42 43 Other notes 43 44 * The option '--without-dynamic-kernel' is used on *all* … … 54 55 55 56 == ChangeLog == 56 57 58 === singular-3-1-3-3.p7 (Jeroen Demeyer, 18 June 2012) === 59 * #10476: Add patch cntrlc.patch to disable the CTRL-C prompt. 60 * In spkg-install, remove distclean() step; merge clean_headers() and 61 part of the old distclean() into remove_old_version(). 62 * Replace TABs by spaces in spkg-install. 63 57 64 === singular-3-1-3-3.p6 (Leif Leonhardy, March 17th 2012) === 58 65 * #12680: Fix hardcoded 'g++' (and two typos) in factory/GNUmakefile.in. 59 66 -
new file patches/cntrlc.patch
diff --git a/patches/cntrlc.patch b/patches/cntrlc.patch new file mode 100644
- + 1 diff -ru src.orig/Singular/cntrlc.cc src/Singular/cntrlc.cc 2 --- src.orig/Singular/cntrlc.cc 2011-04-08 12:19:57.000000000 +0200 3 +++ src/Singular/cntrlc.cc 2012-06-18 17:17:43.000000000 +0200 4 @@ -73,6 +73,7 @@ 5 6 si_link pipeLastLink=NULL; 7 BOOLEAN singular_in_batchmode=FALSE; 8 +int cntrlc_prompt_answer = 0; 9 10 void sig_pipe_hdl(int sig) 11 { 12 @@ -378,7 +379,7 @@ 13 #endif /* SIGIOT */ 14 #ifdef SIGXCPU 15 si_set_signal(SIGXCPU, (void (*)(int))SIG_IGN); 16 - #endif /* SIGIOT */ 17 + #endif /* SIGXCPU */ 18 si_set_signal(SIGINT ,sigint_handler); 19 #if defined(HPUX_9) || defined(HPUX_10) 20 si_set_signal(SIGCHLD, (void (*)(int))SIG_IGN); 21 @@ -401,10 +402,15 @@ 22 { 23 int cnt=0; 24 int c; 25 - if(singular_in_batchmode) 26 + 27 + if (singular_in_batchmode) 28 { 29 c = 'q'; 30 } 31 + else if (cntrlc_prompt_answer) 32 + { 33 + c = cntrlc_prompt_answer; 34 + } 35 else 36 { 37 fprintf(stderr,"// ** Interrupt at cmd:`%s` in line:'%s'\n", 38 @@ -422,7 +428,7 @@ 39 40 switch(c) 41 { 42 - case 'q': 43 + case 'q': case EOF: 44 m2_end(2); 45 case 'r': 46 longjmp(si_start_jmpbuf,1); 47 @@ -432,7 +438,11 @@ 48 case 'a': 49 siCntrlc++; 50 case 'c': 51 - if (feGetOptValue(FE_OPT_EMACS) == NULL) fgetc(stdin); 52 + if (feGetOptValue(FE_OPT_EMACS) == NULL && !cntrlc_prompt_answer) 53 + { 54 + /* Read until a newline or EOF */ 55 + while (c != EOF && c != '\n') c = fgetc(stdin); 56 + } 57 si_set_signal(SIGINT ,(si_hdl_typ)sigint_handler); 58 return; 59 //siCntrlc ++; 60 diff -ru src.orig/Singular/cntrlc.h src/Singular/cntrlc.h 61 --- src.orig/Singular/cntrlc.h 2011-03-07 16:30:09.000000000 +0100 62 +++ src/Singular/cntrlc.h 2012-06-18 14:15:45.000000000 +0200 63 @@ -16,7 +16,12 @@ 64 extern BOOLEAN siCntrlc; 65 void init_signals(); 66 67 -extern BOOLEAN singular_in_batchmode; 68 /* TRUE for child of a fork or started with --batch*/ 69 +extern BOOLEAN singular_in_batchmode; 70 + 71 +/* If non-zero, do not prompt on SIGINT. Instead, use 72 + * cntlr_prompt_answer as answer (this could be set to 'a' to skip the 73 + * prompt and always assume the "abort" answer) . */ 74 +extern int cntrlc_prompt_answer; 75 76 #endif 77 diff -ru src.orig/Singular/feOpt.cc src/Singular/feOpt.cc 78 --- src.orig/Singular/feOpt.cc 2011-02-18 17:10:43.000000000 +0100 79 +++ src/Singular/feOpt.cc 2012-06-18 15:23:25.000000000 +0200 80 @@ -3,7 +3,7 @@ 81 ****************************************/ 82 /* $Id: feOpt.cc 13875 2011-02-18 16:10:43Z hannes $ */ 83 /* 84 -* ABSTRACT: Implementation of option buisness 85 +* ABSTRACT: Implementation of option business 86 */ 87 88 #include <string.h> 89 @@ -118,6 +118,9 @@ 90 {"browser", required_argument, LONG_OPTION_RETURN, 91 "BROWSER", "Display help in BROWSER (see help.cnf)", feOptString, 0, 0}, 92 93 + {"cntrlc", optional_argument, LONG_OPTION_RETURN, 94 + "CHAR", "Automatic answer for CTRL-C prompt", feOptString, 0, 0}, 95 + 96 #ifndef ESINGULAR 97 {"emacs", no_argument, LONG_OPTION_RETURN, 98 0, "Set defaults for running within emacs", feOptBool, 0, 0}, 99 @@ -358,6 +361,13 @@ 100 fe_fgets_stdin=fe_fgets_dummy; 101 return NULL; 102 103 + case FE_OPT_CNTRLC: 104 + if (feOptSpec[FE_OPT_CNTRLC].value) 105 + cntrlc_prompt_answer = ((char*)(feOptSpec[FE_OPT_CNTRLC].value))[0]; 106 + else 107 + cntrlc_prompt_answer = 0; 108 + return NULL; 109 + 110 case FE_OPT_HELP: 111 feOptHelp(feArgv0); 112 return NULL; 113 @@ -397,7 +407,7 @@ 114 115 case FE_OPT_RANDOM: 116 siRandomStart = (unsigned int) ((unsigned long) 117 - (feOptSpec[FE_OPT_RANDOM].value)); 118 + (feOptSpec[FE_OPT_RANDOM].value)); 119 siSeed=siRandomStart; 120 #ifdef HAVE_FACTORY 121 factoryseed(siRandomStart); -
spkg-install
diff --git a/spkg-install b/spkg-install
a b 97 97 fi 98 98 99 99 100 clean_headers()101 {102 rm -rf $SAGE_LOCAL/include/singular103 }104 105 100 apply_patches() 106 101 { 107 pushd $SRC102 cd "$SRC" 108 103 109 patches="assert.h.diff sing_win.cc.diff Minor.h.patch os_x_ppc.patch \110 Singular.configure.patch make_parallel.patch Singular.Makefile.in.shared.patch \111 104 patches="assert.h.diff sing_win.cc.diff Minor.h.patch cntrlc.patch \ 105 os_x_ppc.patch Singular.configure.patch make_parallel.patch \ 106 Singular.Makefile.in.shared.patch factory.GNUmakefile.in.patch" 112 107 113 108 if [ "$UNAME" = "CYGWIN" ]; then 114 109 patches="$patches IntegerProgramming-Makefile.in.diff" … … 125 120 fi 126 121 done 127 122 128 # Finally, copy the new src/factory/configure 129 # We don't use patch for this, since the file is completely changed. 130 # The .patch file would be larger than the complete patched file. 131 cp -p ../patches/factory_configure factory/configure 132 133 popd 123 # Finally, copy the new src/factory/configure 124 # We don't use patch for this, since the file is completely changed. 125 # The .patch file would be larger than the complete patched file. 126 cp -p ../patches/factory_configure factory/configure 134 127 } 135 128 136 distclean()129 remove_old_version() 137 130 { 138 cd $SRC 139 $MAKE distclean 140 rm $SAGE_LOCAL/bin/Singular* 141 find . -name *.dl_o -exec rm \{\} \; 142 find . -name *.o -exec rm \{\} \; 143 find . -name *.og -exec rm \{\} \; 144 find . -name *.so -exec rm \{\} \; 145 find . -name *.a -exec rm \{\} \; 146 rm -f $SAGE_LOCAL/include/factory.h 147 rm -f $SAGE_LOCAL/include/factoryconf.h 131 rm -f "$SAGE_LOCAL"/bin/Singular* 132 rm -f "$SAGE_LOCAL/include/factory.h" 133 rm -f "$SAGE_LOCAL/include/factoryconf.h" 134 rm -rf "$SAGE_LOCAL/include/singular" 148 135 } 149 136 150 137 config() 151 138 { 152 cd $SRC139 cd "$SRC" 153 140 ./configure --prefix="$SAGE_LOCAL" \ 154 141 --exec-prefix="$SAGE_LOCAL" \ 155 142 --bindir="$SAGE_LOCAL"/bin \ … … 181 168 182 169 build_singular() 183 170 { 184 cd $SRC171 cd "$SRC" 185 172 186 173 # Build Singular + rest 187 174 $MAKE … … 201 188 fi 202 189 fi 203 190 204 cd $SRC191 cd "$SRC" 205 192 if [ $? -ne 0 ]; then 206 193 echo "Unable to change to directory $SRC" 207 194 exit 1 … … 248 235 249 236 build_libsingular() 250 237 { 251 cd $SRC238 cd "$SRC" 252 239 if [ $? -ne 0 ]; then 253 240 echo "Unable to change to directory $SRC" 254 241 exit 1 … … 276 263 277 264 build_factory() 278 265 { 279 cd $SRC/factory266 cd "$SRC/factory" 280 267 281 268 $MAKE distclean 282 269 … … 318 305 319 306 build_libfac() 320 307 { 321 cd $SRC/libfac308 cd "$SRC/libfac" 322 309 if [ $? -ne 0 ]; then 323 310 echo "Error changing to directory $SRC/libfac" 324 311 exit 1 … … 372 359 373 360 build() 374 361 { 375 for i in clean_headers apply_patches distclean config build_singular build_libsingular build_factory build_libfac create_singular_script install_docs ; do 362 for i in apply_patches remove_old_version config \ 363 build_singular build_libsingular build_factory build_libfac \ 364 create_singular_script install_docs ; do 376 365 $i 377 366 if [ $? -ne 0 ]; then 378 367 echo "Error building Singular at stage '$i'."