9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Jacob Moody <moody@mail.posixcafe.org>
To: 9front@9front.org
Subject: Re: [9front] question about httpd
Date: Tue, 2 Aug 2022 10:56:40 -0600	[thread overview]
Message-ID: <b554858a-1dec-19c3-652f-820c53211c63@posixcafe.org> (raw)
In-Reply-To: <1363970938.169268.1659459065934@office.mailbox.org>

On 8/2/22 10:51, sahu@mailbox.org wrote:
> Hello, 
> 
> I have looked at the code, and have a question about the redirectinit() function in /sys/src/cmd/ip/httpd/redirect.c:
> 
> void
> redirectinit(void)
> {
> 	static Biobuf *b = nil;
> 	static Qid qid;
> 	char *file, *line, *s, *host, *field[3];
> 	static char pfx[] = "http://";
> 
> 	file = "/sys/lib/httpd.rewrite";
> 	if(b != nil){
> 		if(	(Bfildes(b), &qid) == 0)
> 			return;
> 		Bterm(b);
> 	}
> ...
> }
> 
> In which cases could b be nil? And since it appears more often in the function, what do "B" (Biobuf, Bfildes, Bterm, ...) and "Q" (Qid) stand for?
> 
> Many thanks in advance and best regards, 
> sahu


Note that 'b' is declared as static, meaning it will retain it's values between calls.
So b will be nil on only the first call to this function, subsequent calls will have
a valid pointer.


---
Moody

  reply	other threads:[~2022-08-02 16:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02 16:51 sahu
2022-08-02 16:56 ` Jacob Moody [this message]
2022-08-02 17:12 ` ori
2022-08-02 17:13 ` Kurt H Maier
2022-08-02 17:45   ` Jacob Moody
2022-08-02 18:41     ` ori
2022-08-02 19:34       ` sirjofri
2022-08-02 19:44         ` Jacob Moody
2022-08-02 19:53           ` sahu

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=b554858a-1dec-19c3-652f-820c53211c63@posixcafe.org \
    --to=moody@mail.posixcafe.org \
    --cc=9front@9front.org \
    /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).