summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2011-02-01 21:22:22 +0000
committerOle Loots <ole@monochrom.net>2011-02-01 21:22:22 +0000
commit81e552f89e2a149c800b6b65038f9df65205dd4b (patch)
tree310c6f4099bb229771e266cc9e584db5a2802091
parentde0172dfa84712b79631bfe89be9d7286caf04ee (diff)
downloadnetsurf-81e552f89e2a149c800b6b65038f9df65205dd4b.tar.gz
netsurf-81e552f89e2a149c800b6b65038f9df65205dd4b.tar.bz2
Removed unused code
svn path=/trunk/netsurf/; revision=11586
-rw-r--r--atari/osspec.c90
-rw-r--r--atari/osspec.h2
2 files changed, 78 insertions, 14 deletions
diff --git a/atari/osspec.c b/atari/osspec.c
index 2975ce185..97b518757 100644
--- a/atari/osspec.c
+++ b/atari/osspec.c
@@ -1,5 +1,7 @@
#include <sys/types.h>
+#include <limits.h>
#include <stdlib.h>
+#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
@@ -10,20 +12,7 @@
#include "atari/osspec.h"
NS_ATARI_SYSINFO atari_sysinfo;
-/*
-short appl_xgetinfo( int16_t type, int16_t *out1, int16_t *out2,
- int16_t *out3, int16_t *out4 )
-{
- bool has_agi;
- has_agi = ((app.aes_global[0] == 0x399 && atari_sysinfo.gdosversion == 0x1900)
- || (app.aes_global[0] > 0x400)
- || ( appl_find("?AGI") >= 0));
- if(has_agi){
- return( mt_appl_getinfo( type, out1, out2, out3, out4, app.aes_global) );
- } else {
- return( 0 );
- }
-}*/
+
void init_os_info(void)
{
@@ -63,4 +52,77 @@ int tos_getcookie(long tag, long * value)
} while( (cptr++)->c != 0L );
}
return( C_NOTFOUND );
+}
+
+/* convert nonsense getcwd path (returned by mintlib getcwd on plain TOS) */
+void fix_path(char * path)
+{
+ char npath[PATH_MAX];
+ /* only apply fix to paths that contain /dev/ */
+ if( strlen(path) < 6 ){
+ return;
+ }
+ if( strncmp(path, "/dev/", 5) != 0 ) {
+ return;
+ }
+ strncpy((char*)&npath, path, PATH_MAX);
+ npath[0] = path[5];
+ npath[1] = ':';
+ npath[2] = 0;
+ strcat((char*)&npath, &path[6]);
+ strcpy(path, (char*)&npath);
+}
+
+/*
+ a fixed version of realpath() which returns valid
+ paths for TOS which have no root fs. (/ , U: )
+*/
+char * gdos_realpath(const char * path, char * rpath)
+{
+ size_t l;
+ size_t i;
+ char old;
+ char fsep = 0x5C;
+ if( rpath == NULL ){
+ return( NULL );
+ }
+ if( atari_sysinfo.gdosversion > TOS4VER ){
+ return( realpath(path, rpath) );
+ }
+
+ if( fsep == '/') {
+ /* replace '\' with / */
+ old = 0x5C; /* / */
+ } else {
+ /* replace '/' with \ */
+ old = '/';
+ }
+
+ if( path[0] != '/' && path[0] != 0x5c && path[1] != ':') {
+ /* it is not an absolute path */
+ char cwd[PATH_MAX];
+ getcwd((char*)&cwd, PATH_MAX);
+ fix_path((char*)&cwd);
+ strcpy(rpath, (char*)&cwd);
+ l = strlen(rpath);
+ if(rpath[l-1] != 0x5C && rpath[l-1] != '/') {
+ rpath[l] = fsep;
+ rpath[l+1] = 0;
+ }
+ if( (path[1] == '/' || path[1] == 0x5C ) ) {
+ strcat(rpath, &path[2]);
+ } else {
+ strcat(rpath, path);
+ }
+ } else {
+ strcpy(rpath, path);
+ }
+ /* convert path seperator to configured value: */
+ l = strlen(rpath);
+ for( i = 0; i<l-1; i++){
+ if( rpath[i] == old ){
+ rpath[i] = fsep;
+ }
+ }
+ return( rpath );
} \ No newline at end of file
diff --git a/atari/osspec.h b/atari/osspec.h
index 862dc9978..b6c8ea545 100644
--- a/atari/osspec.h
+++ b/atari/osspec.h
@@ -38,4 +38,6 @@ extern NS_ATARI_SYSINFO atari_sysinfo;
void init_os_info(void);
int tos_getcookie( long tag, long * value );
+void fix_path(char * path);
+char * gdos_realpath(const char * path, char * rpath);
#endif \ No newline at end of file