Index: ut_unixAssert.cpp =================================================================== --- ut_unixAssert.cpp (Revision 22362) +++ ut_unixAssert.cpp (Arbeitskopie) @@ -28,34 +28,49 @@ void UT_UnixAssertMsg(const char * szMsg, const char * szFile, int iLine) { static int count = 0; - - printf("\n"); - printf("**** (%d) Assert ****\n", ++count); - printf("**** (%d) %s at %s:%d ****\n", count,szMsg,szFile,iLine); - while (1) + static bool env_checked = false; + static bool assert_enabled = true; + + if ( !env_checked ) { - printf("**** (%d) Continue ? (y/n) [y] : ", count); - fflush(stdout); + env_checked = true; + char* setting = getenv("ABIWORD_ASSERT"); + if ( (setting != NULL) && (strcmp(setting, "disabled") == 0) ) + { + assert_enabled = false; + } + } - char buf[10]; - memset(buf,0,10); + if ( assert_enabled ) + { + printf("\n"); + printf("**** (%d) Assert ****\n", ++count); + printf("**** (%d) %s at %s:%d ****\n", count,szMsg,szFile,iLine); + while (1) + { + printf("**** (%d) Continue ? (y/n) [y] : ", count); + fflush(stdout); - fgets(buf,10,stdin); + char buf[10]; + memset(buf,0,10); - switch (buf[0]) - { - case '\0': - case '\n': - case 'y': - case 'Y': - return; // continue the application + fgets(buf,10,stdin); - case 'n': - case 'N': - abort(); // kill the application - return; - default: - break; // ?? ask them again + switch (buf[0]) + { + case '\0': + case '\n': + case 'y': + case 'Y': + return; // continue the application + + case 'n': + case 'N': + abort(); // kill the application + return; + default: + break; // ?? ask them again + } } } }