masqmail-0.2

diff src/smtpsend.c @ 10:26e34ae9a3e3

changed indention and line wrapping to a more consistent style
author meillo@marmaro.de
date Mon, 27 Oct 2008 16:23:10 +0100
parents 08114f7dcc23
children 9104234a56a5
line diff
     1.1 --- a/src/smtpsend.c	Mon Oct 27 16:21:27 2008 +0100
     1.2 +++ b/src/smtpsend.c	Mon Oct 27 16:23:10 2008 +0100
     1.3 @@ -32,83 +32,83 @@
     1.4  extern char *optarg;
     1.5  extern int optind, opterr, optopt;
     1.6  
     1.7 -void logwrite(int pri, const char *fmt, ...)
     1.8 +void
     1.9 +logwrite(int pri, const char *fmt, ...)
    1.10  {
    1.11 -  va_list args;
    1.12 -  va_start(args, fmt);
    1.13 +	va_list args;
    1.14 +	va_start(args, fmt);
    1.15  
    1.16 -  vfprintf(stdout, fmt, args);
    1.17 +	vfprintf(stdout, fmt, args);
    1.18  
    1.19 -  va_end(args);
    1.20 +	va_end(args);
    1.21  }
    1.22  
    1.23 -void debugf(const char *fmt, ...)
    1.24 +void
    1.25 +debugf(const char *fmt, ...)
    1.26  {
    1.27 -  va_list args;
    1.28 -  va_start(args, fmt);
    1.29 +	va_list args;
    1.30 +	va_start(args, fmt);
    1.31  
    1.32 -  vfprintf(stdout, fmt, args);
    1.33 +	vfprintf(stdout, fmt, args);
    1.34  
    1.35 -  va_end(args);
    1.36 +	va_end(args);
    1.37  }
    1.38  
    1.39  int
    1.40  main(int argc, char *argv[])
    1.41  {
    1.42 -  gchar *helo_name = g_malloc(64);
    1.43 -  gchar *server_name = g_strdup("localhost");
    1.44 -  gint server_port = 25;
    1.45 -  GList *resolve_list = g_list_append(NULL, resolve_byname);
    1.46 +	gchar *helo_name = g_malloc(64);
    1.47 +	gchar *server_name = g_strdup("localhost");
    1.48 +	gint server_port = 25;
    1.49 +	GList *resolve_list = g_list_append(NULL, resolve_byname);
    1.50  
    1.51 -  gethostname(helo_name, 63);
    1.52 +	gethostname(helo_name, 63);
    1.53  
    1.54 -  conf.host_name = g_strdup(helo_name);
    1.55 +	conf.host_name = g_strdup(helo_name);
    1.56  
    1.57 -  while(1){
    1.58 -    int c;
    1.59 -    c = getopt(argc, argv, "d:p:s:H:");
    1.60 -    if(c == -1)
    1.61 -      break;
    1.62 -    switch(c){
    1.63 -    case 'd':
    1.64 -      conf.debug_level = atoi(optarg);
    1.65 -      break;
    1.66 -    case 'p':
    1.67 -      server_port = atoi(optarg);
    1.68 -      break;
    1.69 -    case 's':
    1.70 -      g_free(server_name);
    1.71 -      server_name = g_strdup(optarg);
    1.72 -      break;
    1.73 -    case 'H':
    1.74 -      g_free(helo_name);
    1.75 -      helo_name = g_strdup(optarg);
    1.76 -      break;
    1.77 -    default:
    1.78 -      break;
    1.79 -    }
    1.80 -  }
    1.81 +	while (1) {
    1.82 +		int c;
    1.83 +		c = getopt(argc, argv, "d:p:s:H:");
    1.84 +		if (c == -1)
    1.85 +			break;
    1.86 +		switch (c) {
    1.87 +		case 'd':
    1.88 +			conf.debug_level = atoi(optarg);
    1.89 +			break;
    1.90 +		case 'p':
    1.91 +			server_port = atoi(optarg);
    1.92 +			break;
    1.93 +		case 's':
    1.94 +			g_free(server_name);
    1.95 +			server_name = g_strdup(optarg);
    1.96 +			break;
    1.97 +		case 'H':
    1.98 +			g_free(helo_name);
    1.99 +			helo_name = g_strdup(optarg);
   1.100 +			break;
   1.101 +		default:
   1.102 +			break;
   1.103 +		}
   1.104 +	}
   1.105  
   1.106 -  if (optind < argc){
   1.107 -    gint ret;
   1.108 -    message *msg = create_message();
   1.109 +	if (optind < argc) {
   1.110 +		gint ret;
   1.111 +		message *msg = create_message();
   1.112  
   1.113 -    while (optind < argc){
   1.114 -      msg->rcpt_list =
   1.115 -	g_list_append(msg->rcpt_list,
   1.116 -		      create_address_qualified(argv[optind++], TRUE, conf.host_name));
   1.117 -    }
   1.118 -    
   1.119 -    if((ret = accept_message(stdin, msg, ACC_NODOT_TERM|ACC_HEAD_FROM_RCPT)) == AERR_OK){
   1.120 -      if((ret = smtp_deliver(server_name, server_port, resolve_list, msg, NULL, NULL)) == smtp_ok){
   1.121 -	exit(EXIT_SUCCESS);
   1.122 -      }
   1.123 -      fprintf(stderr, "deliver failed: %d\n", ret);
   1.124 -    }
   1.125 -    fprintf(stderr, "accept failed: %d\n", ret);
   1.126 -    exit(ret);
   1.127 -  }else{
   1.128 -    fprintf(stderr, "no recipients given.\n");
   1.129 -    exit(-1);
   1.130 -  }
   1.131 +		while (optind < argc) {
   1.132 +			msg->rcpt_list = g_list_append(msg->rcpt_list, create_address_qualified(argv[optind++], TRUE, conf.host_name));
   1.133 +		}
   1.134 +
   1.135 +		if ((ret = accept_message(stdin, msg, ACC_NODOT_TERM | ACC_HEAD_FROM_RCPT)) == AERR_OK) {
   1.136 +			if ((ret = smtp_deliver(server_name, server_port, resolve_list, msg, NULL, NULL)) == smtp_ok) {
   1.137 +				exit(EXIT_SUCCESS);
   1.138 +			}
   1.139 +			fprintf(stderr, "deliver failed: %d\n", ret);
   1.140 +		}
   1.141 +		fprintf(stderr, "accept failed: %d\n", ret);
   1.142 +		exit(ret);
   1.143 +	} else {
   1.144 +		fprintf(stderr, "no recipients given.\n");
   1.145 +		exit(-1);
   1.146 +	}
   1.147  }