about summary refs log tree commit diff
path: root/src/libmain
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-09-06T12·06+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-09-06T12·06+0000
commite6cb3d0a0dcfe13e9b493afdc4e2107668ec99ff (patch)
treeabd88ce033d7932ff776ac4e41d2627d2f542d20 /src/libmain
parent82710f96f7ea72bc0f6fcc6d736e3ad4434c1988 (diff)
* Added a command ‘nix-store --verify-paths PATHS’ to check whether
  the contents of any of the given store paths have been modified.
  E.g.

    $ nix-store --verify-path $(nix-store -qR /var/run/current-system)
    path `/nix/store/m2smyiwbxidlprfxfz4rjlvz2c3mg58y-etc' was modified! expected hash `fc87e271c5fdf179b47939b08ad13440493805584b35e3014109d04d8436e7b8', got `20f1a47281b3c0cbe299ce47ad5ca7340b20ab34246426915fce0ee9116483aa'

  All paths are checked; the exit code is 1 if any path has been
  modified, 0 otherwise.

Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc12
-rw-r--r--src/libmain/shared.hh3
2 files changed, 9 insertions, 6 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index f0035c358f1d..8532cdaadcab 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -187,12 +187,11 @@ static void initAndRun(int argc, char * * argv)
        ignore options for the ATerm library. */
     for (Strings::iterator i = args.begin(); i != args.end(); ++i) {
         string arg = *i;
-        if (string(arg, 0, 4) == "-at-") ;
-        else if (arg.length() > 2 && arg[0] == '-' && arg[1] != '-' && !isdigit(arg[1])) {
+        if (arg.length() > 2 && arg[0] == '-' && arg[1] != '-' && !isdigit(arg[1])) {
             for (unsigned int j = 1; j < arg.length(); j++)
                 if (isalpha(arg[j]))
                     remaining.push_back((string) "-" + arg[j]);
-                else {
+                else     {
                     remaining.push_back(string(arg, j));
                     break;
                 }
@@ -332,6 +331,9 @@ static void * oomHandler(size_t requested)
 }
 
 
+int exitCode = 0;
+
+
 }
 
 
@@ -390,7 +392,5 @@ int main(int argc, char * * argv)
         return 1;
     }
 
-    return 0;
+    return exitCode;
 }
-
- 
diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh
index bd3d19531a80..1d6a6ec5737d 100644
--- a/src/libmain/shared.hh
+++ b/src/libmain/shared.hh
@@ -53,6 +53,9 @@ struct RemoveTempRoots
     ~RemoveTempRoots();    
 };
 
+/* Exit code of the program. */
+extern int exitCode;
+
 }