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