bugPSPP - Bugs: bug #17213, interactive output should go to...

 
 

bug #17213: interactive output should go to terminal

Submitted by:  Ben Pfaff <blp>
Submitted on:  Thu 27 Jul 2006 05:53:58 AM UTC  
 
Category: Output DriverSeverity: 1 - Wishlist
Status: FixedAssigned to: Ben Pfaff <blp>
Open/Closed: ClosedRelease: Before 0.6.0
Effort: 0.00

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 27 Jul 2007 11:00:04 PM UTC, comment #3:

>Maybe it's possible for two distinct pointers to be associated
>with the same stdio stream, or perhaps it could fail after a call
>to freopen ?? I don't know.


My goal here is that if you use fn_open("-", <mode>) and thereby get a standard stream out of it, then fn_close("-", <stream>) won't close that standard stream. What you're saying can't happen in ISO C, which doesn't allow the standard streams to be assigned to, and freopen always returns the same FILE * that it is passed. In the GNU C library, you can actually assign new streams to stdin/out/err, so the problem could arise, but it's a bad idea to assign to them and PSPP (and gnulib) doesn't do that.

I considered using dup and fdopen to actually duplicate the standard streams instead of just trying to detect them. But that's troublesome for another reason: we'd have to be pretty careful about calling fflush in the right places to avoid interleaving output strangely.

>Perhaps it would be better to use
> if ( fileno(f) == STDIN_FILENO || ...


I don't know why I bothered to write all the text above. I think your solution is fine. I'll do that.

>2. I'll assume that the HAVE_LIBTERMCAP vs. HAVE_LIBNCURSES
>change is correct.


I think it is: that code didn't do anything before and now it appears to work in testing.

Thanks! I checked this in.

Ben Pfaff <blp>
Project AdministratorIn charge of this item.
Thu 26 Jul 2007 07:17:43 AM UTC, comment #2:

1. I'm not sure how safe this is:
if (f == stdin || f == stdout || f == stderr)

Maybe it's possible for two distinct pointers to be associated with the same stdio stream, or perhaps it could fail after a call to freopen ?? I don't know.

Perhaps it would be better to use
if ( fileno(f) == STDIN_FILENO || ...

2. I'll assume that the HAVE_LIBTERMCAP vs. HAVE_LIBNCURSES change is correct. That issue is so convoluted I always get confused.

I don't see any other problems.

John Darrington <jmd>
Project Administrator
Thu 26 Jul 2007 01:20:53 AM UTC, comment #1:

Fix attached. It also fixes a bunch of other bugs I discovered while in the middle of fixing it.

Also attached, a bonus patch that allows the line-drawing features of VT100 terminals (and xterms) to be used in PSPP output.

(file #13472, file #13473)

Ben Pfaff <blp>
Project AdministratorIn charge of this item.
Thu 27 Jul 2006 05:53:58 AM UTC, original submission:

It's rather irritating that, when PSPP is being used interactively in the textual UI, output does not go to the terminal, but only to the listing file. (There is a setting that is supposed to control this behavior.)

Ben Pfaff <blp>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #13472:  interactive-output.patch added by blp (19KiB - text/x-diff)
file #13473:  vt100-line-draw.patch added by blp (7KiB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jmd (Posted a comment)
  • -unavailable- added by blp (Updated the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 27 Jul 2007 11:00:04 PM UTCblpStatusReady for Test/Review=>Fixed
      Open/ClosedOpen=>Closed
    Thu 26 Jul 2007 01:20:53 AM UTCblpAttached File-=>Added interactive-output.patch, #13472
      Attached File-=>Added vt100-line-draw.patch, #13473
      StatusNone=>Ready for Test/Review
    Mon 31 Jul 2006 02:05:49 AM UTCblpAssigned toNone=>blp
    Mon 31 Jul 2006 02:05:44 AM UTCblpReleaseNone=>Before 0.6.0

    Back to the top


    Powered by Savane 3.1-cleanup1