From: Greg Kroah-Hartman Date: Wed, 12 Jan 2011 22:16:46 +0000 (-0800) Subject: create bti.h X-Git-Url: https://git.toastfreeware.priv.at/gregoa/bti.git/commitdiff_plain/9185ab0c0a2ea1db12bcb31f81aba7f54c36bdbc create bti.h Moved the main data structure into there, this will let us (hopefully) start refactoring the code to be a bit more readable and maintainable over the long-run. Signed-off-by: Greg Kroah-Hartman --- diff --git a/Makefile.am b/Makefile.am index 7b5953e..c3ab947 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,6 +5,7 @@ bin_SCRIPTS = \ bti-shrink-urls bti_SOURCES = \ + bti.h \ bti.c bti_CFLAGS = \ diff --git a/bti.c b/bti.c index 428e4bc..b5a01d3 100644 --- a/bti.c +++ b/bti.c @@ -40,7 +40,7 @@ #include #include #include - +#include "bti.h" #define zalloc(size) calloc(size, 1) @@ -54,64 +54,6 @@ static int debug; -enum host { - HOST_TWITTER = 0, - HOST_IDENTICA = 1, - HOST_CUSTOM = 2 -}; - -enum action { - ACTION_UPDATE = 0, - ACTION_FRIENDS = 1, - ACTION_USER = 2, - ACTION_REPLIES = 4, - ACTION_PUBLIC = 8, - ACTION_GROUP = 16, - ACTION_RETWEET = 32, - ACTION_UNKNOWN = 64 -}; - -struct session { - char *password; - char *account; - char *consumer_key; - char *consumer_secret; - char *access_token_key; - char *access_token_secret; - char *tweet; - char *proxy; - char *time; - char *homedir; - char *logfile; - char *user; - char *group; - char *hosturl; - char *hostname; - char *configfile; - char *replyto; - char *retweet; - int bash; - int background; - int interactive; - int shrink_urls; - int dry_run; - int page; - int no_oauth; - int guest; - int verbose; - enum host host; - enum action action; - void *readline_handle; - char *(*readline)(const char *); -}; - -struct bti_curl_buffer { - char *data; - struct session *session; - enum action action; - int length; -}; - static void display_help(void) { fprintf(stdout, "bti - send tweet to twitter or identi.ca\n" diff --git a/bti.h b/bti.h new file mode 100644 index 0000000..ebdbb41 --- /dev/null +++ b/bti.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2008-2011 Greg Kroah-Hartman + * Copyright (C) 2009 Bart Trojanowski + * Copyright (C) 2009-2010 Amir Mohammad Saied + * + * 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 version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __BTI_H +#define __BTI_H + +enum host { + HOST_TWITTER = 0, + HOST_IDENTICA = 1, + HOST_CUSTOM = 2 +}; + +enum action { + ACTION_UPDATE = 0, + ACTION_FRIENDS = 1, + ACTION_USER = 2, + ACTION_REPLIES = 4, + ACTION_PUBLIC = 8, + ACTION_GROUP = 16, + ACTION_RETWEET = 32, + ACTION_UNKNOWN = 64 +}; + +struct session { + char *password; + char *account; + char *consumer_key; + char *consumer_secret; + char *access_token_key; + char *access_token_secret; + char *tweet; + char *proxy; + char *time; + char *homedir; + char *logfile; + char *user; + char *group; + char *hosturl; + char *hostname; + char *configfile; + char *replyto; + char *retweet; + int bash; + int background; + int interactive; + int shrink_urls; + int dry_run; + int page; + int no_oauth; + int guest; + int verbose; + enum host host; + enum action action; + void *readline_handle; + char *(*readline)(const char *); +}; + +struct bti_curl_buffer { + char *data; + struct session *session; + enum action action; + int length; +}; + +#endif