Back to index

courier  0.68.2
maildirdelfolder.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 2000-2003 Double Precision, Inc.
00003 ** See COPYING for distribution information.
00004 */
00005 
00006 #if HAVE_CONFIG_H
00007 #include "config.h"
00008 #endif
00009 
00010 #include <sys/types.h>
00011 #if HAVE_DIRENT_H
00012 #include <dirent.h>
00013 #define NAMLEN(dirent) strlen((dirent)->d_name)
00014 #else
00015 #define dirent direct
00016 #define NAMLEN(dirent) (dirent)->d_namlen
00017 #if HAVE_SYS_NDIR_H
00018 #include <sys/ndir.h>
00019 #endif
00020 #if HAVE_SYS_DIR_H
00021 #include <sys/dir.h>
00022 #endif
00023 #if HAVE_NDIR_H
00024 #include <ndir.h>
00025 #endif
00026 #endif
00027 #include      <sys/types.h>
00028 #include      <sys/stat.h>
00029 #include      <string.h>
00030 #include      <stdlib.h>
00031 #include      <time.h>
00032 #if    HAVE_UNISTD_H
00033 #include      <unistd.h>
00034 #endif
00035 #include      <stdio.h>
00036 #include      <ctype.h>
00037 #include      <errno.h>
00038 
00039 #include      "maildirmisc.h"
00040 
00041 int maildir_deletefolder(const char *maildir, const char *folder)
00042 {
00043 char   *s;
00044 int    rc;
00045 
00046        if (*folder == '.')
00047        {
00048               errno=EINVAL;
00049               return (-1);
00050        }
00051 
00052        s=malloc(strlen(maildir)+strlen(folder)+3);
00053        if (!s)       return (-1);
00054        strcat(strcat(strcpy(s, maildir), "/."), folder);
00055 
00056        rc=maildir_del(s);
00057        free(s);
00058        return (rc);
00059 }