diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-07 17:33:02 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-07 17:33:02 +0100 |
commit | daae10fbfe16bac26f74af91faf253d377f1b166 (patch) | |
tree | e7870e81be568ab10abcc1bf8639a9191dbbb9c1 | |
parent | 289bd2d47ff58f42879ad50ebbc1b193831e4a78 (diff) |
OpenSolaris (non-gcc) fixes, patches from Dagobert Michelsen <dam@opencsw.org>
with some changes.
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | conf.c | 9 | ||||
-rwxr-xr-x | configure | 6 | ||||
-rw-r--r-- | irc_commands.c | 3 | ||||
-rw-r--r-- | lib/Makefile | 1 | ||||
-rw-r--r-- | lib/md5.h | 4 | ||||
-rw-r--r-- | lib/oauth.c | 2 | ||||
-rw-r--r-- | lib/sha1.h | 4 | ||||
-rw-r--r-- | lib/xmltree.c | 5 | ||||
-rw-r--r-- | protocols/Makefile | 1 | ||||
-rw-r--r-- | protocols/jabber/Makefile | 1 | ||||
-rw-r--r-- | protocols/jabber/jabber.c | 8 | ||||
-rw-r--r-- | protocols/jabber/message.c | 5 | ||||
-rw-r--r-- | protocols/msn/Makefile | 1 | ||||
-rw-r--r-- | protocols/msn/msn.c | 7 | ||||
-rw-r--r-- | protocols/nogaim.c | 4 | ||||
-rw-r--r-- | protocols/nogaim.h | 6 | ||||
-rw-r--r-- | protocols/oscar/Makefile | 1 | ||||
-rw-r--r-- | protocols/twitter/Makefile | 1 | ||||
-rw-r--r-- | protocols/twitter/twitter_lib.c | 3 | ||||
-rw-r--r-- | protocols/yahoo/Makefile | 2 | ||||
-rw-r--r-- | protocols/yahoo/libyahoo2.c | 3 | ||||
-rw-r--r-- | unix.c | 9 |
23 files changed, 52 insertions, 35 deletions
@@ -25,7 +25,6 @@ endif # Expansion of variables subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) -CFLAGS += -Wall all: $(OUTFILE) $(MAKE) -C doc @@ -81,7 +81,7 @@ conf_t *conf_load( int argc, char *argv[] ) at a *valid* configuration file. */ } - while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:V" ) ) >= 0 ) + while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hu:V" ) ) >= 0 ) /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ { if( opt == 'i' ) @@ -157,13 +157,6 @@ conf_t *conf_load( int argc, char *argv[] ) BITLBEE_VERSION, BITLBEE_VERSION_CODE ); return NULL; } - else if( opt == 'R' ) - { - /* Backward compatibility; older BitlBees passed this - info using a command-line flag. Allow people to - upgrade from such a version for now. */ - setenv( "_BITLBEE_RESTART_STATE", optarg, 0 ); - } else if( opt == 'u' ) { g_free( conf->user ); @@ -183,7 +183,7 @@ else [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing" fi -echo CFLAGS=$CFLAGS >> Makefile.settings +echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings @@ -200,6 +200,10 @@ else fi echo "CC=$CC" >> Makefile.settings; +if echo $CC | grep -qw gcc; then + # Apparently -Wall is gcc-specific? + echo CFLAGS+=-Wall >> Makefile.settings +fi if [ -z "$LD" ]; then if type ld > /dev/null 2> /dev/null; then diff --git a/irc_commands.c b/irc_commands.c index 1d64fc0d..4b1bc741 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -37,7 +37,8 @@ static void irc_cmd_pass( irc_t *irc, char **cmd ) command last. (Possibly it won't send it at all if it turns out we don't require it, which will break this feature.) Try to identify using the given password. */ - return root_command( irc, send_cmd ); + root_command( irc, send_cmd ); + return; } /* Handling in pre-logged-in state, first see if this server is password-protected: */ diff --git a/lib/Makefile b/lib/Makefile index 8fd9b19e..bebe3ba6 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -14,7 +14,6 @@ endif # [SH] Program variables objects = arc.o base64.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o -CFLAGS += -Wall LFLAGS += -r # [SH] Phony targets @@ -26,7 +26,11 @@ #include <sys/types.h> #include <gmodule.h> +#if(__sun) +#include <inttypes.h> +#else #include <stdint.h> +#endif typedef uint8_t md5_byte_t; typedef struct MD5Context { diff --git a/lib/oauth.c b/lib/oauth.c index c60a5a52..57dd10f8 100644 --- a/lib/oauth.c +++ b/lib/oauth.c @@ -59,7 +59,7 @@ static char *oauth_sign( const char *method, const char *url, else { g_snprintf( (gchar*) key, HMAC_BLOCK_SIZE + 1, "%s&%s", - oi->sp->consumer_secret, oi->token_secret ? : "" ); + oi->sp->consumer_secret, oi->token_secret ? oi->token_secret : "" ); } /* Inner part: H(K XOR 0x36, text) */ @@ -23,7 +23,11 @@ #ifndef _SHA1_H_ #define _SHA1_H_ +#if(__sun) +#include <inttypes.h> +#else #include <stdint.h> +#endif #include <gmodule.h> #ifndef _SHA_enum_ diff --git a/lib/xmltree.c b/lib/xmltree.c index 31f8ee9c..b0a945ce 100644 --- a/lib/xmltree.c +++ b/lib/xmltree.c @@ -214,7 +214,10 @@ void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ) return; if( node == NULL ) - return xt_cleanup( xt, xt->root, depth ); + { + xt_cleanup( xt, xt->root, depth ); + return; + } if( node->flags & XT_SEEN && node == xt->root ) { diff --git a/protocols/Makefile b/protocols/Makefile index d4aa6e14..1c7816bc 100644 --- a/protocols/Makefile +++ b/protocols/Makefile @@ -24,7 +24,6 @@ subdirobjs = $(PROTOOBJS) # Expansion of variables subdirobjs := $(join $(subdirs),$(addprefix /,$(subdirobjs))) -CFLAGS += -Wall LFLAGS += -r # [SH] Phony targets diff --git a/protocols/jabber/Makefile b/protocols/jabber/Makefile index 912ea702..efbd81fb 100644 --- a/protocols/jabber/Makefile +++ b/protocols/jabber/Makefile @@ -14,7 +14,6 @@ endif # [SH] Program variables objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o s5bytestream.o sasl.o si.o -CFLAGS += -Wall LFLAGS += -r # [SH] Phony targets diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 01353f8e..229e35bf 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -380,7 +380,7 @@ static void jabber_get_info( struct im_connection *ic, char *who ) imcb_log( ic, "Buddy %s (%d) information:", bud->full_jid, bud->priority ); if( bud->away_state ) imcb_log( ic, "Away state: %s", bud->away_state->full_name ); - imcb_log( ic, "Status message: %s", bud->away_message ? : "(none)" ); + imcb_log( ic, "Status message: %s", bud->away_message ? bud->away_message : "(none)" ); bud = bud->next; } @@ -394,8 +394,10 @@ static void jabber_set_away( struct im_connection *ic, char *state_txt, char *me /* state_txt == NULL -> Not away. Unknown state -> fall back to the first defined away state. */ - jd->away_state = state_txt ? jabber_away_state_by_name( state_txt ) - ? : jabber_away_state_list : NULL; + if( state_txt == NULL ) + jd->away_state = NULL; + else if( ( jd->away_state = jabber_away_state_by_name( state_txt ) ) == NULL ) + jd->away_state = jabber_away_state_list; g_free( jd->away_message ); jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL; diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index fa915bd8..ce5017fb 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -58,7 +58,8 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) ( inv = xt_find_node( c->children, "invite" ) ) ) { room = from; - from = xt_find_attr( inv, "from" ) ? : from; + if( ( from = xt_find_attr( inv, "from" ) ) == NULL ) + from = room; g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room ); if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 ) @@ -71,7 +72,7 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) if( bud ) { bud->last_msg = time( NULL ); - from = bud->ext_jid ? : bud->bare_jid; + from = bud->ext_jid ? bud->ext_jid : bud->bare_jid; } else *s = 0; /* We need to generate a bare JID now. */ diff --git a/protocols/msn/Makefile b/protocols/msn/Makefile index 6c59aedb..781482f5 100644 --- a/protocols/msn/Makefile +++ b/protocols/msn/Makefile @@ -14,7 +14,6 @@ endif # [SH] Program variables objects = msn.o msn_util.o ns.o passport.o sb.o tables.o -CFLAGS += -Wall LFLAGS += -r # [SH] Phony targets diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index de8271e8..60d58532 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -175,11 +175,10 @@ static void msn_set_away( struct im_connection *ic, char *state, char *message ) char buf[1024]; struct msn_data *md = ic->proto_data; - if( state ) - md->away_state = msn_away_state_by_name( state ) ? : - msn_away_state_list + 1; - else + if( state == NULL ) md->away_state = msn_away_state_list; + else if( ( md->away_state = msn_away_state_by_name( state ) ) == NULL ) + md->away_state = msn_away_state_list + 1; g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, md->away_state->code ); msn_write( ic, buf, strlen( buf ) ); diff --git a/protocols/nogaim.c b/protocols/nogaim.c index c14b222d..7943e026 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -467,7 +467,7 @@ void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *re realname_ = g_strdup_printf( " (%s)", realname ); s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.", - handle, realname_ ?: "" ); + handle, realname_ ? realname_ : "" ); g_free( realname_ ); @@ -490,7 +490,7 @@ static void imcb_ask_add_cb_yes( void *data ) cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL ); - return imcb_ask_add_cb_no( data ); + imcb_ask_add_cb_no( data ); } void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) diff --git a/protocols/nogaim.h b/protocols/nogaim.h index a12ce89b..1665a730 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -38,7 +38,13 @@ #ifndef _NOGAIM_H #define _NOGAIM_H +#if(__sun) +#include <inttypes.h> +#else #include <stdint.h> +#endif + +#include "lib/events.h" #include "bitlbee.h" #include "account.h" diff --git a/protocols/oscar/Makefile b/protocols/oscar/Makefile index 0ec7436b..c1a966ad 100644 --- a/protocols/oscar/Makefile +++ b/protocols/oscar/Makefile @@ -15,7 +15,6 @@ endif # [SH] Program variables objects = admin.o auth.o bos.o buddylist.o chat.o chatnav.o conn.o icq.o im.o info.o misc.o msgcookie.o rxhandlers.o rxqueue.o search.o service.o snac.o ssi.o stats.o tlv.o txqueue.o oscar_util.o oscar.o -CFLAGS += -Wall LFLAGS += -r # [SH] Phony targets diff --git a/protocols/twitter/Makefile b/protocols/twitter/Makefile index 8a4b97f9..3fa9b61e 100644 --- a/protocols/twitter/Makefile +++ b/protocols/twitter/Makefile @@ -14,7 +14,6 @@ endif # [SH] Program variables objects = twitter.o twitter_http.o twitter_lib.o -CFLAGS += -Wall LFLAGS += -r # [SH] Phony targets diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index dfb5597f..5c89e4f6 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -22,7 +22,10 @@ ****************************************************************************/ /* For strptime(): */ +#if(__sun) +#else #define _XOPEN_SOURCE +#endif #include "twitter_http.h" #include "twitter.h" diff --git a/protocols/yahoo/Makefile b/protocols/yahoo/Makefile index 20ecce71..a8021ffb 100644 --- a/protocols/yahoo/Makefile +++ b/protocols/yahoo/Makefile @@ -14,7 +14,7 @@ endif # [SH] Program variables objects = yahoo.o crypt.o libyahoo2.o yahoo_fn.o yahoo_httplib.o yahoo_util.o -CFLAGS += -Wall -DSTDC_HEADERS -DHAVE_STRING_H -DHAVE_STRCHR -DHAVE_MEMCPY -DHAVE_GLIB +CFLAGS += -DSTDC_HEADERS -DHAVE_STRING_H -DHAVE_STRCHR -DHAVE_MEMCPY -DHAVE_GLIB LFLAGS += -r # [SH] Phony targets diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index 9e0d705b..b062e7f9 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -1858,7 +1858,8 @@ static void yahoo_https_auth_token_finish(struct http_request *req) goto fail; } - return yahoo_https_auth_init(had); + yahoo_https_auth_init(had); + return; fail: g_free(had->token); @@ -158,12 +158,15 @@ int main( int argc, char *argv[] ) if( global.restart ) { char *fn = ipc_master_save_state(); + char *env; - chdir( old_cwd ); - - setenv( "_BITLBEE_RESTART_STATE", fn, 1 ); + env = g_strdup_printf( "_BITLBEE_RESTART_STATE=%s", fn ); + putenv( env ); g_free( fn ); + /* Looks like env should *not* be freed here as putenv + doesn't make a copy. Odd. */ + chdir( old_cwd ); close( global.listen_socket ); if( execv( argv[0], argv ) == -1 ) |