Date: Sun, 16 Jan 2000 16:17:27 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Martin Str|mberg cc: DJGPP-WORKERS Subject: Re: _lleek In-Reply-To: <200001161132.MAA17402@father.ludd.luth.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 16 Jan 100, Martin Str|mberg wrote: > Here's my solution: Thanks. A picture is worth about a thousand words, they say ;-) > /* We convert SEEK_CUR and SEEK_END to SEEK_SET. */ > if( whence == SEEK_CUR || whence == SEEK_END ) > { > position = ll_llseek( handle, 0, whence ); If whence == SEEK_CUR and offset is positive, you could avoid the double call, no? > if( whence == SEEK_SET ) > { > if( offset < 0 ) > { > offset = 0; > } > else if( MAX_FILE_POINTER_POSITION < offset ) > { > offset = MAX_FILE_POINTER_POSITION; > } > } What happens if you pass the offset unaltered to DOS? Why should we silently change the arguments, unless they somehow crash the system or wipe the disk?