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