aboutsummaryrefslogtreecommitdiffstats
path: root/epan/uat.c
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2007-02-04 02:29:06 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2007-02-04 02:29:06 +0000
commit8bfa2bace4592d4797be7af19e763fb16ce2492c (patch)
treefdb0e1967f6c0484228718f18b5f976ce3145053 /epan/uat.c
parenta84df3865196a007db3f724076558f5c2306bbd3 (diff)
the quoted_string regexp in uat_load() fails badly on "...\\", workarround in uat_save() using \x5c and \x22 (hex for \ and ")
svn path=/trunk/; revision=20706
Diffstat (limited to 'epan/uat.c')
-rw-r--r--epan/uat.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/uat.c b/epan/uat.c
index d886e0b589..a8113aded4 100644
--- a/epan/uat.c
+++ b/epan/uat.c
@@ -165,12 +165,10 @@ static void putfld(FILE* fp, void* rec, uat_field_t* f) {
for(i=0;i<fld_len;i++) {
char c = fld_ptr[i];
- if (c == '"') {
- fputs("\134\042",fp);
- } else if (isprint(c)) {
- putc(c,fp);
- } else {
+ if (c == '"' || c == '\\' || ! isprint(c) ) {
fprintf(fp,"\\x%.2x",c);
+ } else {
+ putc(c,fp);
}
}
@@ -207,6 +205,8 @@ gboolean uat_save(uat_t* uat, char** error) {
*error = NULL;
+ fprintf(fp,"# This file is automatically generated, DO NOT MODIFY.\n");
+
for ( i = 0 ; i < uat->user_data->len ; i++ ) {
void* rec = uat->user_data->data + (uat->record_size * i);
uat_field_t* f;