Quellcode durchsuchen

clearing history buffer on logout

stefan vor 1 Jahr
Ursprung
Commit
6494717d1a
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 8 2
      src/shellmatta_auth.c

+ 8 - 2
src/shellmatta_auth.c

@@ -19,6 +19,7 @@
 
 #include "shellmatta.h"
 #include "shellmatta_auth.h"
+#include "shellmatta_history.h"
 #include <stdint.h>
 #include <stddef.h>
 #include <string.h>
@@ -53,11 +54,11 @@ static uint32_t checkFct(shellmatta_handle_t handle, char *username, char *passw
     /** print login result */
     if (0 == userId)
     {
-        shellmatta_write(handle, "username or password is wrong\n", 31);
+        shellmatta_write(handle, "username or password is wrong\n", 30);
     }
     else
     {
-        shellmatta_write(handle, "login successful\n", 18);
+        shellmatta_write(handle, "login successful\n", 17);
     }
 
     return userId;
@@ -162,6 +163,11 @@ static shellmatta_retCode_t logoutCmdFct(const shellmatta_handle_t handle, const
     inst->userId = 0u;
     inst->userPointer = NULL;
 
+    /** reset history buffer */
+    history_reset(inst);
+
+    shellmatta_write(handle, "good bye\n", 9);
+
     (void)arguments;
     (void)length;