@matheusbsbs / matheus-bagliano / commits / 51dcaa9686
Fork 0

Rename imap-send's internal info/warn functions.

Because I am about to introduce a global warn() function (much like the global error function) this global declaration would conflict with the one supplied by imap-send. Further since imap-send's warn function output depends on its Quiet setting we cannot simply remove its internal definition and use the forthcoming global one. So refactor warn() -> imap_warn() and info() -> imap_info() (the latter was done just to be consistent in naming). Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn O. Pearce committed Dec 21, 2006 at 19:48 UTC 51dcaa9686d9ff591e9d051e6090d8529bc263a5
1 file changed +12 -12
imap-send.c
+12 -12
@@ -96,8 +96,8 @@ typedef struct {
96
97 static int Verbose, Quiet;
98
99 -static void info( const char *, ... );
100 -static void warn( const char *, ... );
99 +static void imap_info( const char *, ... );
100 +static void imap_warn( const char *, ... );
101
102 static char *next_arg( char ** );
103
@@ -297,7 +297,7 @@ buffer_gets( buffer_t * b, char **s )
297 }
298
299 static void
300 -info( const char *msg, ... )
300 +imap_info( const char *msg, ... )
301 {
302 va_list va;
303
@@ -310,7 +310,7 @@ info( const char *msg, ... )
310 }
311
312 static void
313 -warn( const char *msg, ... )
313 +imap_warn( const char *msg, ... )
314 {
315 va_list va;
316
@@ -903,7 +903,7 @@ imap_open_store( imap_server_conf_t *srvc )
903 /* open connection to IMAP server */
904
905 if (srvc->tunnel) {
906 - info( "Starting tunnel '%s'... ", srvc->tunnel );
906 + imap_info( "Starting tunnel '%s'... ", srvc->tunnel );
907
908 if (socketpair( PF_UNIX, SOCK_STREAM, 0, a )) {
909 perror( "socketpair" );
@@ -926,31 +926,31 @@ imap_open_store( imap_server_conf_t *srvc )
926
927 imap->buf.sock.fd = a[1];
928
929 - info( "ok\n" );
929 + imap_info( "ok\n" );
930 } else {
931 memset( &addr, 0, sizeof(addr) );
932 addr.sin_port = htons( srvc->port );
933 addr.sin_family = AF_INET;
934
935 - info( "Resolving %s... ", srvc->host );
935 + imap_info( "Resolving %s... ", srvc->host );
936 he = gethostbyname( srvc->host );
937 if (!he) {
938 perror( "gethostbyname" );
939 goto bail;
940 }
941 - info( "ok\n" );
941 + imap_info( "ok\n" );
942
943 addr.sin_addr.s_addr = *((int *) he->h_addr_list[0]);
944
945 s = socket( PF_INET, SOCK_STREAM, 0 );
946
947 - info( "Connecting to %s:%hu... ", inet_ntoa( addr.sin_addr ), ntohs( addr.sin_port ) );
947 + imap_info( "Connecting to %s:%hu... ", inet_ntoa( addr.sin_addr ), ntohs( addr.sin_port ) );
948 if (connect( s, (struct sockaddr *)&addr, sizeof(addr) )) {
949 close( s );
950 perror( "connect" );
951 goto bail;
952 }
953 - info( "ok\n" );
953 + imap_info( "ok\n" );
954
955 imap->buf.sock.fd = s;
956
@@ -979,7 +979,7 @@ imap_open_store( imap_server_conf_t *srvc )
979
980 if (!preauth) {
981
982 - info ("Logging in...\n");
982 + imap_info ("Logging in...\n");
983 if (!srvc->user) {
984 fprintf( stderr, "Skipping server %s, no user\n", srvc->host );
985 goto bail;
@@ -1006,7 +1006,7 @@ imap_open_store( imap_server_conf_t *srvc )
1006 fprintf( stderr, "Skipping account %s@%s, server forbids LOGIN\n", srvc->user, srvc->host );
1007 goto bail;
1008 }
1009 - warn( "*** IMAP Warning *** Password is being sent in the clear\n" );
1009 + imap_warn( "*** IMAP Warning *** Password is being sent in the clear\n" );
1010 if (imap_exec( ctx, NULL, "LOGIN \"%s\" \"%s\"", srvc->user, srvc->pass ) != RESP_OK) {
1011 fprintf( stderr, "IMAP error: LOGIN failed\n" );
1012 goto bail;