From 23f0b7760f862c1befa2c7b327acec9910abbcee Mon Sep 17 00:00:00 2001 From: Berk Geveci Date: Fri, 9 Nov 2001 16:05:33 -0500 Subject: Trying to fix curses. --- Source/CMakeLists.txt | 2 ++ Source/CursesDialog/CMakeLists.txt | 1 - Source/CursesDialog/cmCursesStandardIncludes.h | 22 ++++++++++++++++------ Source/CursesDialog/form/frm_driver.c | 22 ++++++++++++++++------ Source/CursesDialog/form/frm_req_name.c | 11 ++++++----- 5 files changed, 40 insertions(+), 18 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 164df10..191646f 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -49,7 +49,9 @@ ENDIF (WIN32) IF (UNIX) INCLUDE (${CMAKE_ROOT}/Modules/FindCurses.cmake) IF (CURSES_LIBRARY) + SUBDIRS(CursesDialog/form) SUBDIRS(CursesDialog) + SUBDIR_DEPENDS(CursesDialog CursesDialog/form) ENDIF (CURSES_LIBRARY) ENDIF (UNIX) diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 1382ace..391c9e2 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -1,4 +1,3 @@ -SUBDIRS(form) SOURCE_FILES( CURSES_SRCS cmCursesBoolWidget diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h index caa2216..b932d16 100644 --- a/Source/CursesDialog/cmCursesStandardIncludes.h +++ b/Source/CursesDialog/cmCursesStandardIncludes.h @@ -2,10 +2,20 @@ #define _MSE_INT_H #endif -#define _BOOL_DEFINED -#include -#define _XOPEN_SOURCE_EXTENDED -#include -#include -#undef _XOPEN_SOURCE_EXTENDED +#if defined(__hpux) + #define _BOOL_DEFINED + #include + #define _XOPEN_SOURCE_EXTENDED + #include + #include + #undef _XOPEN_SOURCE_EXTENDED +#else + #include + #include +#endif + +#ifndef getmaxyx + #define getmaxyx(w,y,x) ((y) = getmaxy(w), (x) = getmaxx(w)) +#endif + diff --git a/Source/CursesDialog/form/frm_driver.c b/Source/CursesDialog/form/frm_driver.c index f80b9a4..cc07b65 100644 --- a/Source/CursesDialog/form/frm_driver.c +++ b/Source/CursesDialog/form/frm_driver.c @@ -29,12 +29,13 @@ /**************************************************************************** * Author: Juergen Pfeifer 1995,1997 * ****************************************************************************/ -#define _XOPEN_SOURCE_EXTENDED -#ifdef __FreeBSD__ - #define _WCHAR_T -#endif /* __FreeBSD__ */ +#if defined(__hpux) + #define _XOPEN_SOURCE_EXTENDED +#endif #include "form.priv.h" -#undef _XOPEN_SOURCE_EXTENDED +#if defined(__hpux) + #undef _XOPEN_SOURCE_EXTENDED +#endif MODULE_ID("$Id$") @@ -1994,7 +1995,10 @@ static int Insert_String(FORM *form, int row, char *txt, int len) int requiredlen = len+1; char *split; int result = E_REQUEST_DENIED; - const char *Space = " "; + char *Space; + + Space = (char*)malloc(2*sizeof(char)); + strcpy(Space, " "); if (freelen >= requiredlen) { @@ -2002,6 +2006,7 @@ static int Insert_String(FORM *form, int row, char *txt, int len) winsnstr(form->w,txt,len); wmove(form->w,row,len); winsnstr(form->w,Space,1); + free(Space); return E_OK; } else @@ -2010,7 +2015,10 @@ static int Insert_String(FORM *form, int row, char *txt, int len) if ((row == (field->drows - 1)) && Growable(field)) { if (!Field_Grown(field,1)) + { + free(Space); return(E_SYSTEM_ERROR); + } /* !!!Side-Effect : might be changed due to growth!!! */ bp = Address_Of_Row_In_Buffer(field,row); } @@ -2033,9 +2041,11 @@ static int Insert_String(FORM *form, int row, char *txt, int len) winsnstr(form->w,txt,len); wmove(form->w,row,len); winsnstr(form->w,Space,1); + free(Space); return E_OK; } } + free(Space); return(result); } } diff --git a/Source/CursesDialog/form/frm_req_name.c b/Source/CursesDialog/form/frm_req_name.c index 6190c4b..0c0755b 100644 --- a/Source/CursesDialog/form/frm_req_name.c +++ b/Source/CursesDialog/form/frm_req_name.c @@ -35,12 +35,13 @@ * Routines to handle external names of menu requests * ***************************************************************************/ -#define _XOPEN_SOURCE_EXTENDED -#ifdef __FreeBSD__ - #define _WCHAR_T -#endif /* __FreeBSD__ */ +#if defined(__hpux) + #define _XOPEN_SOURCE_EXTENDED +#endif #include "form.priv.h" -#undef _XOPEN_SOURCE_EXTENDED +#if defined(__hpux) + #undef _XOPEN_SOURCE_EXTENDED +#endif MODULE_ID("$Id$") -- cgit v0.12