/[pkg-mixmaster]/trunk/Mix/Src/mix.c
ViewVC logotype

Diff of /trunk/Mix/Src/mix.c

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

revision 10 by rabbi, Wed Oct 31 08:19:51 2001 UTC revision 11 by rabbi, Tue Nov 6 23:41:58 2001 UTC
# Line 6  Line 6 
6     details.     details.
7    
8     Mixmaster initialization, configuration     Mixmaster initialization, configuration
9     $Id: mix.c,v 1.1 2001/10/31 08:19:53 rabbi Exp $ */     $Id: mix.c,v 1.2 2001/11/06 23:41:58 rabbi Exp $ */
10    
11    
12  #include "mix3.h"  #include "mix3.h"
# Line 40  char MIXDIR[PATHMAX]; Line 40  char MIXDIR[PATHMAX];
40  char POOLDIR[PATHMAX];  char POOLDIR[PATHMAX];
41    
42  /* programs */  /* programs */
43    #ifdef WIN32
44    char SENDMAIL[LINELEN] = "outfile";
45    #else
46  char SENDMAIL[LINELEN] = "/usr/lib/sendmail -t";  char SENDMAIL[LINELEN] = "/usr/lib/sendmail -t";
47    #endif
48  char SENDANONMAIL[LINELEN];  char SENDANONMAIL[LINELEN];
49  char NEWS[LINELEN];  char NEWS[LINELEN];
50  char TYPE1[LINELEN];  char TYPE1[LINELEN];
# Line 128  static int mixdir(char *d, int create) Line 132  static int mixdir(char *d, int create)
132    
133    if (d != MIXDIR)    if (d != MIXDIR)
134      strncpy(MIXDIR, d, PATHMAX);      strncpy(MIXDIR, d, PATHMAX);
135    if (MIXDIR[strlen(MIXDIR) - 1] == '/')    if (MIXDIR[strlen(MIXDIR) - 1] == DIRSEP)
136      MIXDIR[strlen(MIXDIR) - 1] = '\0';      MIXDIR[strlen(MIXDIR) - 1] = '\0';
137    err = stat(MIXDIR, &buf);    err = stat(MIXDIR, &buf);
138    if (err == -1) {    if (err == -1) {
# Line 145  static int mixdir(char *d, int create) Line 149  static int mixdir(char *d, int create)
149    } else if (!S_ISDIR(buf.st_mode))    } else if (!S_ISDIR(buf.st_mode))
150      err = -1;      err = -1;
151    if (err == 0)    if (err == 0)
152      strcatn(MIXDIR, "/", PATHMAX);      strcatn(MIXDIR, DIRSEPSTR, PATHMAX);
153    return (err);    return (err);
154  }  }
155    
# Line 370  static int mix_config(void) Line 374  static int mix_config(void)
374  #ifdef POSIX  #ifdef POSIX
375    if (err == -1 && pw != NULL) {    if (err == -1 && pw != NULL) {
376      strcatn(line, pw->pw_dir, PATHMAX);      strcatn(line, pw->pw_dir, PATHMAX);
377      if (line[strlen(line) - 1] != '/')      if (line[strlen(line) - 1] != DIRSEP)
378        strcatn(line, "/", PATHMAX);        strcatn(line, DIRSEPSTR, PATHMAX);
379      strcatn(line, "Mix", PATHMAX);      strcatn(line, "Mix", PATHMAX);
380      err = mixdir(line, 1);      err = mixdir(line, 1);
381    }    }
# Line 384  static int mix_config(void) Line 388  static int mix_config(void)
388    
389    strncpy(POOLDIR, MIXDIR, PATHMAX - 32);    strncpy(POOLDIR, MIXDIR, PATHMAX - 32);
390    strcatn(POOLDIR, POOL, PATHMAX);    strcatn(POOLDIR, POOL, PATHMAX);
391    if (POOLDIR[strlen(POOLDIR) - 1] == '/')    if (POOLDIR[strlen(POOLDIR) - 1] == DIRSEP)
392      POOLDIR[strlen(POOLDIR) - 1] = '\0';      POOLDIR[strlen(POOLDIR) - 1] = '\0';
393    if (stat(POOLDIR, &buf) != 0)    if (stat(POOLDIR, &buf) != 0)
394      if      if
# Line 624  int mix_daily(void) Line 628  int mix_daily(void)
628  int mix_daemon(void)  int mix_daemon(void)
629  {  {
630    long t;    long t;
631    #ifdef WIN32SERVICE
632      long t1;
633      HANDLE hMustTerminate = OpenEvent(EVENT_ALL_ACCESS, FALSE, "mixmaster-stop");
634    #endif
635    t = SENDPOOLTIME;    t = SENDPOOLTIME;
636  #ifdef USE_SOCK  #ifdef USE_SOCK
637    if (POP3TIME < t)    if (POP3TIME < t)
# Line 633  int mix_daemon(void) Line 641  int mix_daemon(void)
641    for(;;) {    for(;;) {
642      mix_regular(0);      mix_regular(0);
643  #ifdef WIN32  #ifdef WIN32
644    #ifdef WIN32SERVICE
645        t1 = t*2;
646        while (t1) {
647          if (hMustTerminate)
648            if (WaitForSingleObject(hMustTerminate, 500) == WAIT_OBJECT_0) {
649              CloseHandle(hMustTerminate);
650              return 0;
651            }
652          t1--;
653        }
654    #else
655      Sleep(t * 1000);      Sleep(t * 1000);
656    #endif
657  #else  #else
658      sleep(t);      sleep(t);
659  #endif  #endif

Legend:
Removed from v.10  
changed lines
  Added in v.11

  ViewVC Help
Powered by ViewVC 1.1.5