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