Allow to change the output format

The new test option allows to restore the past
behaviour, just in case...
This commit is contained in:
Andrea Mazzoleni 2016-10-11 20:30:12 +02:00
parent 97c01d35f4
commit faa530e83e
7 changed files with 102 additions and 17 deletions

View file

@ -1420,3 +1420,40 @@ int time_compare(const void* void_a, const void* void_b)
return 0;
}
/****************************************************************************/
/* format */
int FMT_MODE = FMT_FILE;
/**
* Format a file path for poll reference
*/
const char* fmt_poll(const struct snapraid_disk* disk, const char* str, char* buffer)
{
(void)disk;
return esc_shell(str, buffer);
}
/**
* Format a path name for terminal reference
*/
const char* fmt_term(const struct snapraid_disk* disk, const char* str, char* buffer)
{
const char* out[3];
switch (FMT_MODE) {
case FMT_FILE :
default :
return esc_shell(str, buffer);
case FMT_DISK :
out[0] = disk->name;
out[1] = ":";
out[2] = str;
return esc_shell_multi(out, 3, buffer);
case FMT_PATH :
out[0] = disk->dir;
out[1] = str;
return esc_shell_multi(out, 2, buffer);
}
}