diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-09-28 16:36:30 -0400 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-09-29 07:58:56 +1000 |
commit | af5939d15a41b337cc499a04fe4001a5cd51fdce (patch) | |
tree | d051dd854e4de351288d1d9f6fe752b1509ac68a /utils/mount/token.h | |
parent | 7a042b78ba064a36d1c7de797d2af796212fca2e (diff) | |
download | nfs-utils-af5939d15a41b337cc499a04fe4001a5cd51fdce.tar.gz nfs-utils-af5939d15a41b337cc499a04fe4001a5cd51fdce.tar.xz nfs-utils-af5939d15a41b337cc499a04fe4001a5cd51fdce.zip |
mount.nfs: add new string tokenizer facility
To quote the strtok(3) man page: "Avoid using these functions."
OK. We've created our own. The main reason for this is that strtok(3)
doesn't handle quoted delimiters at all. We need to handle this:
context="foo,bar"
where 'context' is a single mount option that sets a token string that
possibly uses the same delimiter that the mount command uses to separate
options (that is, a comma).
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/mount/token.h')
-rw-r--r-- | utils/mount/token.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/utils/mount/token.h b/utils/mount/token.h new file mode 100644 index 0000000..47762dc --- /dev/null +++ b/utils/mount/token.h @@ -0,0 +1,29 @@ +/* + * token.h -- tokenize strings, a la strtok(3) + * + * Copyright (C) 2007 Oracle. All rights reserved. + * Copyright (C) 2007 Chuck Lever <chuck.lever@oracle.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + */ + +struct tokenizer_state; + +char *next_token(struct tokenizer_state *); +struct tokenizer_state *init_tokenizer(char *, char); +int tokenizer_error(struct tokenizer_state *); +void end_tokenizer(struct tokenizer_state *); |