Reconfigured Telnet server.

In order to have the wget command make some sense the write command should be present too.
- On the Apple][ reduction of the MTU seems to gain just enough RAM to have the (rather heavy-weight) full-blown C library file I/O working.
- On the C128 there's way too little RAM so there's no wget command but only the file commands.
- On the CBMs a dummy lseek() was necessary to have the read command link.
This commit is contained in:
Oliver Schmidt 2015-06-21 21:07:41 +02:00
parent fc9d38caba
commit a70fbf1bbf
10 changed files with 111 additions and 26 deletions

View File

@ -51,7 +51,7 @@
PROCESS(shell_ls_process, "ls");
SHELL_COMMAND(ls_command,
"ls",
"ls: list files",
"ls <dirname>: list files",
&shell_ls_process);
PROCESS(shell_append_process, "append");
SHELL_COMMAND(append_command,
@ -82,19 +82,21 @@ PROCESS_THREAD(shell_ls_process, ev, data)
char buf[32];
PROCESS_BEGIN();
if(cfs_opendir(&dir, "/") != 0) {
shell_output_str(&ls_command, "Cannot open directory", "");
} else {
totsize = 0;
while(cfs_readdir(&dir, &dirent) == 0) {
totsize += dirent.size;
sprintf(buf, "%lu ", (unsigned long)dirent.size);
/* printf("'%s'\n", dirent.name);*/
shell_output_str(&ls_command, buf, dirent.name);
if(data != NULL) {
if(cfs_opendir(&dir, data) != 0) {
shell_output_str(&ls_command, "Cannot open directory", "");
} else {
totsize = 0;
while(cfs_readdir(&dir, &dirent) == 0) {
totsize += dirent.size;
sprintf(buf, "%lu ", (unsigned long)dirent.size);
/* printf("'%s'\n", dirent.name);*/
shell_output_str(&ls_command, buf, dirent.name);
}
cfs_closedir(&dir);
sprintf(buf, "%lu", (unsigned long)totsize);
shell_output_str(&ls_command, "Total size: ", buf);
}
cfs_closedir(&dir);
sprintf(buf, "%lu", (unsigned long)totsize);
shell_output_str(&ls_command, "Total size: ", buf);
}
PROCESS_END();
}

View File

@ -1 +1 @@
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_PFS
DEFINES = CONNECTIONS=3,WITH_LOGGING,WITH_CLIENT,WITH_DNS,MTU_SIZE=1000

View File

@ -1 +1 @@
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS
DEFINES = CONNECTIONS=3,WITH_LOGGING,WITH_CLIENT,WITH_DNS

View File

@ -1 +1 @@
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_PFS,CONNECTIONS=2,MTU_SIZE=500
DEFINES = WITH_LOGGING

View File

@ -1 +1 @@
DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_PFS
DEFINES = CONNECTIONS=3,WITH_LOGGING,WITH_CLIENT,WITH_DNS

View File

@ -48,21 +48,18 @@ PROCESS_THREAD(shell_init_process, ev, data)
{
PROCESS_BEGIN();
#ifdef __CC65__
shell_ps_init();
shell_netstat_init();
shell_wget_init();
shell_memdebug_init();
#else /* __CC65__ */
shell_file_init();
#ifndef __CC65__
shell_httpd_init();
shell_irc_init();
shell_ps_init();
shell_run_init();
shell_text_init();
shell_time_init();
#endif /* !__CC65__ */
#ifndef __C128__
shell_wget_init();
#endif /* __CC65__ */
#endif /* !__C128__ */
PROCESS_END();
}

View File

@ -31,7 +31,7 @@
# Author: Oliver Schmidt <ol.sc@web.de>
#
CONTIKI_TARGET_SOURCEFILES += pfs.S pfs_write.S
CONTIKI_TARGET_SOURCEFILES += lseek.c pfs.S pfs_write.S
CONTIKI_CPU = $(CONTIKI)/cpu/6502
include $(CONTIKI_CPU)/Makefile.6502

43
platform/c128/lib/lseek.c Normal file
View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2007, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* Author: Oliver Schmidt <ol.sc@web.de>
*
*/
#include <unistd.h>
/*-----------------------------------------------------------------------------------*/
off_t
__fastcall__ lseek(int fd, off_t offset, int whence)
{
return (off_t)-1;
}
/*-----------------------------------------------------------------------------------*/

View File

@ -31,7 +31,7 @@
# Author: Oliver Schmidt <ol.sc@web.de>
#
CONTIKI_TARGET_SOURCEFILES += pfs.S pfs_write.S
CONTIKI_TARGET_SOURCEFILES += lseek.c pfs.S pfs_write.S
CONTIKI_CPU = $(CONTIKI)/cpu/6502
include $(CONTIKI_CPU)/Makefile.6502

43
platform/c64/lib/lseek.c Normal file
View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2007, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* Author: Oliver Schmidt <ol.sc@web.de>
*
*/
#include <unistd.h>
/*-----------------------------------------------------------------------------------*/
off_t
__fastcall__ lseek(int fd, off_t offset, int whence)
{
return (off_t)-1;
}
/*-----------------------------------------------------------------------------------*/