e70152e44cc66cc599ff6b699eb8adc07f3e656a kent Sat May 24 21:09:34 2014 -0700 Adding Copyright NNNN Regents of the University of California to all files I believe with reasonable certainty were developed under UCSC employ or as part of Genome Browser copyright assignment. diff --git src/lib/xmlEscape.c src/lib/xmlEscape.c index ba077f1..6912d5a 100644 --- src/lib/xmlEscape.c +++ src/lib/xmlEscape.c @@ -1,79 +1,82 @@ /* Handle escaping for XML files. Deal with things like * & and ". */ +/* Copyright (C) 2011 The Regents of the University of California + * See README in this or parent directory for licensing information. */ + #include "common.h" #include "hash.h" #include "xmlEscape.h" struct hash *xmlEscapeSymHash() /* Return hash of predefined xml character symbols to lookup. */ { struct hash *symHash = newHash(6); hashAdd(symHash, "lt", "<"); hashAdd(symHash, "gt", ">"); hashAdd(symHash, "amp", "&"); hashAdd(symHash, "apos", "'"); hashAdd(symHash, "quot", "\""); return symHash; } void xmlEscapeBytesToFile(unsigned char *buffer, int len, FILE *f) /* Write buffer of given length to file, escaping as need be. */ { unsigned char c; int i; for (i=0; i': fputs(">", f); break; case ' ': case '-': case '\t': case '\n': case ',': case '.': case ';': case ':': case '(': case ')': case '[': case ']': case '#': case '/': fputc(c, f); break; default: fprintf(f, "&#%d;", c); break; } } } } void xmlEscapeStringToFile(char *s, FILE *f) /* Write escaped zero-terminated string to file. */ { int len = strlen(s); xmlEscapeBytesToFile((unsigned char *)s, len, f); }