Changeset 1198 for trunk/src/kash/mail.c
- Timestamp:
- Oct 6, 2007, 11:19:19 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/mail.c
r809 r1198 58 58 #include "error.h" 59 59 #include "mail.h" 60 #include "shinstance.h" 60 61 61 62 62 #define MAXMBOXES 10 63 /*#define MAXMBOXES 10*/ 63 64 64 65 65 STATIC int nmboxes; /* number of mailboxes */66 STATIC time_t mailtime[MAXMBOXES];/* times of mailboxes */66 /*STATIC int nmboxes; /* number of mailboxes */ 67 /*STATIC time_t mailtime[MAXMBOXES];*/ /* times of mailboxes */ 67 68 68 69 … … 75 76 76 77 void 77 chkmail( int silent)78 chkmail(shinstance *psh, int silent) 78 79 { 79 80 int i; … … 85 86 86 87 if (silent) 87 nmboxes = 10;88 if ( nmboxes == 0)88 psh->nmboxes = 10; 89 if (psh->nmboxes == 0) 89 90 return; 90 setstackmark( &smark);91 mpath = mpathset( ) ? mpathval() : mailval();92 for (i = 0 ; i < nmboxes ; i++) {93 p = padvance( &mpath, nullstr);91 setstackmark(psh, &smark); 92 mpath = mpathset(psh) ? mpathval(psh) : mailval(psh); 93 for (i = 0 ; i < psh->nmboxes ; i++) { 94 p = padvance(psh, &mpath, nullstr); 94 95 if (p == NULL) 95 96 break; … … 101 102 q[-1] = '\0'; /* delete trailing '/' */ 102 103 #ifdef notdef /* this is what the System V shell claims to do (it lies) */ 103 if (s tat(p, &statb) < 0)104 if (shfile_stat(&psh->fdtab, p, &statb) < 0) 104 105 statb.st_mtime = 0; 105 if (statb.st_mtime > mailtime[i] && ! silent) {106 out2str(p athopt ?pathopt : "you have mail");107 out2c( '\n');106 if (statb.st_mtime > psh->mailtime[i] && ! silent) { 107 out2str(psh, psh->pathopt ? psh->pathopt : "you have mail"); 108 out2c(psh, '\n'); 108 109 } 109 mailtime[i] = statb.st_mtime;110 psh->mailtime[i] = statb.st_mtime; 110 111 #else /* this is what it should do */ 111 if (s tat(p, &statb) < 0)112 if (shfile_stat(&psh->fdtab, p, &statb) < 0) 112 113 statb.st_size = 0; 113 if (statb.st_size > mailtime[i] && ! silent) {114 out2str(p athopt ?pathopt : "you have mail");115 out2c( '\n');114 if (statb.st_size > psh->mailtime[i] && ! silent) { 115 out2str(psh, psh->pathopt ? psh->pathopt : "you have mail"); 116 out2c(psh, '\n'); 116 117 } 117 mailtime[i] = statb.st_size;118 psh->mailtime[i] = statb.st_size; 118 119 #endif 119 120 } 120 nmboxes = i;121 popstackmark( &smark);121 psh->nmboxes = i; 122 popstackmark(psh, &smark); 122 123 }
Note:
See TracChangeset
for help on using the changeset viewer.