コード例 #1
0
ファイル: owhttpd_dir.c プロジェクト: GrandHsu/iicontrollibs
static void ShowDirText(FILE * out, struct parsedname * pn)
{
	HTTPstart(out, "200 OK", ct_text);

	FS_dir(ShowDirTextCallback, out, pn);
	return;
}
コード例 #2
0
ファイル: owhttpd_dir.c プロジェクト: bootc/owfs-cvsimport
static void ShowDirJson(FILE * out, struct parsedname * pn)
{
	HTTPstart(out, "200 OK", ct_text);

	fprintf(out, "{" );
	FS_dir(ShowDirJsonCallback, out, pn);
	fprintf(out, "}" );
	return;
}
コード例 #3
0
ファイル: owhttpd_favicon.c プロジェクト: M-o-a-T/owfs
void Favicon(struct OutputControl * oc)
{
	FILE * out = oc->out ;
	int i;
	
	HTTPstart(oc, "200 OK", ct_icon);
	for (i = 0; i < 894; ++i) {
		fprintf(out, "%c", favicon[i]);
	}
	HTTPfoot(oc);
}
コード例 #4
0
ファイル: owhttpd_dir.c プロジェクト: GrandHsu/iicontrollibs
static void ShowDirJson(FILE * out, struct parsedname * pn)
{
	struct JsonCBstruct jcbs ;
	
	JSON_dir_init( &jcbs, out ) ;

	HTTPstart(out, "200 OK", ct_json);

	fprintf(out, "{" );
	FS_dir(ShowDirJsonCallback, &jcbs, pn);
	
	JSON_dir_finish( &jcbs ) ;
	fprintf(out, "}" );
	return;
}
コード例 #5
0
ファイル: owhttpd_dir.c プロジェクト: GrandHsu/iicontrollibs
	/* Misnamed. Actually all directory */
void ShowDir(FILE * out, struct parsedname * pn)
{
	int b = Backup(pn->path); // length of string to get to higher level
	if (pn->state & ePS_text) {
		ShowDirText(out, pn);
		return;
	} else if (pn->state & ePS_json) {
		ShowDirJson(out, pn);
		return;
	}

	HTTPstart(out, "200 OK", ct_html);
	HTTPtitle(out, "Directory");

	if (NotRealDir(pn)) {
		/* return whole path since tree structure could be much deeper now */
		/* first / is stripped off */
		HTTPheader(out, &pn->path[1]);
	} else if (pn->state) {
		/* return whole path since tree structure could be much deeper now */
		/* first / is stripped off */
		HTTPheader(out, &pn->path[1]);
	} else {
		HTTPheader(out, "directory");
	}


	fprintf(out, "<TABLE BGCOLOR=\"#DDDDDD\" BORDER=1>");

	if (b != 1) {
		char * escaped_path = httpescape( pn->path ) ;
		fprintf(out, "<TR><TD><A HREF='%.*s'><CODE><B><BIG>up</BIG></B></CODE></A></TD><TD>higher level</TD><TD>directory</TD></TR>", b, escaped_path==NULL ? pn->path : escaped_path );
		if ( escaped_path ) {
			owfree( escaped_path ) ;
		}
	} else {
		fprintf(out, "<TR><TD><A HREF='/'><CODE><B><BIG>top</BIG></B></CODE></A></TD><TD>highest level</TD><TD>directory</TD></TR>");
	}

	FS_dir(ShowDirCallback, out, pn);
	fprintf(out, "</TABLE>");
	HTTPfoot(out);
}