/********************************************************************** * Copyright (c) Digital Equipment Corporation 1984, 1985, 1986. * * All Rights Reserved. * * Reference "/usr/src/COPYRIGHT" for applicable restrictions. * **********************************************************************/ static char Sccsid[] = "@(#)getargs.c 3.0 4/22/86"; #include <stdio.h> /******* * getargs(s, arps) * char *s, *arps[]; * * getargs - this routine will generate a vector of * pointers (arps) to the substrings in string "s". * Each substring is separated by blanks and/or tabs. * * return - the number of subfields. * * decvax!larry - no changes since BSD 4.2 */ getargs(s, arps) char *s, *arps[]; { int i; i = 0; while (1) { arps[i] = NULL; while (*s == ' ' || *s == '\t') *s++ = '\0'; if (*s == '\n') *s = '\0'; if (*s == '\0') break; arps[i++] = s++; while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n') s++; } return(i); }