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) {
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;
}
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;
}
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;
}
// 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});
retstr[pos++] = ch;
}
}
- retstr[pos] = '\0';
+ if( retstr )
+ retstr[pos] = '\0';
return retstr;
}
}
ret[pos++] = arg;
} while(arg != NULL);
+
+ if( pos == 0 )
+ {
+ free(ret);
+ return NULL;
+ }
ret[pos] = NULL;
return ret;
}
int ProcessInittab(const char *Path)
{
+ int line_num = 0;
FILE *fp = fopen(Path, "r");
if( !fp )
{
char cmdbuf[64+1];
+ line_num ++;
+
int rv;
if( (rv = fscanf(fp, "%64s%*[ \t]", &cmdbuf)) != 1 ) {
_SysDebug("fscanf rv %i != exp 1", rv);
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;
}