Beispiel #1
0
/*---------------------------------------------------------------------------*/
void
shell_quit(void)
{
  shell_stop();
  process_exit(&shell_process);
  process_exit(&shell_server_process);
}
Beispiel #2
0
/**
 * "goto" command
 *
 * @v argc		Argument count
 * @v argv		Argument list
 * @ret rc		Return status code
 */
static int goto_exec ( int argc, char **argv ) {
	struct goto_options opts;
	size_t saved_offset;
	int rc;

	/* Parse options */
	if ( ( rc = parse_options ( argc, argv, &goto_cmd, &opts ) ) != 0 )
		return rc;

	/* Sanity check */
	if ( ! current_image ) {
		rc = -ENOTTY;
		printf ( "Not in a script: %s\n", strerror ( rc ) );
		return rc;
	}

	/* Parse label */
	goto_label = argv[optind];

	/* Find label */
	saved_offset = script_offset;
	if ( ( rc = process_script ( current_image, goto_find_label,
				     terminate_on_label_found ) ) != 0 ) {
		script_offset = saved_offset;
		return rc;
	}

	/* Terminate processing of current command */
	shell_stop ( SHELL_STOP_COMMAND );

	return 0;
}
Beispiel #3
0
/*---------------------------------------------------------------------------*/
void
telnetd_appcall(void *ts)
{
  if(uip_connected()) {
    if(!connected) {
      buf_init(&buf);
      s.bufptr = 0;
      s.state = STATE_NORMAL;
      connected = 1;
      shell_start();
      timer_set(&s.silence_timer, MAX_SILENCE_TIME);
      ts = (char *)0;
    } else {
      uip_send(telnetd_reject_text, strlen(telnetd_reject_text));
      ts = (char *)1;
    }
    tcp_markconn(uip_conn, ts);
  }

  if(!ts) {
    if(s.state == STATE_CLOSE) {
      s.state = STATE_NORMAL;
      uip_close();
      return;
    }
    if(uip_closed() ||
       uip_aborted() ||
       uip_timedout()) {
      shell_stop();
      connected = 0;
    }
    if(uip_acked()) {
      timer_set(&s.silence_timer, MAX_SILENCE_TIME);
      acked();
    }
    if(uip_newdata()) {
      timer_set(&s.silence_timer, MAX_SILENCE_TIME);
      newdata();
    }
    if(uip_rexmit() ||
       uip_newdata() ||
       uip_acked() ||
       uip_connected() ||
       uip_poll()) {
      senddata();
      if(s.numsent > 0) {
	timer_set(&s.silence_timer, MAX_SILENCE_TIME);
      }
    }
    if(uip_poll()) {
      if(timer_expired(&s.silence_timer)) {
        uip_close();
        tcp_markconn(uip_conn, NULL);
      }
    }
  }
}
Beispiel #4
0
int
cmd_exit (Shell *shell, void *args)
{
	shell_stop (shell);
	return 0;
}