Permalink
Browse files

Merge branch 'master' into gregoa

  • Loading branch information...
2 parents 62218d9 + 9b88bdb commit 49444d16c5c1a9faa75a715214e2436010daa7e6 @gregoa gregoa committed Nov 4, 2011
Showing with 38 additions and 13 deletions.
  1. +1 −1 HACKING
  2. +30 −7 bti.c
  3. +1 −0 bti.xml
  4. +6 −5 config.c
View
@@ -1,7 +1,7 @@
Patches are gladly accepted for bti code, please send them to
greg@kroah.com, or you can use github to send a pull request.
-The code tree for smubatch is located at:
+The code tree for bti is located at:
http://github.com/gregkh/bti
and can be cloned using git from:
git://github.com/gregkh/bti.git
View
37 bti.c
@@ -100,8 +100,10 @@ static char *get_string(const char *name)
exit(1);
if (name != NULL)
fprintf(stdout, "%s", name);
- if (!fgets(string, 999, stdin))
+ if (!fgets(string, 999, stdin)) {
+ free(string);
return NULL;
+ }
temp = strchr(string, '\n');
if (temp)
*temp = '\0';
@@ -256,9 +258,9 @@ const char identica_name[] = "identi.ca";
static const char twitter_request_token_uri[] = "http://twitter.com/oauth/request_token";
static const char twitter_access_token_uri[] = "http://twitter.com/oauth/access_token";
static const char twitter_authorize_uri[] = "http://twitter.com/oauth/authorize?oauth_token=";
-static const char identica_request_token_uri[] = "http://identi.ca/api/oauth/request_token?oauth_callback=oob";
-static const char identica_access_token_uri[] = "http://identi.ca/api/oauth/access_token";
-static const char identica_authorize_uri[] = "http://identi.ca/api/oauth/authorize?oauth_token=";
+static const char identica_request_token_uri[] = "https://identi.ca/api/oauth/request_token?oauth_callback=oob";
+static const char identica_access_token_uri[] = "https://identi.ca/api/oauth/access_token";
+static const char identica_authorize_uri[] = "https://identi.ca/api/oauth/authorize?oauth_token=";
static const char user_uri[] = "/user_timeline/";
static const char update_uri[] = "/update.xml";
@@ -555,8 +557,10 @@ static int send_request(struct session *session)
curl_buf->session = session;
curl = curl_init();
- if (!curl)
+ if (!curl) {
+ bti_curl_buffer_free(curl_buf);
return -EINVAL;
+ }
if (!session->hosturl)
session->hosturl = strdup(twitter_host);
@@ -656,26 +660,43 @@ static int send_request(struct session *session)
if (res) {
fprintf(stderr, "error(%d) trying to "
"perform operation\n", res);
+ curl_easy_cleanup(curl);
+ if (session->action == ACTION_UPDATE)
+ curl_formfree(formpost);
+ bti_curl_buffer_free(curl_buf);
return -EINVAL;
}
doc = xmlReadMemory(curl_buf->data,
curl_buf->length,
"response.xml", NULL,
XML_PARSE_NOERROR);
- if (doc == NULL)
+ if (doc == NULL) {
+ curl_easy_cleanup(curl);
+ if (session->action == ACTION_UPDATE)
+ curl_formfree(formpost);
+ bti_curl_buffer_free(curl_buf);
return -EINVAL;
+ }
current = xmlDocGetRootElement(doc);
if (current == NULL) {
fprintf(stderr, "empty document\n");
xmlFreeDoc(doc);
+ curl_easy_cleanup(curl);
+ if (session->action == ACTION_UPDATE)
+ curl_formfree(formpost);
+ bti_curl_buffer_free(curl_buf);
return -EINVAL;
}
if (xmlStrcmp(current->name, (const xmlChar *)"status")) {
fprintf(stderr, "unexpected document type\n");
xmlFreeDoc(doc);
+ curl_easy_cleanup(curl);
+ if (session->action == ACTION_UPDATE)
+ curl_formfree(formpost);
+ bti_curl_buffer_free(curl_buf);
return -EINVAL;
}
@@ -835,8 +856,10 @@ static char *get_string_from_stdin(void)
if (!string)
return NULL;
- if (!fgets(string, 999, stdin))
+ if (!fgets(string, 999, stdin)) {
+ free(string);
return NULL;
+ }
temp = strchr(string, '\n');
if (temp)
*temp = '\0';
View
@@ -1,4 +1,5 @@
<?xml version='1.0'?>
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
View
@@ -351,20 +351,21 @@ void bti_parse_configfile(struct session *session)
* marker if it occurs at the beginning of the line, or after
* whitespace
*/
- hashmarker = strchrnul(line, '#');
+ hashmarker = strchr(line, '#');
if (line == hashmarker)
line[0] = '\0';
else {
- while (hashmarker[0] != '\0') {
+ while (hashmarker != NULL) {
--hashmarker;
- if (isblank(hashmarker[0]))
+ if (isblank(hashmarker[0])) {
hashmarker[0] = '\0';
- else {
+ break;
+ } else {
/*
* false positive; '#' occured
* within a string
*/
- hashmarker = strchrnul(hashmarker+2, '#');
+ hashmarker = strchr(hashmarker+2, '#');
}
}
}

0 comments on commit 49444d1

Please sign in to comment.