From 0ca0d0126224e3b6636ef0f4d8cc78806e3311ee Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 23 Jan 2009 13:47:18 -0800 Subject: [PATCH] coding style cleanups --- bti.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/bti.c b/bti.c index 0ae103d..3bcf055 100644 --- a/bti.c +++ b/bti.c @@ -36,11 +36,11 @@ #define dbg(format, arg...) \ do { \ if (debug) \ - printf("%s: " format , __func__ , ## arg ); \ + printf("%s: " format , __func__ , ## arg); \ } while (0) -static int debug = 0; +static int debug; enum host { HOST_TWITTER = 0, @@ -395,9 +395,11 @@ static void log_session(struct session *session, int retval) } if (retval) - fprintf(log_file, "%s: host=%s tweet failed\n", session->time, host); + fprintf(log_file, "%s: host=%s tweet failed\n", + session->time, host); else - fprintf(log_file, "%s: host=%s tweet=%s\n", session->time, host, session->tweet); + fprintf(log_file, "%s: host=%s tweet=%s\n", + session->time, host, session->tweet); fclose(log_file); } @@ -423,12 +425,10 @@ int main(int argc, char *argv[], char *envp[]) int option; char *http_proxy; time_t t; -#if 0 - char *pwd = getenv("PWD"); - char *dir; -#endif + debug = 0; rl_bind_key('\t', rl_insert); + session = session_alloc(); if (!session) { fprintf(stderr, "no more memory...\n"); @@ -497,7 +497,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("host = %d\n", session->host); break; case 'b': - session->bash= 1; + session->bash = 1; break; case 'h': display_help(); @@ -520,31 +520,18 @@ int main(int argc, char *argv[], char *envp[]) fprintf(stdout, "Enter twitter password: "); session->password = get_string_from_stdin(); } -#if 0 - /* get the current working directory basename */ - if (strcmp(pwd, home) == 0) - dir = "~"; - else { - dir = strrchr(pwd, '/'); - if (dir) - dir++; - else - dir = "?"; - } -#endif + tweet = get_string_from_stdin(); if (!tweet || strlen(tweet) == 0) { dbg("no tweet?\n"); return -1; } -// session->tweet = zalloc(strlen(tweet) + strlen(dir) + 10); session->tweet = zalloc(strlen(tweet) + 10); /* if --bash is specified, add the "PWD $ " to * the start of the tweet. */ if (session->bash) -// sprintf(session->tweet, "%s $ %s", dir, tweet); sprintf(session->tweet, "$ %s", tweet); else sprintf(session->tweet, "%s", tweet); -- 2.39.5