summaryrefslogtreecommitdiff
path: root/pm/functions.in
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-05-28 20:06:44 -0500
committerVictor Lowther <victor.lowther@gmail.com>2008-05-28 20:06:44 -0500
commitfc4b5c0962ca731ff59d1867a68caa0c00b8b02e (patch)
tree6bba93a2f2b86ca3849a69652f6db17f988de5a8 /pm/functions.in
parent3dd57d94dd26f2d0012fbc7bd1f3d192496c4491 (diff)
Make parameter manipulation more robust in the face of programmer
error. Use cp and rm when manipulating parameter files instead of mv.
Diffstat (limited to 'pm/functions.in')
-rw-r--r--pm/functions.in11
1 files changed, 6 insertions, 5 deletions
diff --git a/pm/functions.in b/pm/functions.in
index d3bdd47..edee445 100644
--- a/pm/functions.in
+++ b/pm/functions.in
@@ -194,26 +194,27 @@ restorestate()
remove_parameters() {
local p
if [ "$1" = "all" ]; then
- echo '' > "$NEW_PARAMETERS"
+ echo '' > "$PARAMETERS.new"
else
echo '' >"$PARAMETERS.rm"
for p in "$@"; do
echo "$p" >> "$PARAMETERS.rm"
done
# let grep do the dirty work.
- grep -vxFf "$PARAMETERS.rm" "$PARAMETERS" > "$NEW_PARAMETERS"
+ grep -vxFf "$PARAMETERS.rm" "$PARAMETERS" > "$PARAMETERS.new"
fi
+ cp -f "$PARAMETERS.new" "$PARAMETERS"
}
# Add a parameter to our commandline parameters.
add_parameters() {
remove_parameters "$@" # no dups, please.
for x in "$@"; do
- echo "$x" >>"$NEW_PARAMETERS"
+ echo "$x" >>"$PARAMETERS"
done
}
-# Remove a parameter from our commandline parameters.
+# Get our commandline parameters
get_parameters() {
- cat "$PARAMETERS"
+ cat "$PARAMETERS"
}