~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to tools/ast/stresc.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#pragma prototyped
 
2
/*
 
3
 * Glenn Fowler
 
4
 * AT&T Bell Laboratories
 
5
 *
 
6
 * convert \x character constants in s in place
 
7
 * the length of the converted s is returned (may have imbedded \0's)
 
8
 */
 
9
 
 
10
#include <ast.h>
 
11
 
 
12
int
 
13
stresc(register char* s)
 
14
{
 
15
        register char*  t;
 
16
        register int    c;
 
17
        char*           b;
 
18
        char*           p;
 
19
 
 
20
        b = t = s;
 
21
        for (;;)
 
22
        {
 
23
                switch (c = *s++)
 
24
                {
 
25
                case '\\':
 
26
                        c = chresc(s - 1, &p);
 
27
                        s = p;
 
28
                        break;
 
29
                case 0:
 
30
                        *t = 0;
 
31
                        return(t - b);
 
32
                }
 
33
                *t++ = c;
 
34
        }
 
35
}