1 /*- 2 * Copyright (c) 1985, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)getprm.c 8.1 (Berkeley) 06/06/93"; 10 #endif /* not lint */ 11 12 #include "uucp.h" 13 14 #define LQUOTE '(' 15 #define RQUOTE ')' 16 17 /*LINTLIBRARY*/ 18 19 /* 20 * get next parameter from s 21 * 22 * return - pointer to next character in s 23 */ 24 25 char * 26 getprm(s, prm) 27 register char *s, *prm; 28 { 29 register char *c; 30 31 while (*s == ' ' || *s == '\t' || *s == '\n') 32 s++; 33 34 *prm = '\0'; 35 if (*s == '\0') 36 return NULL; 37 38 if (*s == '>' || *s == '<' || *s == '|' 39 || *s == ';' || *s == '&') { 40 *prm++ = *s++; 41 *prm = '\0'; 42 return s; 43 } 44 45 /* look for quoted argument */ 46 if (*s == LQUOTE) { 47 if ((c = index(s + 1, RQUOTE)) != NULL) { 48 c++; 49 while (c != s) 50 *prm++ = *s++; 51 *prm = '\0'; 52 return s; 53 } 54 } 55 56 /* look for ` ` string */ 57 if (*s == '`') { 58 if ((c = index(s + 1, '`')) != NULL) { 59 c++; 60 while (c != s) 61 *prm++ = *s++; 62 *prm = '\0'; 63 return s; 64 } 65 } 66 67 while (*s != ' ' && *s != '\t' && *s != '<' 68 && *s != '>' && *s != '|' && *s != '\0' 69 && *s != '&' && *s != ';' && *s != '\n') 70 *prm++ = *s++; 71 *prm = '\0'; 72 73 return s; 74 } 75