Created
April 23, 2013 15:12
-
-
Save ssaavedra/5444397 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************************************************************************** | |
* Twitter client for the CLI. * | |
* Copyright (C) 2013 by Santiago Saavedra and Daniel Valcarce * | |
* <santiagosaavedra@gmail.com>, <danivalsil@gmail.com> * | |
* * | |
* This program is free software; you can redistribute it and/or modify * | |
* it under the terms of the GNU General Public License as published by * | |
* the Free Software Foundation; either version 2 of the License, or * | |
* (at your option) any later version. * | |
***************************************************************************/ | |
/*************************************************************************** | |
* This is made as a final exercise for Compilers in the University of * | |
* A Coruna. * | |
* Year: 2012/2013 * | |
**************************************************************************/ | |
#include "headers.h" | |
#include "json_utils.h" | |
char *server; | |
char *url; | |
extern char *http_server; | |
extern int http_port; | |
extern char *http_proxy_server; | |
extern int http_proxy_port; | |
int main(int argc, char *argv[]) | |
{ | |
http_port = 80; | |
int retcode; | |
char *data; | |
char type[64]; | |
int len; | |
if (argc < 2) { | |
fprintf(stderr, "Feed me a file.\n"); | |
exit(EXIT_FAILURE); | |
} | |
http_server = argv[1]; | |
url = argv[2]; | |
retcode = http_get(url, &data, &len, type); | |
printf("Received retcode = %d\n", retcode); | |
printf("Len = %d || Type = %s\n", len, type); | |
printf("\n----- BEGIN DATA BLOCK -----\n"); | |
printf("%s", data); | |
printf("\n----- END DATA BLOCK -----\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Daniel@MacBook-Pro-3:twitter-cli $ ./twitter-cli http://www.google.es
host=(www.google.es), port=80, filename=()
HTTP/1.0 302 Found
http_retcode = 302, typebuf = '', length = 0
data: (null)