| 1 |
/************************************************************************* |
| 2 |
* Copyright (c) 2011 AT&T Intellectual Property |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: Details at https://graphviz.org |
| 9 |
*************************************************************************/ |
| 10 |
|
| 11 |
/* |
| 12 |
* Glenn Fowler |
| 13 |
* AT&T Bell Laboratories |
| 14 |
* |
| 15 |
* convert \x character constants in s in place |
| 16 |
*/ |
| 17 |
|
| 18 |
#include "config.h" |
| 19 |
|
| 20 |
#include <ast/ast.h> |
| 21 |
|
| 22 |
void stresc(char *s) |
| 23 |
{ |
| 24 |
char *t; |
| 25 |
int c; |
| 26 |
char *p; |
| 27 |
|
| 28 |
t = s; |
| 29 |
for (;;) { |
| 30 |
switch (c = *s++) { |
| 31 |
case '\\': |
| 32 |
c = chresc(s - 1, &p); |
| 33 |
s = p; |
| 34 |
break; |
| 35 |
case 0: |
| 36 |
*t = 0; |
| 37 |
return; |
| 38 |
default: // nothing required |
| 39 |
break; |
| 40 |
} |
| 41 |
*t++ = c; |
| 42 |
} |
| 43 |
} |