Merge branch 'master' of git://localhost/acess2
authorJohn Hodge <[email protected]>
Tue, 5 Mar 2013 07:46:15 +0000 (15:46 +0800)
committerJohn Hodge <[email protected]>
Tue, 5 Mar 2013 07:46:15 +0000 (15:46 +0800)
.gitignore
KernelLand/Kernel/libc.c
KernelLand/Kernel/vfs/io.c
Usermode/Applications/init_src/main.c
Usermode/Libraries/libc.so_src/include_exp/stdio.h

index 0f847b6..fb45277 100644 (file)
@@ -26,6 +26,7 @@ serial.txt
 SrcDoc/
 APIDoc/
 Usermode/Output/
+Usermode/include
 gitstats/
 .*.swp
 .*
index a16687e..751497c 100644 (file)
@@ -489,7 +489,7 @@ int isspace(int c)
 }
 int isupper(int c)
 {
-       return ('a' <= c && c <= 'z');
+       return ('A' <= c && c <= 'Z');
 }
 int isxdigit(int c)
 {
index dc55fe2..1df3403 100644 (file)
@@ -18,7 +18,7 @@ size_t VFS_Read(int FD, size_t Length, void *Buffer)
        tVFS_Handle     *h;
        size_t  ret;
        
-       ENTER("iFD XLength pBuffer", FD, Length, Buffer);
+       ENTER("xFD xLength pBuffer", FD, Length, Buffer);
        
        h = VFS_GetHandle(FD);
        if(!h) {
@@ -46,11 +46,12 @@ size_t VFS_Read(int FD, size_t Length, void *Buffer)
                LEAVE_RET('i', -1);
        }
        
+       LOG("Position=%llx", h->Position);
        ret = h->Node->Type->Read(h->Node, h->Position, Length, Buffer);
        if(ret == (size_t)-1)   LEAVE_RET('i', -1);
        
        h->Position += ret;
-       LEAVE('X', ret);
+       LEAVE('x', ret);
        return ret;
 }
 
@@ -170,11 +171,9 @@ int VFS_Seek(int FD, Sint64 Offset, int Whence)
        h = VFS_GetHandle(FD);
        if(!h)  return -1;
        
-       //Log_Debug("VFS", "VFS_Seek: (fd=0x%x, Offset=0x%llx, Whence=%i)",
-       //      FD, Offset, Whence);
-       
        // Set relative to current position
        if(Whence == 0) {
+               LOG("(FD%x)->Position += %lli", FD, Offset);
                h->Position += Offset;
                return 0;
        }
@@ -183,11 +182,13 @@ int VFS_Seek(int FD, Sint64 Offset, int Whence)
        if(Whence < 0) {
                if( h->Node->Size == (Uint64)-1 )       return -1;
 
+               LOG("(FD%x)->Position = %llx - %llx", FD, h->Node->Size, Offset);
                h->Position = h->Node->Size - Offset;
                return 0;
        }
        
        // Set relative to start of file
+       LOG("(FD%x)->Position = %llx", FD, Offset);
        h->Position = Offset;
        return 0;
 }
index a3d737d..0dbbff1 100644 (file)
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
                // No inittab file found, default to:
                _SysDebug("inittab '%s' is invalid, falling back to one VT", gsInittabPath);
                
-               #if 0
+               #if 1
                for( ;; )
                {
                        int pid = SpawnCommand(0, 1, 1, (char *[]){DEFAULT_SHELL, NULL});
@@ -157,7 +157,8 @@ char *ReadQuotedString(FILE *FP)
                        retstr[pos++] = ch;
                }
        }
-       retstr[pos] = '\0';
+       if( retstr )
+               retstr[pos] = '\0';
        return retstr;
 }
 
@@ -179,6 +180,12 @@ char **ReadCommand(FILE *FP)
                }
                ret[pos++] = arg;
        } while(arg != NULL);
+       
+       if( pos == 0 )
+       {
+               free(ret);
+               return NULL;
+       }
        ret[pos] = NULL;
        return ret;
 }
@@ -196,6 +203,7 @@ void FreeCommand(char **Command)
 
 int ProcessInittab(const char *Path)
 {
+        int    line_num = 0;
        FILE    *fp = fopen(Path, "r");
 
        if( !fp )
@@ -205,6 +213,8 @@ int ProcessInittab(const char *Path)
        {
                char cmdbuf[64+1];
                
+               line_num ++;
+
                 int    rv;
                if( (rv = fscanf(fp, "%64s%*[ \t]", &cmdbuf)) != 1 ) {
                        _SysDebug("fscanf rv %i != exp 1", rv);
@@ -290,13 +300,17 @@ int ProcessInittab(const char *Path)
                fscanf(fp, " ");
                continue;
        lineError:
-               _SysDebug("label lineError: goto'd");
+               _SysDebug("label lineError: goto'd - line %i, cmdbuf='%s'", line_num, cmdbuf);
                while( !feof(fp) && fgetc(fp) != '\n' )
                        ;
                continue ;
        }
 
        fclose(fp);
+
+       if( gpInitPrograms == NULL )
+               return 2;
+
        return 0;
 }
 
index 074cd25..646844e 100644 (file)
@@ -17,8 +17,8 @@ typedef struct sFILE  FILE;
 #define BUFSIZ 1024
 
 #ifndef SEEK_CUR
-#define SEEK_CUR       1
-#define SEEK_SET       0
+#define SEEK_CUR       0
+#define SEEK_SET       1
 #define SEEK_END       (-1)
 #endif
 

UCC git Repository :: git.ucc.asn.au