summaryrefslogtreecommitdiff
path: root/src/delete.c
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-10-29 18:41:15 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2007-10-29 18:41:15 -0700
commit5c170940c89065df4c7bbc6561cbdfd297363aad (patch)
tree664acff0745412bd0dcebb32d630ccb2357d33f0 /src/delete.c
parent57f92ab532610ef1f95ef3fa4761c424d5541d80 (diff)
downloadvyatta-cfg-5c170940c89065df4c7bbc6561cbdfd297363aad.tar.gz
vyatta-cfg-5c170940c89065df4c7bbc6561cbdfd297363aad.zip
general cleanup of CLI output
Diffstat (limited to 'src/delete.c')
-rw-r--r--src/delete.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/delete.c b/src/delete.c
index 5981923..0f16e7d 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -47,6 +47,7 @@ boolean set_validate(vtw_def *defp, char *valp)
push_path(&t_path, DEF_NAME);
if (lstat(t_path.path, &statbuf) < 0 ||
(statbuf.st_mode & S_IFMT) != S_IFREG) {
+ fprintf(out_stream, "The specified configuration node is not valid\n");
bye("Can not set value (2), no definition for %s", m_path.path);
}
/* defniition present */
@@ -75,7 +76,7 @@ int main(int argc, char **argv)
}
if (argc < 2) {
- fprintf(stderr, "Need to specify the config node to delete\n");
+ fprintf(out_stream, "Need to specify the config node to delete\n");
exit(1);
}
@@ -129,8 +130,10 @@ int main(int argc, char **argv)
struct dirent *dirp;
DIR *dp;
- if (lstat(m_path.path, &statbuf) < 0)
+ if (lstat(m_path.path, &statbuf) < 0) {
+ fprintf(out_stream, "Nothing to delete\n");
bye("Nothing to delete at %s", m_path.path);
+ }
remove_rf(FALSE);
pop_path(&m_path);
if ((dp = opendir(m_path.path)) == NULL){
@@ -183,6 +186,7 @@ int main(int argc, char **argv)
exit(0);
}
if(ai < argc -1 || last_tag) {
+ fprintf(out_stream, "The specified configuration node is not valid\n");
bye("There is no appropriate template for %s",
m_path.path + strlen(get_mdirp()));
}
@@ -190,8 +194,10 @@ int main(int argc, char **argv)
pop_path(&m_path); /*it was value, not path segment */
push_path(&m_path, VAL_NAME);
/* set value */
- if (lstat(m_path.path, &statbuf) < 0)
+ if (lstat(m_path.path, &statbuf) < 0) {
+ fprintf(out_stream, "Nothing to delete\n");
bye("Nothing to delete at %s", m_path.path);
+ }
if ((statbuf.st_mode & S_IFMT) != S_IFREG)
bye("Not a regular file %s", m_path.path);
/* get definition to deal with potential multi */
@@ -199,6 +205,7 @@ int main(int argc, char **argv)
push_path(&t_path, DEF_NAME);
if (lstat(t_path.path, &statbuf) < 0 ||
(statbuf.st_mode & S_IFMT) != S_IFREG) {
+ fprintf(out_stream, "The specified configuration node is not valid\n");
bye("Can not delete value, no definition for %s", m_path.path);
}
/* defniition present */
@@ -254,9 +261,10 @@ int main(int argc, char **argv)
remove_rf(FALSE);
return 0;
}
+ fprintf(out_stream, "The specified configuration node is not valid\n");
bye("There is no appropriate template for %s",
m_path.path + strlen(get_mdirp()));
- return 0;
+ return 1;
}