Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Aug 2003 09:10:16 -0700 (PDT)
From:      Simon Barner <barner@in.tum.de>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/55539: [patch] Parse fstab(5) with spaces in path names
Message-ID:  <200308131610.h7DGAG39029267@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/55539; it has been noted by GNATS.

From: Simon Barner <barner@in.tum.de>
To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308131610.h7DGAG39029267>