*** hugs.c.~1~ Tue Feb 29 02:29:00 2000 --- hugs.c Sun Mar 4 15:39:24 2001 *************** *** 672,675 **** --- 672,676 ---- (!state && haskell98))) { FPrintf(stderr,"Haskell 98 compatibility cannot be changed while the interpreter is running\n"); + FFlush(stderr); } else { haskell98 = state; *************** *** 696,707 **** hpSize = MAXIMUMHEAP; if (heapBuilt() && hpSize != heapSize) { #if HUGS_FOR_WINDOWS ! MessageBox(hWndMain, "Change to heap size will not take effect until you rerun Hugs", appName, MB_ICONHAND | MB_OK); #endif #if USE_REGISTRY ! FPrintf(stderr,"Change to heap size will not take effect until you rerun Hugs\n"); #else FPrintf(stderr,"Cannot change heap size\n"); #endif } else { heapSize = hpSize; --- 697,711 ---- hpSize = MAXIMUMHEAP; if (heapBuilt() && hpSize != heapSize) { + #define HEAP_RESIZE_MSG "Change to heap size will not take effect until you rerun Hugs" #if HUGS_FOR_WINDOWS ! MessageBox(hWndMain, HEAP_RESIZE_MSG, appName, MB_ICONHAND | MB_OK); #endif #if USE_REGISTRY ! FPrintf(stderr,HEAP_RESIZE_MSG "\n"); #else FPrintf(stderr,"Cannot change heap size\n"); #endif + #undef HEAP_RESIZE_MSG + FFlush(stderr); } else { heapSize = hpSize; *************** *** 984,991 **** * ------------------------------------------------------------------------*/ static Void local changeDir() { /* change directory */ ! String s = readFilename(); ! if (s && chdir(s)) { ! ERRMSG(0) "Unable to change to directory \"%s\"", s EEND; } --- 988,1027 ---- * ------------------------------------------------------------------------*/ + /* + * Poor man's path expansion: expand out ~/ + */ + static Void local expandPath(origPath,expandedPath,maxLen) + String origPath; + String expandedPath; + unsigned int maxLen; + { + + if (!origPath) { + return; + } + + /* If the original path starts with "~/", expand it. */ + if (*origPath == '~' && *(origPath+1) == '/') { + unsigned int origLen; + String home = getenv("HOME"); + origLen = (origPath ? strlen(origPath) : 0); + /* The expansion of $HOME will fit in iff + * (maxLength - length(unexpanded) - length("~")) >= length("$HOME") + */ + if ( (maxLen - origLen - 1) >= strlen(home) ) { + strcpy(expandedPath, home); + strcat(expandedPath, origPath+1); + return; + } + } + strcpy(expandedPath, origPath); + } + static Void local changeDir() { /* change directory */ ! String path = readFilename(); ! char expandedPath[FILENAME_MAX+1]; ! expandPath(path, expandedPath,FILENAME_MAX); ! if (path && chdir(expandedPath)) { ! ERRMSG(0) "Unable to change to directory \"%s\"", path EEND; }