source: trunk/athena/bin/discuss/edsc/do_quote.c @ 12459

Revision 12459, 1.0 KB checked in by danw, 25 years ago (diff)
comment out text after #else and #endif
Line 
1/*
2 *
3 *      Copyright (C) 1989 by the Massachusetts Institute of Technology
4 *      Developed by the MIT Student Information Processing Board (SIPB).
5 *      For copying information, see the file mit-copyright.h in this release.
6 *
7 */
8/*
9 *
10 * Created by: Mark W. Eichin <eichin@athena.mit.edu>
11 * $Id: do_quote.c,v 1.3 1999-02-08 14:47:04 danw Exp $
12 *
13 */
14#ifndef lint
15static char rcsid_do_quote_c[] = "$Id: do_quote.c,v 1.3 1999-02-08 14:47:04 danw Exp $";
16#endif /* lint */
17
18char *malloc();
19/*
20 *
21 * do_quote ()  -- requote a string so that Lisp won't barf on it.
22 *                 Basically requotes '"' and '\'.  Returns a malloc'd
23 *                 copy of the original string.
24 *
25 *                 Warning:  This routine frees its argument, so the
26 *                 canonical way of calling it is:  frep = do_quote(frep).
27 *
28 */
29
30char *do_quote(s)
31     char *s;
32{
33  char *ret, *t;
34
35  t = ret = malloc(2*strlen(s)+1);
36
37  while(*s) {
38    switch(*s) {
39    case '"':
40    case '\\':
41      *(t++) = '\\';
42    default:
43      *(t++) = *(s++);
44    }
45  }
46  *t = '\0';
47 
48  return(ret);
49}
50
51   
52
Note: See TracBrowser for help on using the repository browser.