From owner-freebsd-bugs@FreeBSD.ORG Wed Aug 13 09:10:17 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B86A537B401 for ; Wed, 13 Aug 2003 09:10:17 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4800643FA3 for ; Wed, 13 Aug 2003 09:10:17 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h7DGAGUp029268 for ; Wed, 13 Aug 2003 09:10:17 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h7DGAG39029267; Wed, 13 Aug 2003 09:10:16 -0700 (PDT) Date: Wed, 13 Aug 2003 09:10:16 -0700 (PDT) Message-Id: <200308131610.h7DGAG39029267@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Simon Barner Subject: Re: bin/55539: [patch] Parse fstab(5) with spaces in path names X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Simon Barner List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2003 16:10:18 -0000 The following reply was made to PR bin/55539; it has been noted by GNATS. From: Simon Barner To: Garrett Wollman Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: bin/55539: [patch] Parse fstab(5) with spaces in path names Date: Wed, 13 Aug 2003 18:06:57 +0200 > I think vis(3) would be a more appropriate solution. Do you mean instead of the gtok() function? I must admit that I don't see how this could work: according to the man page vis(3), encodes strings into various formats, e.g. C-style escape sequences, URI-style encoding etc. unvis(3) is the other way round (from an escaped form to a "normal" representation). While this is the direction we need in order to parse an extended fstab, there still remain three problems: - unvis(3) does not handle quoted strings - unvis(3) uses '\s' instead of '\ ' - and most important: the problem to parse a string where characters from the set of delimiters can occur in the tokens (with some way of protection). I also would be glad to get rid of that function and to use standard string functions instead, but I do not see any chance to do so (easily). I have done some more research on that problem, and there seems to be a rather historic function called strqtok(), which does basically the same as gtok(). http://groups.google.de/groups?q=strqtok&hl=de&lr=&ie=UTF-8&oe=UTF-8&selm=1uqur9INNt3q%40gap.caltech.edu&rnum=1 The elm mail agent has a strtokq() function that has the same purpose. And finally there is the str-library (ports/devel/str), which offers a str_token function. Of course none of these is a real solution to our problem that the fstab extention is rather ugly and big. Perhaps the cleanest solution would be to implement a public strtokq function (as a BSD extention), but this seems to be beyond the scope of this PR. Please correct me if I am wrong, especially if you see a small and clean solution without gtok() but with one of the libc functions. Regards, Simon