#include "Bdef.h"

char *getbuff(length)
int  length;
{
   static char *buff=NULL;
   static int buflen=0;

   if (length > buflen)
   {
      if (buff != NULL) free(buff);
      buff = (char *) malloc(length);
      if (buff == NULL)
         BlacsErr(-1, __LINE__, __FILE__, "Unable to malloc memory");
      buflen = length;
   }
   else if (length < 0)
   {
      if (buff != NULL) free(buff);
      buff = NULL;
      buflen = 0;
   }
   return(buff);
}
