Skip to content

Instantly share code, notes, and snippets.

@amcjen
Last active August 29, 2015 14:00
Show Gist options
  • Save amcjen/11273667 to your computer and use it in GitHub Desktop.
Save amcjen/11273667 to your computer and use it in GitHub Desktop.
void prompt(void) {
char buf[IDLEN+1];
#if defined(TINY_BUILD)
msgp(M_prompt);
#else
// Run the script named "prompt" if there is one else print "> "
strncpy_P(buf, getmsg(M_promptid), IDLEN); // get the name "prompt" in our cmd buf
if (findscript(buf)) doCommand(buf);
else msgp(M_prompt); // else print default prompt
#endif
}
void initlbuf(void) {
lbufptr = lbuf;
#if defined(SERIAL_OVERRIDE) && 0
// don't do the prompt in serialIsOverridden mode
if (serialIsOverridden()) return;
#endif
prompt();
// flush any pending serial input
while (serialAvailable()) serialRead();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment