From: John Hodge Date: Tue, 5 Mar 2013 07:46:15 +0000 (+0800) Subject: Merge branch 'master' of git://localhost/acess2 X-Git-Tag: rel0.15~537 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=d974878ee8bdb568b6c13219495dcfba35e57eaf;hp=f8113d738b083dccf19a7253dbc4debcd6489696;p=tpg%2Facess2.git Merge branch 'master' of git://localhost/acess2 --- diff --git a/.gitignore b/.gitignore index 0f847b63..fb452775 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ serial.txt SrcDoc/ APIDoc/ Usermode/Output/ +Usermode/include gitstats/ .*.swp .* diff --git a/KernelLand/Kernel/libc.c b/KernelLand/Kernel/libc.c index a16687e4..751497cd 100644 --- a/KernelLand/Kernel/libc.c +++ b/KernelLand/Kernel/libc.c @@ -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) { diff --git a/KernelLand/Kernel/vfs/io.c b/KernelLand/Kernel/vfs/io.c index dc55fe2a..1df34034 100644 --- a/KernelLand/Kernel/vfs/io.c +++ b/KernelLand/Kernel/vfs/io.c @@ -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; } diff --git a/Usermode/Applications/init_src/main.c b/Usermode/Applications/init_src/main.c index a3d737d9..0dbbff14 100644 --- a/Usermode/Applications/init_src/main.c +++ b/Usermode/Applications/init_src/main.c @@ -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; } diff --git a/Usermode/Libraries/libc.so_src/include_exp/stdio.h b/Usermode/Libraries/libc.so_src/include_exp/stdio.h index 074cd254..646844ee 100644 --- a/Usermode/Libraries/libc.so_src/include_exp/stdio.h +++ b/Usermode/Libraries/libc.so_src/include_exp/stdio.h @@ -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