9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: eekee57 <eekee57@fastmail.fm>
To: 9fans@9fans.net
Subject: Re: [9fans] ftpfs ahould not expose "." and ".." directories
Date: Tue, 29 Apr 2008 08:32:06 +0000	[thread overview]
Message-ID: <a9ccff10-72c6-49cb-8937-bda6ba94195b@x41g2000hsb.googlegroups.com> (raw)
In-Reply-To: <006cc24d595f7b43910034f84f6c8287@terzarima.net>

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;



  parent reply	other threads:[~2008-04-29  8:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-28  8:48 eekee57
2008-04-28 10:19 ` Pietro Gagliardi
2008-04-28 10:38   ` Juan Céspedes
2008-04-28 10:50     ` Charles Forsyth
2008-04-28 13:54       ` Charles Forsyth
2008-04-28 14:12         ` erik quanstrom
2008-04-29  8:32         ` eekee57 [this message]
2008-04-29 10:16           ` roger peppe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9ccff10-72c6-49cb-8937-bda6ba94195b@x41g2000hsb.googlegroups.com \
    --to=eekee57@fastmail.fm \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).