www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/01/26/15:00:21

From: kunst AT prl DOT philips DOT nl (Pieter Kunst)
Subject: PDcurses: getstr()
To: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP users list)
Date: Tue, 26 Jan 93 16:40:59 MET
Cc: davidn AT csource DOT oz DOT au, rwolf AT dretor DOT dciem DOT dnd DOT ca,
jshumate AT wrdis01 DOT robins DOT af DOT mil
Mailer: Elm [revision: 70.30]

I obtained PDcurses 2.0 (rwolf AT dretor DOT dciem DOT dnd DOT ca), 
I obtained the patches for DJGPP (davidn AT csource DOT oz DOT au), 
I applied the patches (with some difficulties) using the DJGPP patch program,
I obtained a copy of the DMAKE program,
I compiled the whole package, et voila, a first question !

When I compile the test program below (tcurses.c) on a UNIX system,
I get something like:

  Curses test program.
  Input: hello
  Input: hello

The PDcurses+DJGPP version of getstr(), however, seems to have some
different behaviour:

  Curses test program.
  Input: ==>helloInput: ==>hello
  Segmentation violation in pointer 0x00000000 at 40:0
  Exception 14 (0xe) at eip=0

Not only are the contents of the buffer 'buf' used in the
function 'getstr()' and is the newline not echoed (which is 
different from my UNIX curses, but I could live with this feature), 
the worst part is the crash of the program itself.

My question to anyone who uses PDcurses (and DJGPP):

 (1) does this program crash on your system, too ?
     (Perhaps I didn't compile the library right...)

 (2) is it smart to redefine the functionality of such a basic 
     function like 'getscr()', or is my UNIX curses wrong ?

Any help/comment is appreciated.

Pieter Kunst (kunst AT prl DOT philips DOT nl)

-----------------------------------------------------------------------
  tcurses.c:
-----------------------------------------------------------------------
#include <curses.h>    
#include <string.h>    

main()
{
  char buf[100];

  strcpy (buf, "==>");
  initscr ();
  echo ();
  cbreak ();
  printw ("Curses test program.\nInput: "); refresh();
  getstr (buf);
  printw ("Input: %s\n", buf); refresh();
  /* endwin (); */
}
-----------------------------------------------------------------------


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019