3 * Copyright (c) 1990,1994 Regents of The University of Michigan.
4 * All Rights Reserved. See COPYRIGHT.
9 #endif /* HAVE_CONFIG_H */
11 #include <sys/param.h>
16 #include <atalk/globals.h>
21 void initline( int len, char *line)
32 parseline(int len, char *token)
42 if ( l_curr > l_end ) { /* end of line */
49 if ( state == ST_QUOTE ) {
60 if ( state == ST_WORD ) {
64 if ( state != ST_QUOTE ) {
70 if ( state == ST_BEGIN ) {
73 if ( p > e ) { /* end of token */
86 void parseline(char *token, char *user)
88 char *p = pos, *t = token, *u, *q, buf[ MAXPATHLEN ];
92 while ( isspace( *p )) {
97 * If we've reached the end of the line, or a comment,
98 * don't return any more tokens.
100 if ( *p == '\0' || *p == '#' ) {
109 while ( *p != '\0' && ( quoted || !isspace( *p ))) {
125 * We got to the end of the line without closing an open quote
127 if ( *p == '\0' && quoted ) {
135 if ( *t == '\0' || *t == '/' ) {
142 if (( q = strchr( t, '/' )) == NULL ) {
149 if ( u == NULL || ( pwent = getpwnam( u )) == NULL ) {
153 strcpy( buf, pwent->pw_dir );
158 strcpy( token, buf );