about summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-09-10T13·32+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-09-10T13·32+0000
commitdcc433de47d4bf4a27fe63bc8996e946164ae885 (patch)
tree0d27a8f0433094144b7cdab591726f2ec288d937 /src/libutil/util.cc
parentc16be6ac92b86981e8e4bb6703e694b675a28b0d (diff)
* Operation `--delete-generations' to delete generations of a
  profile.  Arguments are either generation number, or `old' to delete
  all non-current generations.  Typical use:

  $ nix-env --delete-generations old
  $ nix-collect-garbage

* istringstream -> string2Int.

Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index a25665e4a88c..5a41c098654e 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -616,3 +616,11 @@ bool statusOk(int status)
 {
     return WIFEXITED(status) && WEXITSTATUS(status) == 0;
 }
+
+
+bool string2Int(const string & s, int & n)
+{
+    istringstream str(s);
+    str >> n;
+    return str && str.eof();
+}