xref: /illumos-gate/usr/src/cmd/sendmail/libsm/string.c (revision e82490700e19f1b8a2cef6102f4726144d281988)
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 #include <sm/gen.h>
12 SM_RCSID("@(#)$Id: string.c,v 1.1 2001/02/15 21:04:50 ca Exp $")
13 
14 #include <ctype.h>
15 #include <errno.h>
16 
17 #include <sm/string.h>
18 
19 /*
20 **  STRIPQUOTES -- Strip quotes & quote bits from a string.
21 **
22 **	Runs through a string and strips off unquoted quote
23 **	characters and quote bits.  This is done in place.
24 **
25 **	Parameters:
26 **		s -- the string to strip.
27 **
28 **	Returns:
29 **		none.
30 **
31 **	Side Effects:
32 **		none.
33 */
34 
35 void
36 stripquotes(s)
37 	char *s;
38 {
39 	register char *p;
40 	register char *q;
41 	register char c;
42 
43 	if (s == NULL)
44 		return;
45 
46 	p = q = s;
47 	do
48 	{
49 		c = *p++;
50 		if (c == '\\')
51 			c = *p++;
52 		else if (c == '"')
53 			continue;
54 		*q++ = c;
55 	} while (c != '\0');
56 }
57