Exemple #1
0
	/* Callback function to FS_dir */
static void ShowDirCallback(void *v, const struct parsedname *pn_entry)
{
	/* uncached tag */
	/* device name */
	/* Have to allocate all buffers to make it work for Coldfire */
	FILE *out = v;
	const char *nam;
	const char *typ;
	char * escaped_path = httpescape( pn_entry->path ) ;

	if (IsDir(pn_entry)) {
		nam = FS_DirName(pn_entry);
		typ = name_directory;
	} else {
		nam = pn_entry->selected_device->readable_name;
		typ = name_onewire_chip;
	}

	fprintf(out,
			"<TR><TD><A HREF='%s'><CODE><B><BIG>%s</BIG></B></CODE></A></TD><TD>%s</TD><TD>%s</TD></TR>", escaped_path==NULL ? pn_entry->path : escaped_path, FS_DirName(pn_entry), nam,
			typ);

	if ( escaped_path ) {
		owfree( escaped_path ) ;
	}
}
Exemple #2
0
static void ShowDirTextCallback(void *v, const struct parsedname *const pn_entry)
{
	/* uncached tag */
	/* device name */
	/* Have to allocate all buffers to make it work for Coldfire */
	FILE *out = v;
	const char *nam;
	const char *typ;
	if (IsDir(pn_entry)) {
		nam = FS_DirName(pn_entry);
		typ = name_directory;
	} else {
		nam = pn_entry->selected_device->readable_name;
		typ = name_onewire_chip;
	}
	fprintf(out, "%s %s \"%s\"\r\n", FS_DirName(pn_entry), nam, typ);
}
Exemple #3
0
/*
  Get a directory,  returning a copy of the contents in *buffer (which must be free-ed elsewhere)
  return length of string, or <0 for error
  *buffer will be returned as NULL on error
 */
static void getdircallback( void * v, const struct parsedname * const pn_entry ) 
{
	struct charblob * cb = v ;
	const char * buf = FS_DirName(pn_entry) ;
	CharblobAdd( buf, strlen(buf), cb ) ;
	if ( IsDir(pn_entry) ) {
		CharblobAddChar( '/', cb ) ;
	}
}
Exemple #4
0
static void ShowDirJsonCallback(void *v, const struct parsedname *const pn_entry)
{
	/* uncached tag */
	/* device name */
	/* Have to allocate all buffers to make it work for Coldfire */
	FILE *out = v;
	const char *nam;

	if (IsDir(pn_entry)) {
		nam = FS_DirName(pn_entry);
	} else {
		nam = pn_entry->selected_device->readable_name;
	}
	fprintf(out, "\"%s\":[],\n", nam ) ;
}
Exemple #5
0
static void WildLexCDCallback(void *v, const struct parsedname *const pn_entry)
{
	struct wildlexcd *wlcd = v;
	struct cd_parse_s cps;
	strcpy(&wlcd->end[1], FS_DirName(pn_entry));
	//printf("Try %s vs %s\n",end,match) ;
	//if ( fnmatch( match, end, FNM_PATHNAME|FNM_CASEFOLD ) ) return ;
	if (fnmatch(wlcd->match, &wlcd->end[1], FNM_PATHNAME)) {
		return;
	}
	//printf("Match! %s\n",end) ;
	memcpy(&cps, wlcd->cps, sizeof(cps));
	cps.pse = parse_status_next;
	FileLexCD(&cps);
}
Exemple #6
0
static void ShowDirJsonCallback(void *v, const struct parsedname *const pn_entry)
{
	/* uncached tag */
	/* device name */
	/* Have to allocate all buffers to make it work for Coldfire */
	struct JsonCBstruct * jcbs = v ;
	const char *nam;

	if (IsDir(pn_entry)) {
		nam = FS_DirName(pn_entry);
	} else {
		nam = pn_entry->selected_device->readable_name;
	}
	
	JSON_dir_entry( jcbs, "\"%s\":[]", nam ) ;
}