148652Sbostic /*- 2*62386Sbostic * Copyright (c) 1985, 1993 3*62386Sbostic * The Regents of the University of California. All rights reserved. 448652Sbostic * 548652Sbostic * %sccs.include.proprietary.c% 648652Sbostic */ 748652Sbostic 813649Ssam #ifndef lint 9*62386Sbostic static char sccsid[] = "@(#)getprm.c 8.1 (Berkeley) 06/06/93"; 1048652Sbostic #endif /* not lint */ 1113649Ssam 1223603Sbloom #include "uucp.h" 1313649Ssam 1413649Ssam #define LQUOTE '(' 1513649Ssam #define RQUOTE ')' 1613649Ssam 1723603Sbloom /*LINTLIBRARY*/ 1813649Ssam 1917835Sralph /* 2017835Sralph * get next parameter from s 2113649Ssam * 2213649Ssam * return - pointer to next character in s 2313649Ssam */ 2413649Ssam 2513649Ssam char * getprm(s,prm)2613649Ssamgetprm(s, prm) 2713649Ssam register char *s, *prm; 2813649Ssam { 2913649Ssam register char *c; 3013649Ssam 3113649Ssam while (*s == ' ' || *s == '\t' || *s == '\n') 3213649Ssam s++; 3313649Ssam 3413649Ssam *prm = '\0'; 3513649Ssam if (*s == '\0') 3617835Sralph return NULL; 3713649Ssam 3813649Ssam if (*s == '>' || *s == '<' || *s == '|' 3913649Ssam || *s == ';' || *s == '&') { 4013649Ssam *prm++ = *s++; 4113649Ssam *prm = '\0'; 4217835Sralph return s; 4313649Ssam } 4413649Ssam 4513649Ssam /* look for quoted argument */ 4613649Ssam if (*s == LQUOTE) { 4713649Ssam if ((c = index(s + 1, RQUOTE)) != NULL) { 4813649Ssam c++; 4913649Ssam while (c != s) 5013649Ssam *prm++ = *s++; 5113649Ssam *prm = '\0'; 5217835Sralph return s; 5313649Ssam } 5413649Ssam } 5513649Ssam 5613649Ssam /* look for ` ` string */ 5713649Ssam if (*s == '`') { 5813649Ssam if ((c = index(s + 1, '`')) != NULL) { 5913649Ssam c++; 6013649Ssam while (c != s) 6113649Ssam *prm++ = *s++; 6213649Ssam *prm = '\0'; 6317835Sralph return s; 6413649Ssam } 6513649Ssam } 6613649Ssam 6713649Ssam while (*s != ' ' && *s != '\t' && *s != '<' 6817835Sralph && *s != '>' && *s != '|' && *s != '\0' 6917835Sralph && *s != '&' && *s != ';' && *s != '\n') 7013649Ssam *prm++ = *s++; 7113649Ssam *prm = '\0'; 7213649Ssam 7317835Sralph return s; 7413649Ssam } 75