Skip to content

Commit

Permalink
need to make output all pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
uberj committed Mar 6, 2011
1 parent a886728 commit cd19481
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


int _hex_print( unsigned char* array, int size);
int remove_www(char *url);

int main( int argc, char **argv ){
struct DNS_REQUEST question;
Expand All @@ -32,7 +33,8 @@ int main( int argc, char **argv ){
// int qsize = ( sizeof(unsigned char) * strlen(argv[1]) ) + 5;
//question.query = (unsigned char *) malloc( qsize );
unsigned char query[19];
question.query = &query;
remove_www(argv[1]);
question.query = &query[0];
// Fill in that cruft
int i;
for(i=0;i<6;i++){
Expand Down Expand Up @@ -60,14 +62,24 @@ int main( int argc, char **argv ){
/*
* Sending request
*/
send_request(&question,&answer);
send_request(&question,&answer[0]);
printf("RESPONSE:\n");
_hex_print(&answer,512);
parse_answer(&answer,&question);
_hex_print(&answer[0],512);
parse_answer(&answer[0],&question);
return 0;

}

int remove_www(char *url){
char * temp;
if(url[0]=='w' && url[1]=='w' && url[2]=='w'){
temp = (char *) malloc(strlen(url)-2);
strcpy(temp,&url[4]);
strcpy(url,temp);
}
return 0;
}

int _hex_print( unsigned char* array, int size){
int i;
printf("hex string: \n");
Expand Down

0 comments on commit cd19481

Please sign in to comment.