delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/09/12/09:21:43

Date: Thu, 12 Sep 1996 17:14:54 +0400 (MSD)
From: "Alexander V. Lukyanov" <lav AT Yars DOT Free DOT Net>
Message-Id: <199609121314.RAA06526@gemini.yars.free.net>
To: djgpp-workers AT delorie DOT com
Subject: stdio mods

Here are two patches to stdio files. The first removes
unneeded case in doprnt.c and  the second fixes my bug
with handling ^Z in text files. That bug did not show
itself on plain text files with ^Z at the end, but on
files with extra data after ^Z.

*** doprnt.c.orig	Thu Sep 12 14:24:00 1996
--- doprnt.c	Thu Sep 12 14:26:58 1996
***************
*** 365,372 ****
  	}
  	if (flags&LONGDBL)
  	  CONVERT(unsigned long long) /* no ; */
-         else if(flags&SHORTINT)
-           CONVERT(unsigned short) /* no ; */
  	else
  	  CONVERT(unsigned long) /* no ; */
  #undef CONVERT
--- 365,370 ----
*** filbuf.c.orig	Thu Sep 12 16:40:30 1996
--- filbuf.c	Thu Sep 12 16:49:04 1996
***************
*** 55,61 ****
      /* truncate text file at Ctrl-Z */
      char *cz=memchr(f->_base, 0x1A, f->_cnt);
      if(cz)
!       f->_cnt = cz - f->_base;
    }
    f->_ptr = f->_base;
    if (f->_flag & _IONBF)
--- 55,65 ----
      /* truncate text file at Ctrl-Z */
      char *cz=memchr(f->_base, 0x1A, f->_cnt);
      if(cz)
!     {
!       int newcnt = cz - f->_base;
!       lseek(fileno(f), -(f->_cnt - newcnt), SEEK_CUR);
!       f->_cnt = newcnt;
!     }
    }
    f->_ptr = f->_base;
    if (f->_flag & _IONBF)

- Raw text -


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