Back to index

courier  0.68.2
combatchsize.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 1998 - 1999 Double Precision, Inc.
00003 ** See COPYING for distribution information.
00004 */
00005 
00006 #include      "courier.h"
00007 #include      "maxlongsize.h"
00008 #include      <stdio.h>
00009 #include      <stdlib.h>
00010 
00011 static char batchsize_buf[MAXLONGSIZE]="";
00012 
00013 const char *config_batchsize()
00014 {
00015 char   *batchfilename;
00016 char   *batchsizestr;
00017 unsigned batchsize;
00018 
00019        if (batchsize_buf[0] == '\0')
00020        {
00021               batchfilename=config_localfilename("batchsize");
00022               batchsizestr=config_read1l(batchfilename);
00023 
00024               free(batchfilename);
00025 
00026               batchsize=100;
00027               if (batchsizestr)
00028               {
00029                      batchsize=atoi(batchsizestr);
00030                      free(batchsizestr);
00031                      if (batchsize == 0)  batchsize=100;
00032                                           /* stupid user */
00033               }
00034               if (batchsize <= 0)  batchsize=5;
00035               sprintf(batchsize_buf, "%u", batchsize);
00036        }
00037        return (batchsize_buf);
00038 }