/*
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
*
* it under the terms of the MIT license. See LICENSE for details.
*/
#include <stdlib.h>
#include <string.h>
#include <jansson.h>
/* Return the offset of the first newline in text or the length of
text if there's no newline */
{
if(!newline)
else
}
struct write_result
{
char *data;
int pos;
};
{
{
return 0;
}
}
{
long code;
curl = curl_easy_init();
if(!curl)
goto error;
if(!data)
goto error;
.pos = 0
};
/* GitHub commits API v3 requires a User-Agent header */
if(status != 0)
{
goto error;
}
if(code != 200)
{
goto error;
}
/* zero-terminate the result */
return data;
if(data)
if(curl)
if(headers)
return NULL;
}
{
size_t i;
char *text;
if(argc != 3)
{
return 2;
}
if(!text)
return 1;
if(!root)
{
return 1;
}
if(!json_is_array(root))
{
return 1;
}
for(i = 0; i < json_array_size(root); i++)
{
const char *message_text;
if(!json_is_object(data))
{
return 1;
}
if(!json_is_string(sha))
{
return 1;
}
if(!json_is_object(commit))
{
return 1;
}
if(!json_is_string(message))
{
return 1;
}
printf("%.8s %.*s\n",
}
return 0;
}