Merge 0.10->trunk
[prosody.git] / prosody
diff --git a/prosody b/prosody
index e6a23d8e703f6fb172f188d45a6e87a089fde333..a2cb0e6cdb09319aa1650d7b51f4597728947aab 100755 (executable)
--- a/prosody
+++ b/prosody
@@ -43,6 +43,12 @@ if CFG_DATADIR then
        end
 end
 
+if #arg > 0 and arg[1] ~= "--config" then
+       print("Unknown command-line option: "..tostring(arg[1]));
+       print("Perhaps you meant to use prosodyctl instead?");
+       return 1;
+end
+
 -- Global 'prosody' object
 local prosody = { events = require "util.events".new(); };
 _G.prosody = prosody;
@@ -121,6 +127,7 @@ end
 
 function load_libraries()
        -- Load socket framework
+       socket = require "socket";
        server = require "net.server"
 end    
 
@@ -371,8 +378,10 @@ function loop()
                prosody.events.fire_event("very-bad-error", {error = err, traceback = traceback});
        end
        
+       local sleep = require"socket".sleep;
+
        while select(2, xpcall(server.loop, catch_uncaught_error)) ~= "quitting" do
-               socket.sleep(0.2);
+               sleep(0.2);
        end
 end