9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Lucio De Re <lucio@proxima.alt.za>
To: 9fans mailing list <9fans@cse.psu.edu>
Subject: [9fans] /sys/src/cmd/chmod.c
Date: Wed, 31 Dec 2003 16:32:40 +0200	[thread overview]
Message-ID: <20031231163240.Z25949@cackle.proxima.alt.za> (raw)

This struck me, looking at recent changes to chmod(1) which allow one
to flag a file as "not to be included in nightly archives":

	for(; *s ; s++){
		switch(*s){
		case 'r':
			mode |= A(DMREAD); break;
		case 'w':
			mode |= A(DMWRITE); break;
		case 'x':
			mode |= A(DMEXEC); break;
		case 'a':
			mode |= DMAPPEND; break;
		case 'l':
			mode |= DMEXCL; break;
		case 't':
			mode |= DMTMP; break;
		default:
			return 0;
		}
	}
	if(*s != 0)
		return 0;

I can't see how *s can be non-zero on exit from the for loop.  Is
my C programming _so_ rusty?!

++L


             reply	other threads:[~2003-12-31 14:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-31 14:32 Lucio De Re [this message]
2003-12-31 15:25 ` Martin Harriss
2004-01-05 11:03 ` Zhen Lin
2004-01-05 15:26   ` ron minnich

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=20031231163240.Z25949@cackle.proxima.alt.za \
    --to=lucio@proxima.alt.za \
    --cc=9fans@cse.psu.edu \
    /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).