Path: utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!uwvax!umn-d-ub!nic.MR.NET!eta!pwcs!elric!mscunx!ko From: ko@mscunx.Sp.Unisys.Com (Keith Otis) Newsgroups: comp.os.minix Subject: FIX - Stevie - allow editing of empty files Summary: FIX - Stevie - allow editing of empty files Keywords: stevie runs on minix Message-ID: <102@mscunx.Sp.Unisys.Com> Date: 3 Oct 88 04:45:51 GMT References: <641@faui44.informatik.uni-erlangen.de> Organization: Unisys - Marketing Services, Eagan MN Lines: 54 In <641@faui44.informatik.uni-erlangen.de> Robert Regn writes: >Remaining problems are: > editing an empty file hangs stevie I also had this problem after porting stevie to run under msdos. Below is a cdiff that will fix the problem. --------------------- Cut Here ------------------------------------------ *** fileio.c Fri Jun 10 16:15:19 1988 --- fileio.c.new Sun Oct 2 23:23:23 1988 *************** *** 6,11 **** --- 6,13 ---- */ #include "stevie.h" + #include + #include void filemess(s) *************** *** 45,50 **** --- 47,53 ---- int unprint = 0; int linecnt = 0; bool_t wasempty = bufempty(); + struct stat stat_buf; curr = fromp->linep; *************** *** 54,59 **** --- 57,66 ---- if ( (f=fopen(fname,"r")) == NULL ) return TRUE; + stat(fname,&stat_buf); + if ( stat_buf.st_size == 0 ) + return FALSE; + filemess(""); for (i=nchars=0; (c=getc(f)) != EOF ;nchars++) { ---------- End of Cdiff --------------------------------------- Keith Otis Unisys Marketing Services - Eagan MN ko@Mscunx.Sp.Unisys.Com -- Keith Otis - Unisys Marketing Services Eagan Mn Internet: ko@mscunx.SP.Unisys.Com UseNet: {ihnp4!sx1100, bungia!elric}!mscunx!ko Phone: (612)-687-2857