Example #1
0
File: shell.c Project: petrm/elua
// 'wofmt' handler
static void shell_wofmt( int argc, char **argv )
{
#ifndef BUILD_WOFS
  printf( "WOFS not enabled.\n" );
#else // #ifndef BUILD_WOFS
  int c;

  printf( "Formatting the internal WOFS will DESTROY ALL THE FILES FROM WOFS.\n" );
  while( 1 )
  {
    printf( "Are you sure you want to continue? [y/n] " );
    c = term_getch( TERM_INPUT_WAIT );
    printf( "%c\n", isprint( c ) ? c : ' ' );
    c = tolower( c );
    if( c == 'n' )
      return;
    else if( c == 'y' )
      break;
  }
  printf( "Formatting ... " );
  if( !wofs_format() )
  {
    printf( "\ni*** ERROR ***: unable to erase the internal flash. WOFS might be compromised.\n" );
    printf( "It is advised to re-flash the eLua image.\n" );
  }
  else
    printf( " done.\n" );
#endif // #ifndef BUILD_WOFS
}
Example #2
0
void shell_wofmt( int argc, char **argv )
{
  if( argc != 1 )
  {
    SHELL_SHOW_HELP( wofmt );
    return;
  }
  printf( "Formatting the internal WOFS will DESTROY ALL THE FILES FROM WOFS.\n" );
  if( shellh_ask_yes_no( "Are you sure you want to continue? [y/n] " ) == 0 )
    return;
  printf( "Formatting ..." );
  if( !wofs_format() )
  {
    printf( "\ni*** ERROR ***: unable to erase the internal flash. WOFS might be compromised.\n" );
    printf( "It is advised to re-flash the eLua image.\n" );
  }
  else
    printf( " done.\n" );
}