From: <suc...@us...> - 2006-08-06 18:01:38
|
Revision: 180 Author: sucknblow Date: 2006-08-06 11:01:32 -0700 (Sun, 06 Aug 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=180&view=rev Log Message: ----------- Oops. fd_is_tty is always used, and therefore always needs to be initialised, regardless of whether we can detect terminal size. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/util.c Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-05 22:50:29 UTC (rev 179) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-08-06 18:01:32 UTC (rev 180) @@ -96,11 +96,11 @@ void display_init() { -#if CAN_GET_WIN_SIZE int i; for(i = 0; i <= 2; ++i) fd_is_tty[i] = isatty(i); +#if CAN_GET_WIN_SIZE signal(SIGWINCH,window_size_changed); window_size_changed(0); #endif/*CAN_GET_WIN_SIZE*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-12-24 01:56:05
|
Revision: 193 http://svn.sourceforge.net/pmplib/?rev=193&view=rev Author: nyaochi Date: 2006-12-23 17:56:05 -0800 (Sat, 23 Dec 2006) Log Message: ----------- Make the source compatible with Win32 (MSVC): - Win32 does not have TTY support. Introduced HAVE_TTY but I haven't changed configure.in yet. - MSVC does not support array definitions with variable length: char hoge[strlen(str)+1]; must be char *hoge = alloca(sizeof(*str) + (strlen(str)+1)); Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/util.c Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2006-12-24 01:35:06 UTC (rev 192) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2006-12-24 01:56:05 UTC (rev 193) @@ -114,14 +114,16 @@ */ void display_init() { +#ifdef HAVE_TTY int i; for(i = 0; i <= POSSIBLE_TTYS; ++i) fd_is_tty[i] = isatty(i); -#if CAN_GET_WIN_SIZE +#if CAN_GET_WIN_SIZE signal(SIGWINCH,window_size_changed); window_size_changed(0); #endif/*CAN_GET_WIN_SIZE*/ +#endif/*HAVE_TTY*/ } /** @@ -160,6 +162,9 @@ void display_line(FILE *fp, const ucs2char_t* const line, unsigned int min_width) { + unsigned int length = ucs2len(line); + const ucs2char_t* line_to_print; + int writing_to_tty; /* Check if writing to a terminal. If so, clear the current line. */ int fd = fileno(fp); @@ -170,9 +175,6 @@ writing_to_tty = 0; } - unsigned int length = ucs2len(line); - const ucs2char_t* line_to_print; - if(!writing_to_tty) { /* Write the whole line to the file, add \n. */ fprints(fp, "%s\r\n", line); @@ -187,8 +189,7 @@ /* Length of string we actually will display: */ const size_t trunc_length = MIN(max_trunc_length, length); - ucs2char_t truncated_line[trunc_length+1]; - truncated_line[trunc_length]=0; + ucs2char_t *truncated_line = ucs2calloc(sizeof(ucs2char_t) * (trunc_length+1)); ucs2ncpy(truncated_line, line, trunc_length); fprints(fp, "%s\r", truncated_line); } @@ -217,9 +218,9 @@ // Numeric part, plus associated punctuation const int prefix_length = 16; - char fmt[prefix_length + 1]; + char *fmt = alloca(sizeof(char) * prefix_length + 1); - ucs2char_t line[ucs2len(msg) + prefix_length + 1]; + ucs2char_t *line = alloca(sizeof(ucs2char_t) * (ucs2len(msg) + prefix_length + 1)); ucs2char_t *fmt_ucs2; // Build the numeric part... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-01-07 19:38:17
|
Revision: 251 http://svn.sourceforge.net/pmplib/?rev=251&view=rev Author: nyaochi Date: 2007-01-07 11:38:17 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Oops, I forgot to uncomment the line for console_clearln(). Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/util.c Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2007-01-07 19:36:24 UTC (rev 250) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-01-07 19:38:17 UTC (rev 251) @@ -78,7 +78,7 @@ *p++ = ' '; ucs2cpy(p, msg); - //console_clearln(fp); + console_clearln(fp); console_println(fp, str, 0); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2007-02-06 17:41:39
|
Revision: 302 http://svn.sourceforge.net/pmplib/?rev=302&view=rev Author: nyaochi Date: 2007-02-06 09:41:05 -0800 (Tue, 06 Feb 2007) Log Message: ----------- Improved the status displaying in CUI. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/cui/util.c Modified: trunk/pmplib/frontend/easypmp/cui/util.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-06 12:09:59 UTC (rev 301) +++ trunk/pmplib/frontend/easypmp/cui/util.c 2007-02-06 17:41:05 UTC (rev 302) @@ -80,6 +80,7 @@ console_clearln(fp); console_println(fp, str, 0); + fflush(fp); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |