delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/01/16/09:28:09

Date: Sun, 16 Jan 2000 16:17:27 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Martin Str|mberg <ams AT ludd DOT luth DOT se>
cc: DJGPP-WORKERS <djgpp-workers AT delorie DOT com>
Subject: Re: _lleek
In-Reply-To: <200001161132.MAA17402@father.ludd.luth.se>
Message-ID: <Pine.SUN.3.91.1000116161406.13764F-100000@is>
MIME-Version: 1.0
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

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?

- Raw text -


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