2 * Copyright (c) 1990,1994 Regents of The University of Michigan.
3 * All Rights Reserved. See COPYRIGHT.
10 #include <sys/param.h>
20 void initline( len, line )
33 parseline( len, token )
45 if ( l_curr > l_end ) { /* end of line */
52 if ( state == ST_QUOTE ) {
63 if ( state == ST_WORD ) {
67 if ( state != ST_QUOTE ) {
73 if ( state == ST_BEGIN ) {
76 if ( p > e ) { /* end of token */
89 void parseline( token, user )
92 char *p = pos, *t = token, *u, *q, buf[ MAXPATHLEN ];
96 while ( isspace( *p )) {
101 * If we've reached the end of the line, or a comment,
102 * don't return any more tokens.
104 if ( *p == '\0' || *p == '#' ) {
113 while ( *p != '\0' && ( quoted || !isspace( *p ))) {
129 * We got to the end of the line without closing an open quote
131 if ( *p == '\0' && quoted ) {
139 if ( *t == '\0' || *t == '/' ) {
146 if (( q = strchr( t, '/' )) == NULL ) {
153 if ( u == NULL || ( pwent = getpwnam( u )) == NULL ) {
157 strcpy( buf, pwent->pw_dir );
162 strcpy( token, buf );