Default for warnings changed to "off"

Warnings are mostly a tool to help developers (e.g., by showing hidden
error messages); regular users usually don't need to see them.
diff --git a/all b/all
index 8f78ee4..2a8cb92 100755
--- a/all
+++ b/all
@@ -2,7 +2,7 @@
 cd testes/libs; make -s
 cd ..     # back to directory 'testes'
 ulimit -S -s 2000
-if { ../lua all.lua; } then 
+if { ../lua -W all.lua; } then
   echo -e "\n\n    final OK!!!!\n\n"
 else
   echo -e "\n\n    >>>> BUG!!!!\n\n"
diff --git a/lauxlib.c b/lauxlib.c
index 5a040ac..b6740b1 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1037,7 +1037,7 @@
     lua_atpanic(L, &panic);
     warnstate = (int *)lua_newuserdatauv(L, sizeof(int), 0);
     luaL_ref(L, LUA_REGISTRYINDEX);  /* make sure it won't be collected */
-    *warnstate = 1;  /* next message starts a new warning */
+    *warnstate = 0;  /* default is warnings off */
     lua_setwarnf(L, warnf, warnstate);
   }
   return L;
diff --git a/ltests.c b/ltests.c
index 95c41fd..0d4ec93 100644
--- a/ltests.c
+++ b/ltests.c
@@ -92,7 +92,7 @@
 static void warnf (void *ud, const char *msg, int tocont) {
   lua_State *L = cast(lua_State *, ud);
   static char buff[200] = "";  /* should be enough for tests... */
-  static int onoff = 1;
+  static int onoff = 0;
   static int mode = 0;  /* start in normal mode */
   static int lasttocont = 0;
   if (!lasttocont && !tocont && *msg == '@') {  /* control message? */
diff --git a/lua.c b/lua.c
index d13e203..18f53c3 100644
--- a/lua.c
+++ b/lua.c
@@ -73,7 +73,7 @@
   "  -l name  require library 'name' into global 'name'\n"
   "  -v       show version information\n"
   "  -E       ignore environment variables\n"
-  "  -q       turn warnings off\n"
+  "  -W       turn warnings on\n"
   "  --       stop handling options\n"
   "  -        stop handling options and execute stdin\n"
   ,
@@ -264,7 +264,7 @@
           return has_error;  /* invalid option */
         args |= has_E;
         break;
-      case 'q':
+      case 'W':
         if (argv[i][2] != '\0')  /* extra characters? */
           return has_error;  /* invalid option */
         break;
@@ -295,7 +295,7 @@
 
 /*
 ** Processes options 'e' and 'l', which involve running Lua code, and
-** 'q', which also affects the state.
+** 'W', which also affects the state.
 ** Returns 0 if some code raises an error.
 */
 static int runargs (lua_State *L, char **argv, int n) {
@@ -315,8 +315,8 @@
         if (status != LUA_OK) return 0;
         break;
       }
-      case 'q':
-        lua_warning(L, "@off", 0);  /* no warnings */
+      case 'W':
+        lua_warning(L, "@on", 0);  /* warnings on */
         break;
     }
   }
diff --git a/manual/manual.of b/manual/manual.of
index a3990d3..292d1e5 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -8735,7 +8735,7 @@
 @item{@T{-i}| enters interactive mode after running @rep{script};}
 @item{@T{-v}| prints version information;}
 @item{@T{-E}| ignores environment variables;}
-@item{@T{-q}| turn warnings off;}
+@item{@T{-W}| turn warnings on;}
 @item{@T{--}| stops handling options;}
 @item{@T{-}| executes @id{stdin} as a file and stops handling options.}
 }
@@ -8761,7 +8761,7 @@
 @Lid{package.path} and @Lid{package.cpath}
 with the default paths defined in @id{luaconf.h}.
 
-The options @T{-e}, @T{-l}, and @T{-q} are handled in
+The options @T{-e}, @T{-l}, and @T{-W} are handled in
 the order they appear.
 For instance, an invocation like
 @verbatim{
diff --git a/testes/all.lua b/testes/all.lua
index 42809b9..db074dd 100644
--- a/testes/all.lua
+++ b/testes/all.lua
@@ -5,8 +5,8 @@
 
 local version = "Lua 5.4"
 if _VERSION ~= version then
-  warn("This test suite is for ", version,
-        ", not for ", _VERSION, "\nExiting tests")
+  io.stderr:write("This test suite is for ", version,
+                  ", not for ", _VERSION, "\nExiting tests")
   return
 end
 
@@ -210,6 +210,7 @@
 end
 
 print("(there should be two warnings now)")
+warn("@on")
 warn("#This is ", "an expected", " warning")
 warn("@off")
 warn("******** THIS WARNING SHOULD NOT APPEAR **********")
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index 4fc2326..79bbf2e 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -163,6 +163,7 @@
   assert(not X and coroutine.status(co) == "dead")
 
   -- error closing a coroutine
+  warn("@on")
   local x = 0
   co = coroutine.create(function()
     local y <close> = func2close(function (self,err)
diff --git a/testes/gc.lua b/testes/gc.lua
index 34854d6..bb4e349 100644
--- a/testes/gc.lua
+++ b/testes/gc.lua
@@ -369,7 +369,7 @@
     s[n] = i
   end
 
-  warn("@store")
+  warn("@on"); warn("@store")
   collectgarbage()
   assert(string.find(_WARN, "error in __gc metamethod"))
   assert(string.match(_WARN, "@(.-)@") == "expected"); _WARN = nil
diff --git a/testes/locals.lua b/testes/locals.lua
index b4de523..58ad18c 100644
--- a/testes/locals.lua
+++ b/testes/locals.lua
@@ -313,6 +313,7 @@
   end
 end
 
+warn("@on")
 
 do print("testing errors in __close")
 
diff --git a/testes/main.lua b/testes/main.lua
index 5d2652c..de14a08 100644
--- a/testes/main.lua
+++ b/testes/main.lua
@@ -221,8 +221,11 @@
 RUN('echo "io.stderr:write(1000)\ncont" | lua -e "require\'debug\'.debug()" 2> %s', out)
 checkout("lua_debug> 1000lua_debug> ")
 
--- test warnings
-RUN('echo "io.stderr:write(1); warn[[XXX]]" | lua -q 2> %s', out)
+
+print("testing warnings")
+
+-- no warnings by default
+RUN('echo "io.stderr:write(1); warn[[XXX]]" | lua 2> %s', out)
 checkout("1")
 
 prepfile[[
@@ -236,7 +239,7 @@
 warn("@on")                  -- keep it "started"
 warn("Z", "Z", "Z")          -- common warning
 ]]
-RUN('lua %s 2> %s', prog, out)
+RUN('lua -W %s 2> %s', prog, out)
 checkout[[
 Lua warning: @offXXX@off
 Lua warning: @on
@@ -250,7 +253,7 @@
 u1 = setmetatable({}, {__gc = function () error("XYZ") end})
 u2 = setmetatable({}, {__gc = function () error("ZYX") end})
 ]]
-RUN('lua %s 2> %s', prog, out)
+RUN('lua -W %s 2> %s', prog, out)
 checkprogout("ZYX)\nXYZ)\n")