/[mailutils]/mailutils/comsat/comsat.c
ViewVC logotype

Diff of /mailutils/comsat/comsat.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by sroberts, Sun Dec 16 05:34:16 2001 UTC revision 1.13 by gray, Mon Jan 21 06:24:10 2002 UTC
# Line 25  Line 25 
25  #ifndef PATH_TTY_PFX  #ifndef PATH_TTY_PFX
26  # define PATH_TTY_PFX PATH_DEV  # define PATH_TTY_PFX PATH_DEV
27  #endif  #endif
 #ifndef _PATH_MAILDIR  
 # define _PATH_MAILDIR "/var/spool/mail"  
 #endif  
28    
29  #ifdef HAVE_UTMP_H  #ifdef HAVE_UTMP_H
30  # include <utmp.h>  # include <utmp.h>
# Line 50  typedef struct utmp UTMP; Line 47  typedef struct utmp UTMP;
47    
48  #define MAX_TTY_SIZE (sizeof (PATH_TTY_PFX) + sizeof (((UTMP*)0)->ut_line))  #define MAX_TTY_SIZE (sizeof (PATH_TTY_PFX) + sizeof (((UTMP*)0)->ut_line))
49    
50  static char short_options[] = "c:dhip:t:v";  static char short_options[] = "c:dhim:p:t:v";
51  static struct option long_options[] =  static struct option long_options[] =
52  {  {
53    {"config", required_argument, 0, 'c'},    {"config", required_argument, 0, 'c'},
54    {"daemon", no_argument, 0, 'd'},    {"daemon", no_argument, 0, 'd'},
55    {"help", no_argument, 0, 'h'},    {"help", no_argument, 0, 'h'},
56    {"inetd", no_argument, 0, 'i'},    {"inetd", no_argument, 0, 'i'},
57      {"maildir", required_argument, 0, 'm'},
58    {"port", required_argument, 0, 'p'},    {"port", required_argument, 0, 'p'},
59    {"timeout", required_argument, 0, 't'},    {"timeout", required_argument, 0, 't'},
60    {"version", no_argument, 0, 'v'},    {"version", no_argument, 0, 'v'},
# Line 80  int timeout = 0; Line 78  int timeout = 0;
78  int maxlines = 5;  int maxlines = 5;
79  char hostname[MAXHOSTNAMELEN];  char hostname[MAXHOSTNAMELEN];
80  const char *username;  const char *username;
81    const char *maildir = MU_PATH_MAILDIR;
82    
83  static void comsat_init (void);  static void comsat_init (void);
84  static void comsat_daemon_init (void);  static void comsat_daemon_init (void);
# Line 121  main(int argc, char **argv) Line 120  main(int argc, char **argv)
120            mode = MODE_INETD;            mode = MODE_INETD;
121            break;            break;
122    
123            case 'm':
124              maildir = optarg;
125              break;
126              
127          case 'p':          case 'p':
128            port = strtoul (optarg, NULL, 10);            port = strtoul (optarg, NULL, 10);
129            break;            break;
# Line 139  main(int argc, char **argv) Line 142  main(int argc, char **argv)
142          }          }
143      }      }
144    
145      maildir = mu_normalize_maildir (maildir);
146      if (!maildir)
147        {
148          mu_error ("Badly formed maildir: %s", maildir);
149          exit (1);
150        }
151    
152    if (timeout > 0 && mode == MODE_DAEMON)    if (timeout > 0 && mode == MODE_DAEMON)
153      {      {
154        fprintf (stderr, "--timeout and --daemon are incompatible\n");        fprintf (stderr, "--timeout and --daemon are incompatible\n");
# Line 612  mailbox_path (const char *user) Line 622  mailbox_path (const char *user)
622    
623    if (!mu_virtual_domain)    if (!mu_virtual_domain)
624      {      {
625        mailbox_name = calloc (strlen (_PATH_MAILDIR) + 1        mailbox_name = calloc (strlen (maildir) + 1
626                               + strlen (pw->pw_name) + 1, 1);                               + strlen (pw->pw_name) + 1, 1);
627        sprintf (mailbox_name, "%s/%s", _PATH_MAILDIR, pw->pw_name);        sprintf (mailbox_name, "%s%s", maildir, pw->pw_name);
628      }      }
629    else    else
630      {      {

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26