1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright (c) 2001 Sendmail, Inc. and its suppliers. 3*7c478bd9Sstevel@tonic-gate * All rights reserved. 4*7c478bd9Sstevel@tonic-gate * 5*7c478bd9Sstevel@tonic-gate * By using this file, you agree to the terms and conditions set 6*7c478bd9Sstevel@tonic-gate * forth in the LICENSE file which can be found at the top level of 7*7c478bd9Sstevel@tonic-gate * the sendmail distribution. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate */ 10*7c478bd9Sstevel@tonic-gate 11*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 12*7c478bd9Sstevel@tonic-gate 13*7c478bd9Sstevel@tonic-gate #include <sm/gen.h> 14*7c478bd9Sstevel@tonic-gate SM_RCSID("@(#)$Id: string.c,v 1.1 2001/02/15 21:04:50 ca Exp $") 15*7c478bd9Sstevel@tonic-gate 16*7c478bd9Sstevel@tonic-gate #include <ctype.h> 17*7c478bd9Sstevel@tonic-gate #include <errno.h> 18*7c478bd9Sstevel@tonic-gate 19*7c478bd9Sstevel@tonic-gate #include <sm/string.h> 20*7c478bd9Sstevel@tonic-gate 21*7c478bd9Sstevel@tonic-gate /* 22*7c478bd9Sstevel@tonic-gate ** STRIPQUOTES -- Strip quotes & quote bits from a string. 23*7c478bd9Sstevel@tonic-gate ** 24*7c478bd9Sstevel@tonic-gate ** Runs through a string and strips off unquoted quote 25*7c478bd9Sstevel@tonic-gate ** characters and quote bits. This is done in place. 26*7c478bd9Sstevel@tonic-gate ** 27*7c478bd9Sstevel@tonic-gate ** Parameters: 28*7c478bd9Sstevel@tonic-gate ** s -- the string to strip. 29*7c478bd9Sstevel@tonic-gate ** 30*7c478bd9Sstevel@tonic-gate ** Returns: 31*7c478bd9Sstevel@tonic-gate ** none. 32*7c478bd9Sstevel@tonic-gate ** 33*7c478bd9Sstevel@tonic-gate ** Side Effects: 34*7c478bd9Sstevel@tonic-gate ** none. 35*7c478bd9Sstevel@tonic-gate */ 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate void 38*7c478bd9Sstevel@tonic-gate stripquotes(s) 39*7c478bd9Sstevel@tonic-gate char *s; 40*7c478bd9Sstevel@tonic-gate { 41*7c478bd9Sstevel@tonic-gate register char *p; 42*7c478bd9Sstevel@tonic-gate register char *q; 43*7c478bd9Sstevel@tonic-gate register char c; 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate if (s == NULL) 46*7c478bd9Sstevel@tonic-gate return; 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate p = q = s; 49*7c478bd9Sstevel@tonic-gate do 50*7c478bd9Sstevel@tonic-gate { 51*7c478bd9Sstevel@tonic-gate c = *p++; 52*7c478bd9Sstevel@tonic-gate if (c == '\\') 53*7c478bd9Sstevel@tonic-gate c = *p++; 54*7c478bd9Sstevel@tonic-gate else if (c == '"') 55*7c478bd9Sstevel@tonic-gate continue; 56*7c478bd9Sstevel@tonic-gate *q++ = c; 57*7c478bd9Sstevel@tonic-gate } while (c != '\0'); 58*7c478bd9Sstevel@tonic-gate } 59