]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
CHG: syntax sugar
authoriceman1001 <iceman@iuse.se>
Tue, 7 Feb 2017 21:26:42 +0000 (22:26 +0100)
committericeman1001 <iceman@iuse.se>
Tue, 7 Feb 2017 21:26:42 +0000 (22:26 +0100)
client/cmdscript.c

index e9ec587110142e258688c517abf6099df5256fb6..87544a99114bbf74468d2806be67a460a5a6e6bf 100644 (file)
@@ -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("%-21s %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
Impressum, Datenschutz