b->shutdown=(int)num;
b->shutdown=(int)num&BIO_CLOSE;
static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, char *ptr)	{	long ret=1;	FILE *fp=(FILE *)b->ptr;	FILE **fpp;	char p[4];	switch (cmd)		{	case BIO_C_FILE_SEEK:	case BIO_CTRL_RESET:		ret=(long)fseek(fp,num,0);		break;	case BIO_CTRL_EOF:		ret=(long)feof(fp);		break;	case BIO_C_FILE_TELL:	case BIO_CTRL_INFO:		ret=ftell(fp);		break;	case BIO_C_SET_FILE_PTR:		file_free(b);		b->shutdown=(int)num;		b->ptr=(char *)ptr;		b->init=1;#if defined(MSDOS) || defined(WINDOWS)		/* Set correct text/binary mode */		if (num & BIO_FP_TEXT)			_setmode(fileno((FILE *)ptr),_O_TEXT);		else			_setmode(fileno((FILE *)ptr),_O_BINARY);#endif		break;	case BIO_C_SET_FILENAME:		file_free(b);		b->shutdown=(int)num&BIO_CLOSE;		if (num & BIO_FP_APPEND)			{			if (num & BIO_FP_READ)				strcpy(p,"a+");			else	strcpy(p,"a");			}		else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE))			strcpy(p,"r+");		else if (num & BIO_FP_WRITE)			strcpy(p,"w");		else if (num & BIO_FP_READ)			strcpy(p,"r");		else			{			BIOerr(BIO_F_FILE_CTRL,BIO_R_BAD_FOPEN_MODE);			ret=0;			break;			}#if defined(MSDOS) || defined(WINDOWS)		if (!(num & BIO_FP_TEXT))			strcat(p,"b");		else			strcat(p,"t");#endif		fp=fopen(ptr,p);		if (fp == NULL)			{			SYSerr(SYS_F_FOPEN,get_last_sys_error());			ERR_add_error_data(5,"fopen('",ptr,"','",p,"')");			BIOerr(BIO_F_FILE_CTRL,ERR_R_SYS_LIB);			ret=0;			break;			}		b->ptr=(char *)fp;		b->init=1;		break;	case BIO_C_GET_FILE_PTR:		/* the ptr parameter is actually a FILE ** in this case. */		if (ptr != NULL)			{			fpp=(FILE **)ptr;			*fpp=(FILE *)b->ptr;			}		break;	case BIO_CTRL_GET_CLOSE:		ret=(long)b->shutdown;		break;	case BIO_CTRL_SET_CLOSE:		b->shutdown=(int)num;		break;	case BIO_CTRL_FLUSH:		fflush((FILE *)b->ptr);		break;	case BIO_CTRL_DUP:		ret=1;		break;	case BIO_CTRL_WPENDING:	case BIO_CTRL_PENDING:	case BIO_CTRL_PUSH:	case BIO_CTRL_POP:	default:		ret=0;		break;		}	return(ret);	}