From owner-freebsd-bugs Wed Jan 6 02:30:10 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA21104 for freebsd-bugs-outgoing; Wed, 6 Jan 1999 02:30:10 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA21095 for ; Wed, 6 Jan 1999 02:30:08 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id CAA08078; Wed, 6 Jan 1999 02:30:02 -0800 (PST) Date: Wed, 6 Jan 1999 02:30:02 -0800 (PST) Message-Id: <199901061030.CAA08078@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.ORG From: Slaven Rezic Subject: Re: bin/3246: mtree -c should escape whitespace and special characters Reply-To: Slaven Rezic Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/3246; it has been noted by GNATS. From: Slaven Rezic To: Joseph Koshy Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/3246: mtree -c should escape whitespace and special characters Date: 06 Jan 1999 11:09:54 +0100 Joseph Koshy writes: > > > > I was looking at your PR with the intent of committing the patches. > I have a few points: > > 1. new file `escape.c' > > - needs a copyright (you could copy the copyright from the other > files). Alternatively you could fold the code into an > existing file like `misc.c'. > > - needs to follow the same source style as the rest of mtree > (see style(9) for hints) > > The same comments apply to "escape.h" too. > > 2. Rather than have to call 'escaped_len()' and 'unescaped_len()' > can then allocate the required space, how about making the > `escape()' and `unescape()' functions do the space allocation > transparently? This allows the caller to just call `escape' > or `unescape()' and free the returned pointer when done. > > 3. In 'spec.c', you are calloc()ing as follows: > > --- 140,152 ---- > noparent: errx(1, "line %d: no parent node", lineno); > } > > ! if ((centry = calloc(1, sizeof(NODE) + unescaped_len(p))) == NULL) > errx(1, "calloc"); > *centry = ginfo; > > This doesn't seem to leave space for the last '0'? The original > code also has this buglet. > > If you could correct the above and submit the new patches as a > followup to this PR, it would be great. Please note that Eugene M. Kim is the author of the patch, not me. I'd sent a forward of your mail to him. Regards, Slaven -- use Tk;$c=tkinit->Canvas->pack;$x=45;for(split/_/,'KPI1_+09IPK_K;-OA1_+K!;A__1; Q!7G_1+QK_3CLPI90,_+K!;A_+1!KQ!.N_K+1Q!.F_1+KN.Q__1+KN._K+1Q!.F_1+KN.Q_+1Q__+1! KQ!.N_1;Q!7G_K3,09Q_+1!K.Q_K+1Q!.F_1+KN.Q'){s/\n//g;for(split/!/){$c->create( 'line',map{$a=-43+ord;($x+($a>>3)*2,123+($a&7)*2)}split//)}$x+=12}MainLoop To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message