diff -urp units-2-13/configure units-2.13/configure --- units-2-13/configure 2016-06-21 06:40:36 +1000 +++ units-2.13/configure 2017-02-21 22:42:20 +1000 @@ -2992,7 +2992,7 @@ if ${ax_cv_check_cflags___fpic+:} false; else ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -fpic" + CFLAGS="$CFLAGS -Werror -fpic" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3376,7 +3376,8 @@ fi done if test "$ac_cv_lib_readline_readline" = yes; then - ac_fn_c_check_decl "$LINENO" "rl_completion_suppress_append" "ac_cv_have_decl_rl_completion_suppress_append" "#include + ac_fn_c_check_decl "$LINENO" "rl_completion_suppress_append" "ac_cv_have_decl_rl_completion_suppress_append" "#include +#include " if test "x$ac_cv_have_decl_rl_completion_suppress_append" = xyes; then : diff -urp units-2-13/Makefile.in units-2.13/Makefile.in --- units-2-13/Makefile.in 2016-06-12 22:38:33 +1000 +++ units-2.13/Makefile.in 2017-02-22 11:47:49 +1000 @@ -216,7 +216,8 @@ uninstall: else true; fi clean mostlyclean: texclean - -rm -f *.obj *.res units.exe units.dvi units.1 distname .chk units_cur_inst units_cur + -rm -f *.@OBJEXT@ *.res units@EXEEXT@ units.dvi units.1 distname .chk \ + units_cur_inst units_cur -rm -rf wwwold wwwnew distclean: clean diff -urp units-2-13/units.c units-2.13/units.c --- units-2-13/units.c 2016-06-21 10:42:45 +1000 +++ units-2.13/units.c 2017-02-23 10:36:31 +1000 @@ -25,7 +25,7 @@ #define _XOPEN_SOURCE 600 -#if defined (_WIN32) && defined (_MSC_VER) +#if defined (_WIN32) && !defined (HAVE_MKS_TOOLKIT) # include # include #endif @@ -99,7 +99,7 @@ #endif #ifndef EOFCHAR -# ifdef _WIN32 +# if defined (_WIN32) && !defined(READLINE) # define EOFCHAR "Z" # else # define EOFCHAR "D" @@ -194,6 +194,7 @@ struct parseflag parserflags; /* parse char *homeunitsfile = ".units"; /* Units filename in home directory */ char *pager; /* Actual pager (from PAGER environment var) */ +int prompt_lines; /* Lines to deduct from screen height */ char *mylocale; /* Locale in effect (from LC_CTYPE or LANG) */ int utf8mode; /* Activate UTF8 support */ char *powerstring = "^"; /* Exponent character used in output */ @@ -392,7 +393,7 @@ replace_minus(char *input) char *unicode_minus[] = { "\xE2\x80\x92", /* U+2012: figure dash */ "\xE2\x80\x93", /* U+2013: en dash */ - "\xE2\x88\x92", /* U+2212: minus */ + "\xE2\x88\x92", /* U+2212: minus */ 0 }; char *inptr, *outptr, *ptr, **minus; @@ -3552,7 +3553,12 @@ compnd(const void *a, const void *b) int screensize() { - return 20; +#if defined (_WIN32) && !defined (HAVE_MKS_TOOLKIT) + CONSOLE_SCREEN_BUFFER_INFO csbi; + if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi)) + return csbi.srWindow.Bottom - csbi.srWindow.Top + 1 - prompt_lines; +#endif + return 24 - prompt_lines; } @@ -3920,7 +3926,7 @@ getprogdir(char *progname, char **fullpr char *progdir = NULL; char *p; -#if defined (_WIN32) && defined (_MSC_VER) +#if defined (_WIN32) && !defined (HAVE_MKS_TOOLKIT) char buf[FILENAME_MAX + 1]; /* get the full pathname of the current executable and be done with it */ @@ -3945,7 +3951,7 @@ getprogdir(char *progname, char **fullpr interpreter under Windows if the current directory is not in PATH but contains 'units' or 'units.exe' */ -#if defined (_WIN32) && !defined (_MSC_VER) +#ifdef _WIN32 if (!progdir && checkcwd(progname)) progdir = dupstr(progname); #endif @@ -4121,7 +4127,7 @@ findlocalemap(int checkonly) } /* check the directory with the units data file */ - if (!map) { + if (!map && unitsfiles[0]) { if (filename) free(filename); filename = (char *) mymalloc(strlen(unitsfiles[0]) + strlen(file) + 2, @@ -5564,6 +5570,12 @@ main(int argc, char **argv) datadir = NULL; /* directory to search as last resort */ checklocale(); +#ifdef _WIN32 + localemap = findlocalemap(0); + if (localemap) + remaplocale(localemap); +#endif + #ifdef READLINE # if RL_READLINE_VERSION > 0x0402 rl_completion_entry_function = (rl_compentry_func_t *)completeunits; @@ -5635,12 +5647,6 @@ main(int argc, char **argv) } } -#ifdef _WIN32 - localemap = findlocalemap(0); - if (localemap) - remaplocale(localemap); -#endif - for(unitfileptr=unitsfiles;*unitfileptr;unitfileptr++){ readerr = readunits(*unitfileptr, stderr, &unitcount, &prefixcount, &funccount, 0); @@ -5727,6 +5733,7 @@ main(int argc, char **argv) if (!pager) pager = DEFAULTPAGER; for (;;) { + prompt_lines = 1; do { fflush(stdout); getuser(&havestr,&havestrsize,queryhave); @@ -5761,6 +5768,7 @@ main(int argc, char **argv) } do { int repeat; + prompt_lines = 2; do { repeat = 0; fflush(stdout); diff -urp units-2-13/units_cur2 units-2.13/units_cur2 --- units-2-13/units_cur2 2015-09-10 10:27:12 +1000 +++ units-2.13/units_cur2 2015-11-11 22:56:52 +1000 @@ -25,6 +25,8 @@ from datetime import datetime from unidecode import unidecode outfile = 'currency.units' +if not os.path.exists(outfile): + outfile = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),'../share/units/currency.units')) outstr = '' diff -urp units-2-13/units_cur3 units-2.13/units_cur3 --- units-2-13/units_cur3 2015-09-10 10:27:28 +1000 +++ units-2.13/units_cur3 2015-11-11 22:56:52 +1000 @@ -25,6 +25,8 @@ from datetime import datetime from unidecode import unidecode outfile = 'currency.units' +if not os.path.exists(outfile): + outfile = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),'../share/units/currency.units')) outstr = ''