if (j <= 0) return(0);
if (j <= 0) { *buf='\0'; return 0; }
static int mem_gets(BIO *bp, char *buf, int size)	{	int i,j;	int ret= -1;	char *p;	BUF_MEM *bm=(BUF_MEM *)bp->ptr;	BIO_clear_retry_flags(bp);	j=bm->length;	if (j <= 0) return(0);	p=bm->data;	for (i=0; i<j; i++)		{		if (p[i] == '\n') break;		}	if (i == j)		{		BIO_set_retry_read(bp);		/* return(-1);  change the semantics 0.6.6a */ 		}	else		i++;	/* i is the max to copy */	if ((size-1) < i) i=size-1;	i=mem_read(bp,buf,i);	if (i > 0) buf[i]='\0';	ret=i;	return(ret);	}