Back to index

courier  0.68.2
Defines | Functions
maildirgetquota.h File Reference
#include <sys/types.h>
#include <stdio.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define QUOTABUFSIZE   256

Functions

int maildir_getquota (const char *, char[QUOTABUFSIZE])

Define Documentation

#define QUOTABUFSIZE   256

Definition at line 21 of file maildirgetquota.h.


Function Documentation

int maildir_getquota ( const char *  ,
char  [QUOTABUFSIZE] 
)

Definition at line 17 of file maildirgetquota.c.

{
char   *p;
struct stat   stat_buf;
int    n;
int    l;

       p=(char *)malloc(strlen(dir)+sizeof("/maildirfolder"));
       if (!p)       return (-1);

       strcat(strcpy(p, dir), "/maildirfolder");
       if (stat(p, &stat_buf) == 0)
       {
              strcat(strcpy(p, dir), "/..");
              n=maildir_getquota(p, buf);
              free(p);
              return (n);
       }

       strcat(strcpy(p, dir), "/maildirsize");
       n=maildir_safeopen(p, O_RDONLY, 0);
       free(p);
       if (n < 0)    return (n);
       if ((l=read(n, buf, QUOTABUFSIZE-1)) < 0)
       {
              close(n);
              return (-1);
       }
       close(n);
       for (n=0; n<l; n++)
              if (buf[n] == '\n')  break;
       buf[n]=0;
       return (0);
}

Here is the call graph for this function:

Here is the caller graph for this function: