Atmel Software Framework

fscmds.c File Reference
#include <string.h>
#include <math.h>
#include "compiler.h"
#include "board.h"
#include "shell.h"
#include "sensor.h"
#include "actuator.h"
#include "fsaccess.h"
#include "fscmds.h"
#include "supervisor.h"
#include "com1shell.h"
#include "tracedump.h"

Functions

eFsCmdsStatus e_fscmds_cd (signed short FsNavId, FS_STRING pxStringDirName)
 The cd basic command. More...
 
eFsCmdsStatus e_fscmds_CheckNavError (void)
 Check the FAT module global var fs_g_status to get the error that occurred in the FAT module. More...
 
eFsCmdsStatus e_fscmds_format (signed short FsNavId, unsigned short u8DriveId)
 The format basic command: format a disk. More...
 
eExecStatus e_fscmds_goto_drive (unsigned int u8DriveId, signed short FsNavId, int ac, signed portCHAR **ppcStringReply)
 Shared mount drive command. More...
 
eFsCmdsStatus e_fscmds_mount (signed short FsNavId, unsigned short u8DriveId)
 The mount basic command: mount a disk. More...
 
eFsCmdsStatus e_fscmds_rm (signed short FsNavId, const FS_STRING pxStringName, bool bOnlyEmpty)
 The rm basic command.
Remove a specified file or a specified directory == rm {-R} {filename,dirname} NOTE: file and directory names can be used with a path. More...
 
eFsCmdsStatus e_fscmds_rm_all (signed short FsNavId, bool bOnlyEmpty)
 The rm all basic command.
Remove all files and directories in current directory == rm {-R} *. More...
 
eExecStatus e_fscmds_shell_append (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_cat (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The cat command: Print the content of a file. Takes one parameter, that is the filename to cat. Format: cat filename. More...
 
eExecStatus e_fscmds_shell_cd (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The cd command: Change directory. Takes one parameter, that is the dest directory. Format: cd dirname. More...
 
eExecStatus e_fscmds_shell_cp (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The cp command: copy a specified file to the bookmarked directory. Takes one parameter, that is the file to copy. Format: cp filename WARNING: paths are not supported; i.e. the parameter must be a filename without path. More...
 
eExecStatus e_fscmds_shell_df (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_disk (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_fat (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_format (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The format command: format the specified drive. Takes one parameter, that is the drive to format. Format: format drive. More...
 
eExecStatus e_fscmds_shell_goto (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The goto command: goto the bookmarked directory. Format: goto. More...
 
eExecStatus e_fscmds_shell_goto_a_drive (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_goto_b_drive (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_goto_c_drive (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_goto_d_drive (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_help (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_ls (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The ls command: list current directory content. Format: ls. More...
 
eExecStatus e_fscmds_shell_mark (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_mkdir (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eExecStatus e_fscmds_shell_mount (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The mount command: mount a disk. Takes one parameter, that is the disk letter. Format: mount {a,b,c,d}. More...
 
eExecStatus e_fscmds_shell_mv (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The mv command: rename a file or a directory. Takes two parameters, the file to rename as the first parameter and the new name as second parameter. Format: mv src dst WARNING: paths are not supported; i.e. parameters must be filenames without path. More...
 
eExecStatus e_fscmds_shell_pwd (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The pwd command: return current path. Format: pwd. More...
 
eExecStatus e_fscmds_shell_rm (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The rm command: remove a specified file or a specified directory or all files and directories. Takes up to two parameters, first an optional parameter to recursively delete directories(i.e. non empty directories may be deleted), and always the parameter which is the file to delete or the directory to delete or *. Format: rm {-R} {file,directory,*} NOTE: file and directory names can be used with a path. WARNING: paths are not supported with *; i.e. the command may only be rm -R * or rm *. More...
 
eExecStatus e_fscmds_shell_touch (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 
eFsCmdsStatus e_fscmds_touch (signed short FsNavId, const FS_STRING pxStringFilename)
 
static eFsCmdsStatus prv_append (eModId xModId, signed short FsNavId, const FS_STRING pxStringFilename)
 The append basic command. More...
 
static eFsCmdsStatus prv_cat (eModId xModId, signed short FsNavId, const FS_STRING pStringFilename)
 The cat basic command. More...
 
static eFsCmdsStatus prv_cp (eModId xModId, signed short FsNavId, const FS_STRING pStringFilename)
 The cp basic command. More...
 
static eFsCmdsStatus prv_df (eModId xModId, signed short FsNavId)
 The df basic command
Display free space information for all connected drives. More...
 
static signed portCHAR prv_GetChar_From_Requester_Stream (eModId xModId)
 Get a char from the input stream of a module. More...
 
static int prv_i_GetIdxFromModid (eModId xModId)
 return x from a 2powx number. More...
 
static eFsCmdsStatus prv_ls (eModId xModId, signed short FsNavId)
 The ls basic command. More...
 
static bool prv_NameExists (const FS_STRING pxStringName)
 Check if a file and/or directory already exists in the current directory. More...
 
static void prv_Print_String_To_Requester_Stream (eModId xModId, const portCHAR *pStringToPrint)
 Print a string directly to the output stream of a module. More...
 
static void prv_PutChar_To_Requester_Stream (eModId xModId, signed portCHAR c)
 Put a char to the output stream of a module. More...
 
static eFsCmdsStatus prvCommonErrorLeave (void)
 Common upon-error-prologue of several functions. More...
 
void v_fscmds_GetStrMsgFromErr (eFsCmdsStatus ErrStatus, signed portCHAR **ppcStringReply)
 Map a string message to an error. More...
 

Variables

static Fs_index ax_mark_index [SYS_NB_MOD]
 
const signed portCHAR *const FSCMDS_ERRMSG_APPEND_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: append filename"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_BADSIZEFAT = (signed portCHAR *)ERROR_CRLF"Unsupported drive size"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_CAT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: cat filename"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_CD_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: cd dirname"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_CD_UNKNOWNDIR = (signed portCHAR *)ERROR_CRLF"Unknown directory"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_CP_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: cp filename"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_DF_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: df"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_DIRNOTEMPTY = (signed portCHAR *)ERROR_CRLF"Directory not empty."CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_DISK_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: disk"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_FAT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: fat"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_FILENOTFOUND = (signed portCHAR *)ERROR_CRLF"File not found"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_FILEWR = (signed portCHAR *)ERROR_CRLF"File currently opened in write-mode"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_FORMAT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: format {a,b,c,d}"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_FS = (signed portCHAR *)ERROR_CRLF"File system error"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_FSNOTSUPPORTED = (signed portCHAR *)ERROR_CRLF"Unsupported file system"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_GOTO_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: goto"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_HELP_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: help"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_HW = (signed portCHAR *)ERROR_CRLF"Hardware error"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_INCORRECTNAME = (signed portCHAR *)ERROR_CRLF"Incorrect name, this must be not contain char \\/:*?\"<>|"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_ISROOTDIR = (signed portCHAR *)ERROR_CRLF"Current dir is a root dir."CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_LS_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: ls"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MAINTENANCE = (signed portCHAR *)ERROR_CRLF"File system access forbidden(Maintenance mode)"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MARK_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: mark"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MEMDEVMISSING = (signed portCHAR *)ERROR_CRLF"Memory device is missing"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MKDIR_NAMEEXISTS = (signed portCHAR *)ERROR_CRLF"Name already used."CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MKDIR_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: mkdir dirname"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MOUNT_DRIVENOTFOUND = (signed portCHAR *)ERROR_CRLF"Drive not found."CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MOUNT_FAILED = (signed portCHAR *)ERROR_CRLF"Unable to mount drive"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MOUNT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: mount {a,b,c,d}"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MOUNTSHORT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: {a:,b:,c:,d:}"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MV_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: mv src dst"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_MV_TYPEDIFFER = (signed portCHAR *)ERROR_CRLF"Src & dst must be of the same type."CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_NOFORMAT = (signed portCHAR *)ERROR_CRLF"Current drive is not formatted"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_NOMOUNT = (signed portCHAR *)ERROR_CRLF"No drive mounted"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_NOPARTITION = (signed portCHAR *)ERROR_CRLF"The selected partition doesn't exist"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_NOTAFILE = (signed portCHAR *)ERROR_CRLF"Not a file"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_NOTFOUND = (signed portCHAR *)ERROR_CRLF"File or directory not found"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_OUTOFMEM = (signed portCHAR *)ERROR_CRLF"Operation cancelled: out of memory"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_READONLYDRIVE = (signed portCHAR *)ERROR_CRLF"Drive is read-only"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_RM_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: rm {-R} {filename,dirname,*}"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_TOUCH_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: touch filename"CRLF
 
const signed portCHAR *const FSCMDS_ERRMSG_UNEXPECTED = (signed portCHAR *)ERROR_CRLF"Unexpected error"CRLF
 
const signed portCHAR *const FSCMDS_MSG_APPEND_WELCOME = (signed portCHAR *)CRLF"Simple text editor, enter char to append, ^q to exit and save"CRLF
 
const signed portCHAR *const FSCMDS_MSG_HELP
 
static portCHAR str_ascii [MAX_FILE_PATH_LENGTH]
 

eFsCmdsStatus e_fscmds_cd ( signed short  FsNavId,
FS_STRING  pxStringDirName 
)

The cd basic command.

Parameters
FsNavIdInput. The file system navigator id to use.
pxStringDirNameInput. The directory name.
Returns
the status of the operation.

References e_fscmds_CheckNavError(), fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_STATUS_OK, nav_select(), and nav_setcwd().

Referenced by e_fscmds_shell_cd().

eFsCmdsStatus e_fscmds_format ( signed short  FsNavId,
unsigned short  u8DriveId 
)

The format basic command: format a disk.

Parameters
FsNavIdInput. The file system navigator id to use.
u8DriveIdInput. The target drive id.
Returns
the status of the operation.

References e_fscmds_CheckNavError(), FS_FORMAT_DEFAULT, fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_STATUS_ERR_DRIVE, FSCMDS_STATUS_OK, nav_drive_format(), nav_drive_get(), nav_drive_nb(), nav_drive_set(), nav_filelist_reset(), nav_partition_mount(), and nav_select().

Referenced by b_mmi_format_a(), b_mmi_format_b(), and e_fscmds_shell_format().

eExecStatus e_fscmds_goto_drive ( unsigned int  u8DriveId,
signed short  FsNavId,
int  ac,
signed portCHAR **  ppcStringReply 
)

Shared mount drive command.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
u8DriveIdInput. The drive id to mount.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. Should be 0.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References e_fscmds_mount(), FSCMDS_ERRMSG_MOUNTSHORT_SYNTAXERROR, FSCMDS_STATUS_OK, NULL, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and v_fscmds_GetStrMsgFromErr().

Referenced by e_fscmds_shell_goto_a_drive(), e_fscmds_shell_goto_b_drive(), e_fscmds_shell_goto_c_drive(), and e_fscmds_shell_goto_d_drive().

eFsCmdsStatus e_fscmds_mount ( signed short  FsNavId,
unsigned short  u8DriveId 
)

The mount basic command: mount a disk.

Parameters
FsNavIdInput. The file system navigator id to use.
u8DriveIdInput. The target drive id.
Returns
the status of the operation.

References e_fscmds_CheckNavError(), fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_STATUS_ERR_DRIVE, FSCMDS_STATUS_OK, nav_drive_nb(), nav_drive_set(), nav_partition_mount(), and nav_select().

Referenced by e_fscmds_goto_drive(), and e_fscmds_shell_mount().

eFsCmdsStatus e_fscmds_rm ( signed short  FsNavId,
const FS_STRING  pxStringName,
bool  bOnlyEmpty 
)

The rm basic command.
Remove a specified file or a specified directory == rm {-R} {filename,dirname} NOTE: file and directory names can be used with a path.

Parameters
FsNavIdInput. The file system navigator id to use.
pxStringNameInput. The name.
bOnlyEmptyInput. Boolean switch between:
false(=="non-empty directories can be deleted")
and true(=="non-empty directories cannot be deleted")
Returns
the status of the operation.

References e_fscmds_CheckNavError(), fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_STATUS_ERR_NOTFOUND, FSCMDS_STATUS_OK, nav_file_del(), nav_getindex(), nav_gotoindex(), nav_select(), and nav_setcwd().

Referenced by e_fscmds_shell_mv(), and e_fscmds_shell_rm().

eFsCmdsStatus e_fscmds_rm_all ( signed short  FsNavId,
bool  bOnlyEmpty 
)

The rm all basic command.
Remove all files and directories in current directory == rm {-R} *.

Parameters
FsNavIdInput. The file system navigator id to use.
bOnlyEmptyInput. Boolean switch between:
false(=="non-empty directories can be deleted")
and true(=="non-empty directories cannot be deleted") WARNING: paths are not supported with *; i.e. the command may only be rm -R * or rm *
Returns
the status of the operation.

References e_fscmds_CheckNavError(), FS_DIR, FS_FILE, FS_FIND_NEXT, fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_STATUS_OK, nav_file_del(), nav_filelist_first(), nav_filelist_reset(), nav_filelist_set(), and nav_select().

Referenced by e_fscmds_shell_rm().

eExecStatus e_fscmds_shell_append ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)
eExecStatus e_fscmds_shell_cat ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The cat command: Print the content of a file. Takes one parameter, that is the filename to cat. Format: cat filename.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. Should be 1.
avInput. The argument vector.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References FSCMDS_ERRMSG_CAT_SYNTAXERROR, FSCMDS_STATUS_OK, NULL, prv_cat(), SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and v_fscmds_GetStrMsgFromErr().

eExecStatus e_fscmds_shell_cd ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The cd command: Change directory. Takes one parameter, that is the dest directory. Format: cd dirname.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. For this command, should be 1.
avInput. The argument vector. For this command, only av[0] is considered.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References e_fscmds_cd(), FSCMDS_ERRMSG_CD_SYNTAXERROR, FSCMDS_STATUS_OK, NULL, pvPortMalloc(), SHELL_ERRMSG_MEMALLOC, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, v_fscmds_GetStrMsgFromErr(), and vPortFree().

eExecStatus e_fscmds_shell_cp ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The cp command: copy a specified file to the bookmarked directory. Takes one parameter, that is the file to copy. Format: cp filename WARNING: paths are not supported; i.e. the parameter must be a filename without path.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. Should be 1.
avInput. The argument vector.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References FSCMDS_ERRMSG_CP_SYNTAXERROR, FSCMDS_STATUS_OK, NULL, prv_cp(), SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and v_fscmds_GetStrMsgFromErr().

eExecStatus e_fscmds_shell_df ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)
eExecStatus e_fscmds_shell_disk ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)
eExecStatus e_fscmds_shell_fat ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)
eExecStatus e_fscmds_shell_format ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The format command: format the specified drive. Takes one parameter, that is the drive to format. Format: format drive.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. Should be 1.
avInput. The argument vector.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References e_fscmds_format(), FSCMDS_ERRMSG_FORMAT_SYNTAXERROR, FSCMDS_ERRMSG_MOUNT_DRIVENOTFOUND, FSCMDS_STATUS_OK, NULL, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and v_fscmds_GetStrMsgFromErr().

eExecStatus e_fscmds_shell_goto ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The goto command: goto the bookmarked directory. Format: goto.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. Should be 0.
avInput. The argument vector.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_ERRMSG_GOTO_SYNTAXERROR, nav_gotoindex(), nav_select(), NULL, prv_i_GetIdxFromModid(), prvCommonErrorLeave(), SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and v_fscmds_GetStrMsgFromErr().

eExecStatus e_fscmds_shell_goto_a_drive ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

References e_fscmds_goto_drive().

eExecStatus e_fscmds_shell_goto_b_drive ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

References e_fscmds_goto_drive().

eExecStatus e_fscmds_shell_goto_c_drive ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

References e_fscmds_goto_drive().

eExecStatus e_fscmds_shell_goto_d_drive ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

References e_fscmds_goto_drive().

eExecStatus e_fscmds_shell_help ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)
eExecStatus e_fscmds_shell_ls ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The ls command: list current directory content. Format: ls.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. Should be 0.
avInput. The argument vector. Ignored.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References FSCMDS_ERRMSG_LS_SYNTAXERROR, FSCMDS_STATUS_OK, NULL, prv_ls(), SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and v_fscmds_GetStrMsgFromErr().

eExecStatus e_fscmds_shell_mark ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)
eExecStatus e_fscmds_shell_mount ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The mount command: mount a disk. Takes one parameter, that is the disk letter. Format: mount {a,b,c,d}.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. For this command, should be 1.
avInput. The argument vector. For this command, only av[0] is considered.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References e_fscmds_mount(), FSCMDS_ERRMSG_MOUNT_DRIVENOTFOUND, FSCMDS_ERRMSG_MOUNT_SYNTAXERROR, FSCMDS_STATUS_OK, NULL, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and v_fscmds_GetStrMsgFromErr().

eExecStatus e_fscmds_shell_mv ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The mv command: rename a file or a directory. Takes two parameters, the file to rename as the first parameter and the new name as second parameter. Format: mv src dst WARNING: paths are not supported; i.e. parameters must be filenames without path.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. Should be 2.
avInput. The argument vector.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References e_fscmds_CheckNavError(), e_fscmds_rm(), fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_ERRMSG_MV_SYNTAXERROR, FSCMDS_ERRMSG_MV_TYPEDIFFER, FSCMDS_STATUS_KO, FSCMDS_STATUS_OK, nav_file_isdir(), nav_file_rename(), nav_getindex(), nav_gotoindex(), nav_select(), nav_setcwd(), NULL, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and v_fscmds_GetStrMsgFromErr().

eExecStatus e_fscmds_shell_pwd ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The pwd command: return current path. Format: pwd.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. Should be 0.
avInput. The argument vector. Ignored.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References CRLF, e_fscmds_CheckNavError(), fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_ERRMSG_LS_SYNTAXERROR, FSCMDS_STATUS_OK, nav_getcwd(), nav_select(), NULL, prv_Print_String_To_Requester_Stream(), pvPortMalloc(), SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, SHELL_MAX_MSGOUT_LEN, v_fscmds_GetStrMsgFromErr(), v_shell_Print_String_To_Requester_Stream(), and vPortFree().

eExecStatus e_fscmds_shell_rm ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The rm command: remove a specified file or a specified directory or all files and directories. Takes up to two parameters, first an optional parameter to recursively delete directories(i.e. non empty directories may be deleted), and always the parameter which is the file to delete or the directory to delete or *. Format: rm {-R} {file,directory,*} NOTE: file and directory names can be used with a path. WARNING: paths are not supported with *; i.e. the command may only be rm -R * or rm *.

Note
This function must be of the type pfShellCmd defined by the shell module.
Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
acInput. The argument counter. Should be 1 or 2.
avInput. The argument vector.
ppcStringReplyInput/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

References e_fscmds_rm(), e_fscmds_rm_all(), FSCMDS_ERRMSG_RM_SYNTAXERROR, FSCMDS_STATUS_OK, NULL, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and v_fscmds_GetStrMsgFromErr().

eExecStatus e_fscmds_shell_touch ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)
static eFsCmdsStatus prv_append ( eModId  xModId,
signed short  FsNavId,
const FS_STRING  pxStringFilename 
)
static
static eFsCmdsStatus prv_cat ( eModId  xModId,
signed short  FsNavId,
const FS_STRING  pStringFilename 
)
static

The cat basic command.

Parameters
xModIdInput. The module associated with the target output stream.
FsNavIdInput. The file system navigator id to use.
pStringFilenameInput. The filename.
Returns
the status of the operation.

References CRLF, file_close(), file_open(), FOPEN_MODE_R, FS_SIZE_OF_SECTOR, fsaccess_file_get_size(), fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_STATUS_ERR_FILENOTFOUND, FSCMDS_STATUS_ERR_MEMALLOC, FSCMDS_STATUS_OK, nav_getindex(), nav_gotoindex(), nav_select(), nav_setcwd(), NULL, prvCommonErrorLeave(), pvPortMalloc(), read(), TRACE_COM2, v_shell_Print_String_To_Requester_Stream(), and vPortFree().

Referenced by e_fscmds_shell_cat().

static eFsCmdsStatus prv_cp ( eModId  xModId,
signed short  FsNavId,
const FS_STRING  pStringFilename 
)
static

The cp basic command.

Parameters
xModIdInput. The module associated with the target output stream.
FsNavIdInput. The file system navigator id to use.
pStringFilenameInput. The filename to copy.
Returns
the status of the operation.

References COPY_BUSY, FS_NAME_GET, fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_STATUS_ERR_FILENOTFOUND, FSCMDS_STATUS_OK, MAX_FILE_PATH_LENGTH, nav_file_copy(), nav_file_lgtsector(), nav_file_name(), nav_file_paste_start(), nav_file_paste_state(), nav_getindex(), nav_gotoindex(), nav_partition_space(), nav_select(), nav_setcwd(), prv_i_GetIdxFromModid(), and prvCommonErrorLeave().

Referenced by e_fscmds_shell_cp().

static eFsCmdsStatus prv_df ( eModId  xModId,
signed short  FsNavId 
)
static

The df basic command
Display free space information for all connected drives.

Parameters
xModIdInput. The module that is calling this function.
FsNavIdInput. The file system navigator id to use.
Returns
the status of the operation.

References CRLF, e_fscmds_CheckNavError(), FS_SHIFT_B_TO_SECTOR, fsaccess_give_mutex(), fsaccess_take_mutex(), FSCMDS_STATUS_ERR_MEMALLOC, FSCMDS_STATUS_OK, i, mem_name(), nav_drive_nb(), nav_drive_set(), nav_getindex(), nav_gotoindex(), nav_partition_freespace(), nav_partition_mount(), nav_partition_space(), nav_select(), NULL, pvPortMalloc(), SHELL_MAX_MSGOUT_LEN, sprintf(), v_fscmds_GetStrMsgFromErr(), v_shell_Print_String_To_Requester_Stream(), and vPortFree().

Referenced by e_fscmds_shell_df().

static signed portCHAR prv_GetChar_From_Requester_Stream ( eModId  xModId)
static

Get a char from the input stream of a module.

Parameters
xModIdInput. The module associated with the target input stream.
Returns
the character

References com1shell_GetChar(), pdFALSE, SYS_MODID_COM1SHELL, SYS_MODID_USB, and TRACE_COM2.

Referenced by prv_append().

static int prv_i_GetIdxFromModid ( eModId  xModId)
static

return x from a 2powx number.

Parameters
xModIdModule id, which is a 2powx number.
Returns
the x of 2powx

Referenced by e_fscmds_shell_goto(), e_fscmds_shell_mark(), and prv_cp().

static bool prv_NameExists ( const FS_STRING  pxStringName)
static

Check if a file and/or directory already exists in the current directory.

Parameters
pxStringNameInput. The filename to compare against.
Note
The mutex must have already been taken by the calling function and the navigator is already set by the calling function.
Returns
true if the file already exists.

References FS_DIR, FS_FILE, FS_FIND_NEXT, FS_NAME_GET, i, MAX_FILE_PATH_LENGTH, nav_file_name(), nav_filelist_first(), nav_filelist_nb(), nav_filelist_set(), and str_ascii.

Referenced by e_fscmds_shell_mkdir().

static void prv_Print_String_To_Requester_Stream ( eModId  xModId,
const portCHAR *  pStringToPrint 
)
static

Print a string directly to the output stream of a module.

Parameters
xModIdInput. The module associated with the target output stream.
pStringToPrintInput. The string to print.

References SYS_MODID_COM1SHELL, SYS_MODID_USB, TRACE_COM2, and vcom1shell_PrintMsg().

Referenced by e_fscmds_shell_pwd(), and prv_ls().

static void prv_PutChar_To_Requester_Stream ( eModId  xModId,
signed portCHAR  c 
)
static

Put a char to the output stream of a module.

Parameters
xModIdInput. The module associated with the target output stream.
cInput. The char to put to the target output stream.

References SYS_MODID_COM1SHELL, SYS_MODID_USB, TRACE_COM2, and vcom1shell_PutChar().

Referenced by prv_append().

static eFsCmdsStatus prvCommonErrorLeave ( void  )
static

Common upon-error-prologue of several functions.

Returns
cmd execution status.

References e_fscmds_CheckNavError(), and fsaccess_give_mutex().

Referenced by e_fscmds_shell_goto(), prv_append(), prv_cat(), prv_cp(), and prv_ls().

void v_fscmds_GetStrMsgFromErr ( eFsCmdsStatus  ErrStatus,
signed portCHAR **  ppcStringReply 
)

Map a string message to an error.

Parameters
ErrStatusInput. The error status.
ppcStringReplyInput/Output. The response string. The input is not NULL.

References FSCMDS_ERRMSG_BADSIZEFAT, FSCMDS_ERRMSG_CD_UNKNOWNDIR, FSCMDS_ERRMSG_DIRNOTEMPTY, FSCMDS_ERRMSG_FILENOTFOUND, FSCMDS_ERRMSG_FILEWR, FSCMDS_ERRMSG_FS, FSCMDS_ERRMSG_FSNOTSUPPORTED, FSCMDS_ERRMSG_HW, FSCMDS_ERRMSG_INCORRECTNAME, FSCMDS_ERRMSG_ISROOTDIR, FSCMDS_ERRMSG_MEMDEVMISSING, FSCMDS_ERRMSG_MOUNT_DRIVENOTFOUND, FSCMDS_ERRMSG_MOUNT_FAILED, FSCMDS_ERRMSG_NOFORMAT, FSCMDS_ERRMSG_NOMOUNT, FSCMDS_ERRMSG_NOPARTITION, FSCMDS_ERRMSG_NOTAFILE, FSCMDS_ERRMSG_NOTFOUND, FSCMDS_ERRMSG_OUTOFMEM, FSCMDS_ERRMSG_READONLYDRIVE, FSCMDS_ERRMSG_UNEXPECTED, FSCMDS_STATUS_ERR_BADSIZEFAT, FSCMDS_STATUS_ERR_DIRNOTEMPTY, FSCMDS_STATUS_ERR_DRIVE, FSCMDS_STATUS_ERR_FILENOTFOUND, FSCMDS_STATUS_ERR_FILEWR, FSCMDS_STATUS_ERR_FS, FSCMDS_STATUS_ERR_FSNOTSUPPORTED, FSCMDS_STATUS_ERR_HW, FSCMDS_STATUS_ERR_INCORRECTNAME, FSCMDS_STATUS_ERR_ISROOTDIR, FSCMDS_STATUS_ERR_MEMALLOC, FSCMDS_STATUS_ERR_MEMDEVMISSING, FSCMDS_STATUS_ERR_MOUNT, FSCMDS_STATUS_ERR_NOFORMAT, FSCMDS_STATUS_ERR_NOMOUNT, FSCMDS_STATUS_ERR_NOPARTITION, FSCMDS_STATUS_ERR_NOTAFILE, FSCMDS_STATUS_ERR_NOTFOUND, FSCMDS_STATUS_ERR_OUTOFMEM, FSCMDS_STATUS_ERR_READONLY, FSCMDS_STATUS_ERR_UNKNOWN, FSCMDS_STATUS_ERR_UNKNOWNDIR, and SHELL_ERRMSG_MEMALLOC.

Referenced by e_fscmds_goto_drive(), e_fscmds_shell_append(), e_fscmds_shell_cat(), e_fscmds_shell_cd(), e_fscmds_shell_cp(), e_fscmds_shell_format(), e_fscmds_shell_goto(), e_fscmds_shell_ls(), e_fscmds_shell_mkdir(), e_fscmds_shell_mount(), e_fscmds_shell_mv(), e_fscmds_shell_pwd(), e_fscmds_shell_rm(), e_fscmds_shell_touch(), and prv_df().

Fs_index ax_mark_index[SYS_NB_MOD]
static

Array of index for each possible fs shell clients.

const signed portCHAR* const FSCMDS_ERRMSG_APPEND_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: append filename"CRLF

Error msg upon append syntax error.

Referenced by e_fscmds_shell_append().

const signed portCHAR* const FSCMDS_ERRMSG_BADSIZEFAT = (signed portCHAR *)ERROR_CRLF"Unsupported drive size"CRLF

Error msg if the disk size is smaller than 4,1MB, or not supported by file system selected.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_CAT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: cat filename"CRLF

Error msg upon cat syntax error.

Referenced by e_fscmds_shell_cat().

const signed portCHAR* const FSCMDS_ERRMSG_CD_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: cd dirname"CRLF

Error msg upon cd syntax error.

Referenced by e_fscmds_shell_cd().

const signed portCHAR* const FSCMDS_ERRMSG_CD_UNKNOWNDIR = (signed portCHAR *)ERROR_CRLF"Unknown directory"CRLF

Error msg upon unknown directory.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_CP_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: cp filename"CRLF

Error msg upon cp syntax error.

Referenced by e_fscmds_shell_cp().

const signed portCHAR* const FSCMDS_ERRMSG_DF_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: df"CRLF

Error msg upon df syntax error.

Referenced by e_fscmds_shell_df().

const signed portCHAR* const FSCMDS_ERRMSG_DIRNOTEMPTY = (signed portCHAR *)ERROR_CRLF"Directory not empty."CRLF

Error msg upon rm of a non-empty directory error.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_DISK_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: disk"CRLF

Error msg upon disk syntax error.

Referenced by e_fscmds_shell_disk().

const signed portCHAR* const FSCMDS_ERRMSG_FAT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: fat"CRLF

Error msg upon fat syntax error.

Referenced by e_fscmds_shell_fat().

const signed portCHAR* const FSCMDS_ERRMSG_FILENOTFOUND = (signed portCHAR *)ERROR_CRLF"File not found"CRLF

Error msg upon file not found.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_FILEWR = (signed portCHAR *)ERROR_CRLF"File currently opened in write-mode"CRLF

Error msg if we try to read from or write to a file that is currently already opened in write mode.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_FORMAT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: format {a,b,c,d}"CRLF

Error msg upon format syntax error.

Referenced by e_fscmds_shell_format().

const signed portCHAR* const FSCMDS_ERRMSG_FS = (signed portCHAR *)ERROR_CRLF"File system error"CRLF

Error msg upon file system error.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_FSNOTSUPPORTED = (signed portCHAR *)ERROR_CRLF"Unsupported file system"CRLF

Error msg upon unsupported file system error.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_GOTO_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: goto"CRLF

Error msg upon goto syntax error.

Referenced by e_fscmds_shell_goto().

const signed portCHAR* const FSCMDS_ERRMSG_HELP_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: help"CRLF

Error msg upon help syntax error.

const signed portCHAR* const FSCMDS_ERRMSG_HW = (signed portCHAR *)ERROR_CRLF"Hardware error"CRLF

Error msg upon hardware error.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_INCORRECTNAME = (signed portCHAR *)ERROR_CRLF"Incorrect name, this must be not contain char \\/:*?\"<>|"CRLF

Error msg upon incorrect file name format error.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_ISROOTDIR = (signed portCHAR *)ERROR_CRLF"Current dir is a root dir."CRLF

Error msg upon mkdir syntax error.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_LS_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: ls"CRLF

Error msg upon ls syntax error.

Referenced by e_fscmds_shell_ls(), and e_fscmds_shell_pwd().

const signed portCHAR* const FSCMDS_ERRMSG_MAINTENANCE = (signed portCHAR *)ERROR_CRLF"File system access forbidden(Maintenance mode)"CRLF

Error msg when in maintenance mode.

const signed portCHAR* const FSCMDS_ERRMSG_MARK_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: mark"CRLF

Error msg upon mark syntax error.

Referenced by e_fscmds_shell_mark().

const signed portCHAR* const FSCMDS_ERRMSG_MEMDEVMISSING = (signed portCHAR *)ERROR_CRLF"Memory device is missing"CRLF

Error msg upon memory device miss error.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_MKDIR_NAMEEXISTS = (signed portCHAR *)ERROR_CRLF"Name already used."CRLF

Error msg upon mkdir syntax error.

Referenced by e_fscmds_shell_mkdir().

const signed portCHAR* const FSCMDS_ERRMSG_MKDIR_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: mkdir dirname"CRLF

Error msg upon mkdir syntax error.

Referenced by e_fscmds_shell_mkdir().

const signed portCHAR* const FSCMDS_ERRMSG_MOUNT_DRIVENOTFOUND = (signed portCHAR *)ERROR_CRLF"Drive not found."CRLF

Error msg upon mount of an unknown drive.

Referenced by e_fscmds_shell_format(), e_fscmds_shell_mount(), and v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_MOUNT_FAILED = (signed portCHAR *)ERROR_CRLF"Unable to mount drive"CRLF

Error msg upon mount failure.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_MOUNT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: mount {a,b,c,d}"CRLF

String error messages.

Error msg upon mount syntax error.

Referenced by e_fscmds_shell_mount().

const signed portCHAR* const FSCMDS_ERRMSG_MOUNTSHORT_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: {a:,b:,c:,d:}"CRLF

Error msg upon {a:,b:,c:,d:} syntax error.

Referenced by e_fscmds_goto_drive().

const signed portCHAR* const FSCMDS_ERRMSG_MV_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: mv src dst"CRLF

Error msg upon mv syntax error.

Referenced by e_fscmds_shell_mv().

const signed portCHAR* const FSCMDS_ERRMSG_MV_TYPEDIFFER = (signed portCHAR *)ERROR_CRLF"Src & dst must be of the same type."CRLF

Error msg upon mv of different file types.

Referenced by e_fscmds_shell_mv().

const signed portCHAR* const FSCMDS_ERRMSG_NOFORMAT = (signed portCHAR *)ERROR_CRLF"Current drive is not formatted"CRLF

Error msg upon unformatted drive error.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_NOMOUNT = (signed portCHAR *)ERROR_CRLF"No drive mounted"CRLF

Error msg if no drive is currently mounted.

Referenced by e_fscmds_shell_fat(), and v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_NOPARTITION = (signed portCHAR *)ERROR_CRLF"The selected partition doesn't exist"CRLF

Error msg upon selected partition not found error.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_NOTAFILE = (signed portCHAR *)ERROR_CRLF"Not a file"CRLF

Error msg if a file was expected and it's not.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_NOTFOUND = (signed portCHAR *)ERROR_CRLF"File or directory not found"CRLF

Error msg upon file or directory not found.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_OUTOFMEM = (signed portCHAR *)ERROR_CRLF"Operation cancelled: out of memory"CRLF

Error msg upon out of memory event.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_READONLYDRIVE = (signed portCHAR *)ERROR_CRLF"Drive is read-only"CRLF

Error msg if a drive we wanted to write to is read-only .

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_ERRMSG_RM_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: rm {-R} {filename,dirname,*}"CRLF

Error msg upon rm syntax error.

Referenced by e_fscmds_shell_rm().

const signed portCHAR* const FSCMDS_ERRMSG_TOUCH_SYNTAXERROR = (signed portCHAR *)ERROR_CRLF"Usage: touch filename"CRLF

Error msg upon touch syntax error.

Referenced by e_fscmds_shell_touch().

const signed portCHAR* const FSCMDS_ERRMSG_UNEXPECTED = (signed portCHAR *)ERROR_CRLF"Unexpected error"CRLF

Unexpected error msg: SHOULD NEVER HAPPEN.

Referenced by v_fscmds_GetStrMsgFromErr().

const signed portCHAR* const FSCMDS_MSG_APPEND_WELCOME = (signed portCHAR *)CRLF"Simple text editor, enter char to append, ^q to exit and save"CRLF

String messages.

Referenced by prv_append().

const signed portCHAR* const FSCMDS_MSG_HELP
Initial value:
= (signed portCHAR *)"\
"CRLF"disk: get the number of drives"CRLF"\
a:, b:, etc.: go to selected drive"CRLF"\
mount drivename (a, b, etc.): go to selected drive"CRLF"\
format drivename (a, b, etc.): format selected drive"CRLF"\
fat: get FAT type used by current drive"CRLF"\
df: get free space information for all connected drives"CRLF"\
cd dirname: go to selected directory"CRLF"\
cd ..: go to upper directory"CRLF"\
mark: bookmark current directory"CRLF"\
goto: go to bookmarked directory"CRLF"\
ls: list files and directories in current directory"CRLF"\
pwd: get current path"CRLF"\
rm filename: remove selected file or empty directory"CRLF"\
rm -R foldername: remove selected directory and its content"CRLF"\
rm *: remove all files or empty directories in current directory"CRLF"\
cp filename: copy filename to bookmarked directory"CRLF"\
mv src dst: rename selected file or directory"CRLF"\
mkdir dirname: make directory"CRLF"\
touch filename: create file"CRLF"\
append filename: append to selected file from terminal input"CRLF"\
cat filename: list file contents"CRLF
#define CRLF
Carriage Return + Line Feed.
Definition: print_funcs.h:252

Referenced by e_fscmds_shell_help().

portCHAR str_ascii[MAX_FILE_PATH_LENGTH]
static

Temporary buffer holding a string.

Referenced by prv_ls(), and prv_NameExists().