:i	static char d_fdopen_sccs_id[] = "%W% %G%";
:1#include "V_s_lc.h"
/*
* This is a wrapper for fdopen(), the routine that takes a  Unix  file  handle
* and builds a FILE* structure for it, so we can use the f*() routines on it.
*/
FILE* d_fdopen(f,m)
	int  f;
	char*m;
{	FILE*v;
	int  g;
	File*fp;
:8	V8s "fdopen(%d,\"%s\")",f,m D;
	errno = 0;
	fp = d_openfile(f);
	v = fdopen(f,m);
:6	V6s "fdopen(%d,\"%s\")=%06X",f,m,v D;
	if (v) {		/* Remember the file's name */
		g = Fileno(v);
:2		if (g != f) {
:2			V2s "+++ fdopen(%d,\"%s\") returned fileno=%d.",f,m,g D;
:2		}
:6		V6s "fdopen(%d,\"%s\")=%06X file %d [Err %d=%s=%s]",f,m,v,g,Errinfo D;
		d_newfile(File_LOCAL,g,(fp?fp->name.v:unknown),0);
:6	} else {
:6		V6s "fdopen(%d,\"%s\")=%06X failed [Err %d=%s=%s]",f,m,v,Errinfo D;
	}
	return v;
}
