]> ruin.nu Git - popboot.git/blobdiff - parser.y
Spelling fix in inittab
[popboot.git] / parser.y
index c3192e33861130542aa2b74065d1e9c0f9506fcf..ad68377a79770ad4c4403dd80e29bffc68d682d6 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -13,6 +13,7 @@
 
     using namespace std;
 
+    int yyparse(void);
     int yylex (void);
     void yyerror (char const *);
 
@@ -64,24 +65,24 @@ action      : id preconds '\n' exec effects '\n' {
 
                                //---------------------------------------------
                                // Debug test print :   
-                               cout << "id:  " << *$1 << endl;
+/*                             cerr << "id:  " << *$1 << endl;
 
                                // Precondition flags:
-                               cout << "a: " << (*$2)["a"] << endl;
-                               cout << "b: " << (*$2)["b"] << endl;
-                               cout << "c: " << (*$2)["c"] << endl;
-                               cout << "d: " << (*$2)["d"] << endl;
-                               cout << "e: " << (*$2)["e"] << endl;
+                               cerr << "a: " << (*$2)["a"] << endl;
+                               cerr << "b: " << (*$2)["b"] << endl;
+                               cerr << "c: " << (*$2)["c"] << endl;
+                               cerr << "d: " << (*$2)["d"] << endl;
+                               cerr << "e: " << (*$2)["e"] << endl;
 
-                               cout << "exe: " << *$4 << endl;
+                               cerr << "exe: " << *$4 << endl;
 
                                // Print number of effects
-                               cout << "1: " << (*$5)[1].size() << endl;
-                               cout << "99: " << (*$5)[99].size() << endl;
-                               cout << "88: " << (*$5)[88].size() << endl;
+                               cerr << "0: " << (*$5)[0].size() << endl;
+                               cerr << "99: " << (*$5)[99].size() << endl;
+                               cerr << "88: " << (*$5)[88].size() << endl;
 
-                               cout << endl;
-                               //----------------------------------------------
+                               cerr << endl;
+*/                             //----------------------------------------------
                                            }
        ;
 
@@ -226,13 +227,14 @@ int
 main (int argc, char** argv)
 {
 
-    if (argc!=4)
+    if (argc < 3)
     {
-       cout << "Syntax: " << argv[0] << 
+       cerr << "Syntax: " << argv[0] << 
                " <file> <runlevel> \"init state\"" << endl;
        return 1;
     }
 
+       Literals init = argc >= 4 ? stringToVector(argv[3]) : Literals();
     ifstream file(argv[1]);
     if (!file)
     {
@@ -247,11 +249,14 @@ main (int argc, char** argv)
 
     yyparse();
 
-    cout << (*runlevels)[2].size() << endl;
-    cout << (*runlevels)[3].size() << endl;
-    cout << (*runlevels)[4].size() << endl;
-    cout << (*runlevels)[5].size() << endl;
-
-    Planner p(*actions, stringToVector(argv[3]), (*runlevels)[atoi(argv[2])]);
+/*    cerr << (*runlevels)[2].size() << endl;
+    cerr << (*runlevels)[3].size() << endl;
+    cerr << (*runlevels)[4].size() << endl;
+    cerr << (*runlevels)[5].size() << endl;
+*/
+    Planner p(*actions, init, (*runlevels)[atoi(argv[2])]);
     p.execute();
+
+    delete actions;
+       delete runlevels;
 }