1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-13 03:29:36 +00:00

testcode/lib/tinyshell.c: Enable SP check only for CC65

targets. Enable 'cls' command only for Atari. Enable subdirectory
commands only for Atari and non-CC65 targets.
This commit is contained in:
Christian Groessler 2013-09-12 12:32:59 +02:00
parent 619de8b314
commit d488272357

View File

@ -7,9 +7,9 @@
#ifdef __ATARI__
#define UPPERCASE /* define (e.g. for Atari) to convert filenames etc. to upper case */
#endif
#define CHECK_SP
#define HAVE_SUBDIRS
#endif
#define KEYB_BUFSZ 80
#define PROMPT ">>> "
@ -22,6 +22,7 @@
#ifndef __CC65__
#include <sys/stat.h>
#include <sys/param.h>
#define HAVE_SUBDIRS
#else
#define MAXPATHLEN 64
#endif
@ -66,11 +67,13 @@ struct cmd_table {
{ "ls", CMD_LS },
{ "dir", CMD_LS },
{ "md", CMD_MKDIR },
#ifdef HAVE_SUBDIRS
{ "mkdir", CMD_MKDIR },
{ "rd", CMD_RMDIR },
{ "rmdir", CMD_RMDIR },
{ "cd", CMD_CHDIR },
{ "chdir", CMD_CHDIR },
#endif
{ "rm", CMD_RM },
{ "del", CMD_RM },
{ "cp", CMD_COPY },
@ -78,7 +81,7 @@ struct cmd_table {
{ "mv", CMD_RENAME },
{ "ren", CMD_RENAME },
{ "pwd", CMD_PWD },
#ifdef __CC65__
#ifdef __ATARI__
{ "cls", CMD_CLS },
#endif
{ "verbose", CMD_VERBOSE },
@ -162,7 +165,7 @@ static void cmd_help(void)
puts("cd, chdir - change directory or drive");
puts("md, mkdir - make directory or drive");
puts("rd, rmdir - remove directory or drive");
#ifdef __CC65__
#ifdef __ATARI__
puts("cls - clear screen");
#endif
puts("verbose - set verbosity level");
@ -239,6 +242,8 @@ static void cmd_rm(void)
printf("remove failed: %s\n", strerror(errno));
}
#ifdef HAVE_SUBDIRS
static void cmd_mkdir(void)
{
if (!arg1 || arg2) {
@ -310,6 +315,8 @@ static void cmd_pwd(void)
free(buf);
}
#endif /* #ifdef HAVE_SUBDIRS */
static void cmd_rename(void)
{
if (!arg2 || arg3) {
@ -389,7 +396,7 @@ static void cmd_copy(void)
if (dstfd >= 0) close(dstfd);
}
#ifdef __CC65__
#ifdef __ATARI__
static void cmd_cls(void)
{
printf("\f");
@ -426,13 +433,15 @@ static void run_command(void)
case CMD_QUIT: terminate = 1; return;
case CMD_LS: cmd_ls(); return;
case CMD_RM: cmd_rm(); return;
#ifdef HAVE_SUBDIRS
case CMD_CHDIR: cmd_chdir(); return;
case CMD_MKDIR: cmd_mkdir(); return;
case CMD_RMDIR: cmd_rmdir(); return;
case CMD_PWD: cmd_pwd(); return;
#endif
case CMD_RENAME: cmd_rename(); return;
case CMD_COPY: cmd_copy(); return;
#ifdef __CC65__
#ifdef __ATARI__
case CMD_CLS: cmd_cls(); return;
#endif
case CMD_VERBOSE: cmd_verbose(); return;