From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Tue, 29 Apr 2008 11:16:03 +0100 From: "roger peppe" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <006cc24d595f7b43910034f84f6c8287@terzarima.net> Subject: Re: [9fans] ftpfs ahould not expose "." and ".." directories Topicbox-Message-UUID: 9b68fa48-ead3-11e9-9d60-3106f5b1d025 personally, since you're using it so many times, i'd be tempted to write a little function, say "isdot" or "ishidden", just to keep the code looking nice. that way if someone decides to change the style, there's only one place to do it in. On Tue, Apr 29, 2008 at 9:32 AM, eekee57 wrote: > Honestly I went with strncmp() over strcmp() on little more than a > hunch. I actually prefer strcmp() as looking cleaner, with one less > arg and no need to remember the existence fo the null at the end. > Maybe I'll change it. > > As to the style of logic, strncmp() and strcmp() both return zero for > an exact match, a positive number if arg1 is lexicographically greater > than arg2, and a negative number if arg1 is less. This is not strictly > a boolean output, so my choice of !strncmp(...) is probably bad style > anywhere. I remember old assembly language too well. > > How about this for style? > if(strcmp(".", field[7]) == 0 || strcmp("..", > field[7]) == 0) > return nil; > >