X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/4c36581b96dfb81c85f34a4229d82e51edeaf499..3919356baf9635c7cfa2f2bf77cc5b66da672cc2:/client/cmdscript.c

diff --git a/client/cmdscript.c b/client/cmdscript.c
index b8c97158..87544a99 100644
--- a/client/cmdscript.c
+++ b/client/cmdscript.c
@@ -64,7 +64,7 @@ int str_ends_with(const char * str, const char * suffix) {
  */
 int CmdHelp(const char * Cmd)
 {
-    PrintAndLog("This is a feature to run Lua-scripts. You can place lua-scripts within the scripts/-folder. ");
+    PrintAndLog("This is a feature to run Lua-scripts. You can place lua-scripts within the ´client/scripts/´ folder.");
     return 0;
 }
 
@@ -72,26 +72,27 @@ int CmdHelp(const char * Cmd)
 * Generate list of available commands, what it does is 
 * generate a file listing of the script-directory for files
 * ending with .lua
+*
 */
 int CmdList(const char *Cmd)
 {
-    DIR *dp;
     struct dirent *ep;
-    dp = opendir ("./scripts/");
-
-    if (dp != NULL)
-    {
-        while ((ep = readdir (dp)) != NULL)
-        {
-            if(str_ends_with(ep->d_name, ".lua"))
-                PrintAndLog("%-16s %s", ep->d_name, "A script file");
-        }
-        (void) closedir (dp);
-    }
-    else
-        PrintAndLog ("Couldn't open the scripts-directory");
+    DIR *dp = opendir ("./scripts/");
+	if ( dp == NULL ) {
+		PrintAndLog ("Couldn't open the scripts-directory");
+		return 1;
+	}
+
+	while ((ep = readdir (dp)) != NULL)
+	{
+		if(str_ends_with(ep->d_name, ".lua"))
+			PrintAndLog("%-21s %s", ep->d_name, "A script file");
+	}
+	(void) closedir (dp);
     return 0;
 }
+
+
 /**
  * Finds a matching script-file
  * @brief CmdScript
@@ -152,17 +153,13 @@ int CmdRun(const char *Cmd)
     char buf[256];
     snprintf(buf, sizeof buf, "./scripts/%s%s", script_name, suffix);
 
-    printf("--- Executing: %s, args'%s'\n",buf,arguments);
-
-
-
+    printf("--- Executing: %s, args'%s'\n", buf, arguments);
 
     // run the Lua script
 
     int error = luaL_loadfile(lua_state, buf);
     if(!error)
     {
-
         lua_pushstring(lua_state, arguments);
         lua_setglobal(lua_state, "args");