dummydos.c | dummydos.c | |||
---|---|---|---|---|
/* ======================================================================== | ||||
* Copyright 1988-2006 University of Washington | ||||
* | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | ||||
* You may obtain a copy of the License at | ||||
* | ||||
* http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | ||||
* | ||||
* ======================================================================== | ||||
*/ | ||||
/* | /* | |||
* Program: Dummy routines for DOS | * Program: Dummy routines for DOS | |||
* | * | |||
* Author: Mark Crispin | * Author: Mark Crispin | |||
* Networks and Distributed Computing | * Networks and Distributed Computing | |||
* Computing & Communications | * Computing & Communications | |||
* University of Washington | * University of Washington | |||
* Administration Building, AG-44 | * Administration Building, AG-44 | |||
* Seattle, WA 98195 | * Seattle, WA 98195 | |||
* Internet: MRC@CAC.Washington.EDU | * Internet: MRC@CAC.Washington.EDU | |||
* | * | |||
* Date: 24 May 1993 | * Date: 24 May 1993 | |||
* Last Edited: 2 February 2004 | * Last Edited: 30 August 2006 | |||
* | ||||
* The IMAP toolkit provided in this Distribution is | ||||
* Copyright 1988-2004 University of Washington. | ||||
* The full text of our legal notices is contained in the file called | ||||
* CPYRIGHT, included with this Distribution. | ||||
*/ | */ | |||
#include <ctype.h> | #include <ctype.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#include "mail.h" | #include "mail.h" | |||
#include "osdep.h" | #include "osdep.h" | |||
#include <sys\stat.h> | #include <sys\stat.h> | |||
#include <dos.h> | #include <dos.h> | |||
#include "dummy.h" | #include "dummy.h" | |||
skipping to change at line 43 | skipping to change at line 51 | |||
void *dummy_parameters (long function,void *value); | void *dummy_parameters (long function,void *value); | |||
void dummy_list_work (MAILSTREAM *stream,char *dir,char *pat,char *contents , | void dummy_list_work (MAILSTREAM *stream,char *dir,char *pat,char *contents , | |||
long level); | long level); | |||
long dummy_listed (MAILSTREAM *stream,char delimiter,char *name, | long dummy_listed (MAILSTREAM *stream,char delimiter,char *name, | |||
long attributes,char *contents); | long attributes,char *contents); | |||
long dummy_subscribe (MAILSTREAM *stream,char *mailbox); | long dummy_subscribe (MAILSTREAM *stream,char *mailbox); | |||
MAILSTREAM *dummy_open (MAILSTREAM *stream); | MAILSTREAM *dummy_open (MAILSTREAM *stream); | |||
void dummy_close (MAILSTREAM *stream,long options); | void dummy_close (MAILSTREAM *stream,long options); | |||
long dummy_ping (MAILSTREAM *stream); | long dummy_ping (MAILSTREAM *stream); | |||
void dummy_check (MAILSTREAM *stream); | void dummy_check (MAILSTREAM *stream); | |||
void dummy_expunge (MAILSTREAM *stream); | long dummy_expunge (MAILSTREAM *stream,char *sequence,long options); | |||
long dummy_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long optio ns); | long dummy_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long optio ns); | |||
long dummy_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data) ; | long dummy_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data) ; | |||
long dummy_badname (char *tmp,char *s); | long dummy_badname (char *tmp,char *s); | |||
/* Dummy routines */ | /* Dummy routines */ | |||
/* Driver dispatch used by MAIL */ | /* Driver dispatch used by MAIL */ | |||
DRIVER dummydriver = { | DRIVER dummydriver = { | |||
"dummy", /* driver name */ | "dummy", /* driver name */ | |||
DR_LOCAL|DR_MAIL, /* driver flags */ | DR_LOCAL|DR_MAIL, /* driver flags */ | |||
skipping to change at line 250 | skipping to change at line 258 | |||
if (base) sprintf (tmpx,"%s\\",base); | if (base) sprintf (tmpx,"%s\\",base); | |||
else tmpx[0] = '\0'; | else tmpx[0] = '\0'; | |||
if (dir) strcat (tmpx,dir); | if (dir) strcat (tmpx,dir); | |||
/* punt if bogus name */ | /* punt if bogus name */ | |||
if (!mailboxfile (tmp,tmpx)) return; | if (!mailboxfile (tmp,tmpx)) return; | |||
/* make directory wildcard */ | /* make directory wildcard */ | |||
strcat (tmp,(tmp[strlen (tmp) -1] == '\\') ? "*." : "\\*."); | strcat (tmp,(tmp[strlen (tmp) -1] == '\\') ? "*." : "\\*."); | |||
strcat (tmp,file_extension ? file_extension : "*"); | strcat (tmp,file_extension ? file_extension : "*"); | |||
/* do nothing if can't open directory */ | /* do nothing if can't open directory */ | |||
if (!_dos_findfirst (tmp,_A_NORMAL|_A_SUBDIR,&f)) { | if (!_dos_findfirst (tmp,_A_NORMAL|_A_SUBDIR,&f)) { | |||
/* list it if not at top-level */ | /* list it if at top-level */ | |||
if (!level && dir && pmatch_full (dir,pat,'\\')) | if (!level && dir && pmatch_full (dir,pat,'\\')) | |||
dummy_listed (stream,'\\',dir,LATT_NOSELECT,contents); | dummy_listed (stream,'\\',dir,LATT_NOSELECT,contents); | |||
/* scan directory */ | /* scan directory */ | |||
if (tmpx[strlen (tmpx) - 1] == '\\') do if (*f.name != '.') { | if (tmpx[strlen (tmpx) - 1] == '\\') do if (*f.name != '.') { | |||
if (base) sprintf (tmpx,"%s\\",base); | if (base) sprintf (tmpx,"%s\\",base); | |||
else tmpx[0] = '\0'; | else tmpx[0] = '\0'; | |||
if (dir) sprintf (tmpx + strlen (tmpx),"%s%s",dir,f.name); | if (dir) sprintf (tmpx + strlen (tmpx),"%s%s",dir,f.name); | |||
else strcat (tmpx,f.name); | else strcat (tmpx,f.name); | |||
if (mailboxfile (tmp,tmpx) && !stat (tmp,&sbuf)) { | if (mailboxfile (tmp,tmpx) && !stat (tmp,&sbuf)) { | |||
/* suppress extension */ | /* suppress extension */ | |||
skipping to change at line 533 | skipping to change at line 541 | |||
* No-op for readonly files, since read/writer can expunge it from under us ! | * No-op for readonly files, since read/writer can expunge it from under us ! | |||
*/ | */ | |||
void dummy_check (MAILSTREAM *stream) | void dummy_check (MAILSTREAM *stream) | |||
{ | { | |||
dummy_ping (stream); /* invoke ping */ | dummy_ping (stream); /* invoke ping */ | |||
} | } | |||
/* Dummy expunge mailbox | /* Dummy expunge mailbox | |||
* Accepts: MAIL stream | * Accepts: MAIL stream | |||
* sequence to expunge if non-NIL | ||||
* expunge options | ||||
* Returns: T, always | ||||
*/ | */ | |||
void dummy_expunge (MAILSTREAM *stream) | long dummy_expunge (MAILSTREAM *stream,char *sequence,long options) | |||
{ | { | |||
/* return silently */ | return LONGT; | |||
} | } | |||
/* Dummy copy message(s) | /* Dummy copy message(s) | |||
* Accepts: MAIL stream | * Accepts: MAIL stream | |||
* sequence | * sequence | |||
* destination mailbox | * destination mailbox | |||
* options | * options | |||
* Returns: T if copy successful, else NIL | * Returns: T if copy successful, else NIL | |||
*/ | */ | |||
long dummy_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long optio ns) | long dummy_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long optio ns) | |||
skipping to change at line 610 | skipping to change at line 621 | |||
/* Dummy canonicalize name | /* Dummy canonicalize name | |||
* Accepts: buffer to write name | * Accepts: buffer to write name | |||
* reference | * reference | |||
* pattern | * pattern | |||
* Returns: T if success, NIL if failure | * Returns: T if success, NIL if failure | |||
*/ | */ | |||
long dummy_canonicalize (char *tmp,char *ref,char *pat) | long dummy_canonicalize (char *tmp,char *ref,char *pat) | |||
{ | { | |||
char dev[4]; | unsigned long i; | |||
char *s,dev[4]; | ||||
/* initially no device */ | /* initially no device */ | |||
dev[0] = dev[1] = dev[2] = dev[3] = '\0'; | dev[0] = dev[1] = dev[2] = dev[3] = '\0'; | |||
if (ref) switch (*ref) { /* preliminary reference check */ | if (ref) switch (*ref) { /* preliminary reference check */ | |||
case '{': /* remote names not allowed */ | case '{': /* remote names not allowed */ | |||
return NIL; /* disallowed */ | return NIL; /* disallowed */ | |||
case '\0': /* empty reference string */ | case '\0': /* empty reference string */ | |||
break; | break; | |||
default: /* all other names */ | default: /* all other names */ | |||
if (ref[1] == ':') { /* start with device name? */ | if (ref[1] == ':') { /* start with device name? */ | |||
dev[0] = *ref++; dev[1] = *ref++; | dev[0] = *ref++; dev[1] = *ref++; | |||
skipping to change at line 644 | skipping to change at line 656 | |||
return NIL; | return NIL; | |||
case '\\': /* rooted name */ | case '\\': /* rooted name */ | |||
ref = NIL; /* ignore reference */ | ref = NIL; /* ignore reference */ | |||
break; | break; | |||
} | } | |||
/* make sure device names are rooted */ | /* make sure device names are rooted */ | |||
if (dev[0] && (*(ref ? ref : pat) != '\\')) dev[2] = '\\'; | if (dev[0] && (*(ref ? ref : pat) != '\\')) dev[2] = '\\'; | |||
/* build name */ | /* build name */ | |||
sprintf (tmp,"%s%s%s",dev,ref ? ref : "",pat); | sprintf (tmp,"%s%s%s",dev,ref ? ref : "",pat); | |||
ucase (tmp); /* force upper case */ | ucase (tmp); /* force upper case */ | |||
/* count wildcards */ | ||||
for (i = 0, s = tmp; *s; *s++) if ((*s == '*') || (*s == '%')) ++i; | ||||
if (i > MAXWILDCARDS) { /* ridiculous wildcarding? */ | ||||
MM_LOG ("Excessive wildcards in LIST/LSUB",ERROR); | ||||
return NIL; | ||||
} | ||||
return T; | return T; | |||
} | } | |||
End of changes. 9 change blocks. | ||||
11 lines changed or deleted | 29 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |