summaryrefslogtreecommitdiff
path: root/src/cli_new.c
diff options
context:
space:
mode:
authorMichael Larson <slioch@eng-140.vyatta.com>2008-07-07 12:05:27 -0700
committerMichael Larson <slioch@eng-140.vyatta.com>2008-07-07 12:05:27 -0700
commit93a148a78b577ced2cfaebdbe1659e3ecc58c4aa (patch)
treebb86657c97b35bd397e51fbf48ebd7dc48721cfc /src/cli_new.c
parent797bf065bf8aa04cf857ad3bb53b79d48a639d88 (diff)
downloadvyatta-cfg-93a148a78b577ced2cfaebdbe1659e3ecc58c4aa.tar.gz
vyatta-cfg-93a148a78b577ced2cfaebdbe1659e3ecc58c4aa.zip
fix for bug 3216. added no escape option to push path for environmental path variable. note this is appied to all c code access to the
edit env variable.
Diffstat (limited to 'src/cli_new.c')
-rw-r--r--src/cli_new.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cli_new.c b/src/cli_new.c
index b66d83c..0b50ccb 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -1774,7 +1774,35 @@ void push_path(vtw_path *path, char *segm)
}else
*pp = *cp;
*pp = 0;
+ path->path_len += len;
+ if (path->path_lev == path->path_ends_alloc){
+ path->path_ends_alloc += ENDS_ALLOC;
+ path->path_ends = (int *)my_realloc(path->path_ends,
+ sizeof(int *)*path->path_ends_alloc, "puhs_path 2");
+ }
+ path->path_ends[path->path_lev++] = path->path_len;
+ // push_path_no_escape();
+}
+/**
+ * Version of above that doesn't escape value before stuffing.
+ *
+ **/
+void push_path_no_escape(vtw_path *path, char *segm)
+{
+ int len;
+ char *cp;
+ char *pp;
+
+ for(cp=segm, len=0;*cp;++cp, ++len);
+ warrant_path(path, len + 1);
+ path->path_buf[path->path_len] = '/';
+ path->path_buf[++path->path_len] = 0;
+ for(pp=path->path_buf + path->path_len,cp=segm;
+ *cp;++cp, ++pp) {
+ *pp = *cp;
+ }
+ *pp = 0;
path->path_len += len;
if (path->path_lev == path->path_ends_alloc){
path->path_ends_alloc += ENDS_ALLOC;