From d488272357198c02c3d63bcc7c6a3105f40b9fdd Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Thu, 12 Sep 2013 12:32:59 +0200 Subject: [PATCH] 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. --- testcode/lib/tinyshell.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/testcode/lib/tinyshell.c b/testcode/lib/tinyshell.c index 90fda52fd..f3b6aa769 100644 --- a/testcode/lib/tinyshell.c +++ b/testcode/lib/tinyshell.c @@ -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 #include +#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; -- 2.39.5