~ubuntu-branches/ubuntu/intrepid/git-core/intrepid-updates

« back to all changes in this revision

Viewing changes to quote.c

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-04-22 13:31:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20070422133105-xg8fnm18r2cxcbg1
Tags: upstream-1.5.1.2
ImportĀ upstreamĀ versionĀ 1.5.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
387
387
        }
388
388
        fputc(sq, stream);
389
389
}
 
390
 
 
391
void tcl_quote_print(FILE *stream, const char *src)
 
392
{
 
393
        char c;
 
394
 
 
395
        fputc('"', stream);
 
396
        while ((c = *src++)) {
 
397
                switch (c) {
 
398
                case '[': case ']':
 
399
                case '{': case '}':
 
400
                case '$': case '\\': case '"':
 
401
                        fputc('\\', stream);
 
402
                default:
 
403
                        fputc(c, stream);
 
404
                        break;
 
405
                case '\f':
 
406
                        fputs("\\f", stream);
 
407
                        break;
 
408
                case '\r':
 
409
                        fputs("\\r", stream);
 
410
                        break;
 
411
                case '\n':
 
412
                        fputs("\\n", stream);
 
413
                        break;
 
414
                case '\t':
 
415
                        fputs("\\t", stream);
 
416
                        break;
 
417
                case '\v':
 
418
                        fputs("\\v", stream);
 
419
                        break;
 
420
                }
 
421
        }
 
422
        fputc('"', stream);
 
423
}