9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] quote file name
Date: Fri, 28 Jul 2006 07:48:58 -0500	[thread overview]
Message-ID: <091279b578f15c44301b9e1e1c3f55f0@quanstro.net> (raw)
In-Reply-To: <92D74425-59CB-473D-90A9-CF49BCAC892D@ar.aichi-u.ac.jp>

you're welcome.

however, i don't think kanji space shouldn't be quoted.

the purpose of the function is to determine if the string needs quoting for
rc's benefit. (there are a number of space characters and other potentially-confusing
stuff in unicode that rc does not interpret as whitespace.)

the function you're looking for could be called "needshumanquote" and
could be written like this

int
needshumanquote(int r)
{
	if(r <= ' ')
		return 1;
	if(r < 0x80 && strchr("`^#*[]=|\\?${}()'<>&;", r))
		return 1;
	if(!isalpharune(r))
		return 1;
	return 0;
}

a better version of this function could be written with the a function
isspacerune. (i've got a script which generates this table from UnicodeData.txt.)

there's a patch for needsrcquote in /n/sources/patch/needsrcquote.

- erik

On Fri Jul 28 07:42:06 CDT 2006, arisawa@ar.aichi-u.ac.jp wrote:
> Hello,
>
> > ; diff -c /n/sources/plan9/sys/src/libc/port/needsrcquote.c
> > needsrcquote.c
> > /n/sources/plan9/sys/src/libc/port/needsrcquote.c:6,12 -
> > needsrcquote.c:6,12
> >   {
> >   	if(c <= ' ')
> >   		return 1;
> > - 	if(strchr("`^#*[]=|\\?${}()'<>&;", c))
> > + 	if(c < 0x80 && strchr("`^#*[]=|\\?${}()'<>&;", c))
> >   		return 1;
> >   	return 0;
> >   }
> >
> > - erik
>
> Thanks eric. That works.
>
> I think kanji space (0x3000) should be quoted. Therefore
> -  	if(c <= ' ')
> +   	if(c <= ' ' || c == 0x3000)
> is desirable
>
> I hope official needsrcquote.c is to be changed along the patch by
> eric and me.
>
> Kenji Arisawa


  reply	other threads:[~2006-07-28 12:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-09 10:24 arisawa
2006-07-09 10:53 ` quanstro
2006-07-10  0:46   ` quanstro
2006-07-28 12:41     ` arisawa
2006-07-28 12:48       ` erik quanstrom [this message]
2006-07-28 15:09         ` Micah Stetson
2006-07-28 15:33           ` erik quanstrom
2006-07-28 17:52             ` Micah Stetson
2006-07-28 18:19               ` erik quanstrom
2006-07-28 19:16                 ` Micah Stetson
2006-07-28 15:26         ` arisawa
2006-07-28 15:49           ` erik quanstrom
2006-07-28 15:51           ` erik quanstrom
2006-07-28 13:23       ` "Nils O. Selåsdal"
2006-07-28 19:37         ` geoff

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=091279b578f15c44301b9e1e1c3f55f0@quanstro.net \
    --to=quanstro@quanstro.net \
    --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).