i2c/cmds/i2csh/i2csh.c
static char *readline(const char *prompt)
{
  static char linebuf[512]; // real readline() uses malloc's so adjust
  int         bIsBlank;
  char       *s;

  if( prompt && *prompt )
  {
    printf("%s", prompt);
  }

  if( fgets(linebuf, (int)sizeof(linebuf), stdin) == NULL )
  {
    return 0;
  }

  linebuf[sizeof(linebuf)-1] = 0;

  bIsBlank = 1;
  for(s=linebuf; *s && bIsBlank; ++s)
  {
    if( !isspace(*s) )
    {
      bIsBlank = 0;
    }
  }

  if( bIsBlank )
  {
    return NULL;
  }
  else
  {
    return linebuf;
  }
}
/*!
 * \brief Read an input line from stdin.
 *
 * This function is used only if there is no readline functionality.
 *
 * \param prompt  User prompt string.
 *
 * \return Returns read line buffer.
 */
\brief Read an input line from stdin.
This function is used only if there is no readline functionality.

\param prompt  User prompt string.

\return Returns read line buffer.
\ brief Read an input line from stdin . This function is used only if there is no readline functionality . \ param prompt User prompt string . \ return Returns read line buffer .
static char *readline(const char *prompt)
{
  static char linebuf[512]; 
  int         bIsBlank;
  char       *s;
  if( prompt && *prompt )
  {
    printf("%s", prompt);
  }
  if( fgets(linebuf, (int)sizeof(linebuf), stdin) == NULL )
  {
    return 0;
  }
  linebuf[sizeof(linebuf)-1] = 0;
  bIsBlank = 1;
  for(s=linebuf; *s && bIsBlank; ++s)
  {
    if( !isspace(*s) )
    {
      bIsBlank = 0;
    }
  }
  if( bIsBlank )
  {
    return NULL;
  }
  else
  {
    return linebuf;
  }
}
static char * readline ( const char * prompt ) { static char linebuf [ 512 ] ; int bIsBlank ; char * s ; if ( prompt && * prompt ) { printf ( " " , prompt ) ; } if ( fgets ( linebuf , ( int ) sizeof ( linebuf ) , stdin ) == NULL ) { return 0 ; } linebuf [ sizeof ( linebuf ) - 1 ] = 0 ; bIsBlank = 1 ; for ( s = linebuf ; * s && bIsBlank ; ++ s ) { if ( ! isspace ( * s ) ) { bIsBlank = 0 ; } } if ( bIsBlank ) { return NULL ; } else { return linebuf ; } }
\brief Read an input line from stdin.
\ brief Read an input line from stdin .
// real readline() uses malloc's so adjust