/* ARISA - Admin Interface - Files Menu
 * Copyright (C) 2003 Carl Ritson
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 */

#define F_MAX 256
#define F_PMAX (F_MAX+12)

typedef struct files_t {
	char rpwd[F_MAX];
	char vpwd[F_MAX];
} files_t;

static void cmd_files_prompt(instance_t *ins, acontext_t *ac, int output) {
	files_t *f = (files_t *)ins->data;
	snprintf(ins->prompt,F_PMAX,"files: %s",f->vpwd);
	if(output)
		admin_output_prompt(ac);
}

/** Files Menu Commands **/

/** Files Menu Structure **/

static const cmd_t files_menu[] = {
	{NULL}
};

/** Files Menu Entry **/

MENU_CMD(cmd_files_entry) {
	files_t *f = xalloc(sizeof(files_t));
	
	ins->prompt = xalloc(F_PMAX);
	ins->free_prompt = 1;
	ins->data = f;
	
	strcpy(f->rpwd,"");
	strcpy(f->vpwd,"/");
	cmd_files_prompt(ins,ac,0);
	
	return 0;
}

static void register_files_menu(void) { // not active as it's incomplete
#if 0
	menu_t *f_menu = menu_from_cmds(
			"files",			// name
			0,				// min_args
			0,				// max_args
			0,				// log
			0,				// hide
			PRIV_TO_MASK(PRIV_FILES),	// privs
			cmd_files_entry,		// func
			NULL,				// helper
			(cmd_t *)files_menu);

	menu_add(main_menu_root,f_menu);
	menu_deref(f_menu);
#endif
}
