acassis commented on code in PR #3532:
URL: https://github.com/apache/nuttx-apps/pull/3532#discussion_r3375639545


##########
nshlib/nsh_dropbear.c:
##########
@@ -26,45 +26,51 @@
 
 #include <nuttx/config.h>
 
-#include <nuttx/compiler.h>
+#include <assert.h>
+#include <debug.h>
 
-#include <stdint.h>
+#include "nsh.h"
+#include "nsh_console.h"
 
-#include "nxmb_internal.h"
+#ifdef CONFIG_NSH_DROPBEAR
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name: nxmb_lrc
+ * Name: nsh_dropbearstart
  *
  * Description:
- *   Calculate Modbus ASCII LRC checksum.
+ *   nsh_dropbearstart() starts the Dropbear SSH server.  This function
+ *   returns immediately after the daemon has been started.
  *
- * Input Parameters:
- *   buf - Pointer to data buffer
- *   len - Length of data in bytes
- *
- * Returned Value:
- *   LRC value (8-bit)
+ * Returned Values:
+ *   Zero is returned if Dropbear was started.  A negated errno value will be
+ *   returned on failure.
  *
  ****************************************************************************/
 
-uint8_t nxmb_lrc(FAR const uint8_t *buf, uint16_t len)
+#ifndef CONFIG_NSH_DISABLE_DROPBEARSTART
+int nsh_dropbearstart(void)
 {
-  uint8_t  lrc = 0;
-  uint16_t i;
+  FAR struct console_stdio_s *pstate = nsh_newconsole(false);
+  char cmdline[] = CONFIG_NETUTILS_DROPBEAR_PROGNAME " &";
+  int ret;
 
-  if (buf == NULL || len == 0)
-    {
-      return lrc;
-    }
+  DEBUGASSERT(pstate != NULL);
 
-  for (i = 0; i < len; i++)
+  ninfo("Starting the Dropbear SSH server\n");
+
+  ret = nsh_parse(&pstate->cn_vtbl, cmdline);

Review Comment:
   Why to use it instead of doing like Telnet does: "nsh_session(pstate, 
NSH_LOGIN_TELNET, argc, argv);" ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to