summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commit.c5
-rw-r--r--src/delete.c6
-rw-r--r--src/set.c22
3 files changed, 32 insertions, 1 deletions
diff --git a/src/commit.c b/src/commit.c
index 1221e37..3b4d9d3 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -289,6 +289,11 @@ static boolean validate_dir_for_commit()
continue;
}
+ if (strcmp(uename,"def") == 0) {
+ ret = TRUE;
+ continue;
+ }
+
push_path(&m_path, uename); /* PUSH 3 */
if (lstat(m_path.path, &statbuf) < 0) {
printf("Can't read directory %s\n",
diff --git a/src/delete.c b/src/delete.c
index aa83796..9bdb3ed 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -64,7 +64,7 @@ static boolean has_default(char **def, int size)
}
static void reset_default(char *def_val)
{
- char *command;
+ char *command,*def_cmd;
boolean has_default = 1;
if (def_val == NULL) {
return;
@@ -74,7 +74,11 @@ static void reset_default(char *def_val)
command = my_malloc(strlen(m_path.path) + 100, "set");
sprintf(command, "echo %s > %s/node.val", def_val, m_path.path);
system(command);
+ def_cmd = malloc(strlen(m_path.path) + 12);
+ sprintf(def_cmd, "touch %s/def",m_path.path);
+ system(def_cmd);
free(command);
+ free(def_cmd);
}
}
/***************************************************
diff --git a/src/set.c b/src/set.c
index d961fb8..ed43267 100644
--- a/src/set.c
+++ b/src/set.c
@@ -245,6 +245,16 @@ int main(int argc, char **argv)
pop_path(&m_path);
}
make_dir();
+
+
+ if (!def.multi) {
+ char *path;
+ path= malloc(strlen(m_path.path)+5);
+ sprintf(path, "%s/def",m_path.path);
+ unlink(path);
+ free(path);
+ }
+
push_path(&m_path, VAL_NAME);
if(not_new && !def.multi) {
/* it is not multi and seen from M */
@@ -341,11 +351,22 @@ handle_default(vtw_path *mpath, vtw_path *tpath, char *exclude)
}
if (def.def_default) {
push_path(mpath, uename);
+
push_path(mpath, VAL_NAME);
if (lstat(mpath->path, &statbuf) < 0) {
/* no value. add the default */
pop_path(mpath);
touch_dir(mpath->path); /* make sure directory exist */
+
+ //create def marker
+ char *def_file;
+ def_file = malloc(strlen(mpath->path)+22);
+ sprintf(def_file,"touch %s/def",mpath->path);
+ system(def_file);
+ sprintf(def_file,"echo 'empty' > %s/def",mpath->path);
+ system(def_file);
+ free(def_file);
+
push_path(mpath, VAL_NAME);
fp = fopen(mpath->path, "w");
if (fp == NULL) {
@@ -356,6 +377,7 @@ handle_default(vtw_path *mpath, vtw_path *tpath, char *exclude)
bye("Error writing file %s", mpath->path);
}
fclose(fp);
+
}
pop_path(mpath); /* value */
pop_path(mpath); /* child */