Tab chars (0x9) was replaced with spaces
This commit is contained in:
@@ -54,7 +54,7 @@ status_t beos_unlock(int file_handle)
|
||||
port_id pid = 0;
|
||||
status_t status = look_for_port(file_handle, false, &pid);
|
||||
if(status == B_BUSY)
|
||||
status = delete_port(pid);
|
||||
status = delete_port(pid);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@@ -32,14 +32,14 @@ can be used for any purposes in any form without any warranties.
|
||||
sprintf(name, "FidoLock:%08X:%08X", stat_info.st_dev, stat_info.st_ino);
|
||||
|
||||
3) Look for existing port with this name:
|
||||
|
||||
|
||||
pid = find_port(name);
|
||||
if(pid == B_NAME_NOT_FOUND)
|
||||
{
|
||||
|
||||
4) Create such port.
|
||||
|
||||
pid = create_port(1, name);
|
||||
pid = create_port(1, name);
|
||||
|
||||
}
|
||||
else
|
||||
|
@@ -81,7 +81,7 @@ extern __inline__ int isxalnum(char c) {
|
||||
* It's also not possible to use setlocale() to change it's behaviour. =-(
|
||||
*/
|
||||
#undef iscntrl
|
||||
# define iscntrl(c) ((c < 0x7f) ? __isctype((c), _IScntrl) : 0)
|
||||
# define iscntrl(c) ((c < 0x7f) ? __isctype((c), _IScntrl) : 0)
|
||||
#endif /* __BEOS__ */
|
||||
|
||||
/* --------------------------------------------------------------- */
|
||||
|
@@ -55,7 +55,7 @@ gdirentry::~gdirentry()
|
||||
|
||||
gposixdir::gposixdir() : dirname(), ret(), entries()
|
||||
{
|
||||
ok = false;
|
||||
ok = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ gposixdir::gposixdir() : dirname(), ret(), entries()
|
||||
|
||||
gposixdir::gposixdir(const char *name) : dirname(), ret(), entries()
|
||||
{
|
||||
cd(name);
|
||||
cd(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,73 +79,73 @@ gposixdir::~gposixdir()
|
||||
#ifndef _MSC_VER
|
||||
void gposixdir::cd(const char *name, bool relative)
|
||||
{
|
||||
std::string ndirname;
|
||||
if(not *name)
|
||||
name = ".";
|
||||
if(relative) {
|
||||
dirname += "/";
|
||||
dirname += name;
|
||||
} else
|
||||
dirname = name;
|
||||
ok = maketruepath(dirname);
|
||||
entries.clear();
|
||||
DIR *d = opendir(dirname.c_str());
|
||||
if(d == NULL)
|
||||
ok = false;
|
||||
else {
|
||||
struct dirent *de;
|
||||
while((de=readdir(d)) != NULL) {
|
||||
ndirname = de->d_name;
|
||||
std::string ndirname;
|
||||
if(not *name)
|
||||
name = ".";
|
||||
if(relative) {
|
||||
dirname += "/";
|
||||
dirname += name;
|
||||
} else
|
||||
dirname = name;
|
||||
ok = maketruepath(dirname);
|
||||
entries.clear();
|
||||
DIR *d = opendir(dirname.c_str());
|
||||
if(d == NULL)
|
||||
ok = false;
|
||||
else {
|
||||
struct dirent *de;
|
||||
while((de=readdir(d)) != NULL) {
|
||||
ndirname = de->d_name;
|
||||
#ifdef __HAVE_DRIVES__
|
||||
if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/")))
|
||||
if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/")))
|
||||
#else
|
||||
if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/")))
|
||||
if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/")))
|
||||
#endif
|
||||
entries.push_back(ndirname);
|
||||
}
|
||||
closedir(d);
|
||||
rewind();
|
||||
}
|
||||
entries.push_back(ndirname);
|
||||
}
|
||||
closedir(d);
|
||||
rewind();
|
||||
}
|
||||
}
|
||||
#else
|
||||
void gposixdir::cd(const char *name, bool relative)
|
||||
{
|
||||
std::string ndirname;
|
||||
if(not *name)
|
||||
name = ".";
|
||||
if(relative) {
|
||||
dirname += "/";
|
||||
dirname += name;
|
||||
} else
|
||||
dirname = name;
|
||||
ok = maketruepath(dirname);
|
||||
entries.clear();
|
||||
ndirname = dirname;
|
||||
if ((ndirname.end() > ndirname.begin()) && (*(ndirname.end()-1) == '/'))
|
||||
ndirname += "*";
|
||||
else
|
||||
ndirname += "/*";
|
||||
struct _finddata_t de;
|
||||
long d = _findfirst(ndirname.c_str(), &de);
|
||||
if(d == -1) {
|
||||
if(is_dir(dirname))
|
||||
ok = true;
|
||||
else
|
||||
ok = false;
|
||||
}
|
||||
else {
|
||||
do {
|
||||
ndirname = de.name;
|
||||
std::string ndirname;
|
||||
if(not *name)
|
||||
name = ".";
|
||||
if(relative) {
|
||||
dirname += "/";
|
||||
dirname += name;
|
||||
} else
|
||||
dirname = name;
|
||||
ok = maketruepath(dirname);
|
||||
entries.clear();
|
||||
ndirname = dirname;
|
||||
if ((ndirname.end() > ndirname.begin()) && (*(ndirname.end()-1) == '/'))
|
||||
ndirname += "*";
|
||||
else
|
||||
ndirname += "/*";
|
||||
struct _finddata_t de;
|
||||
long d = _findfirst(ndirname.c_str(), &de);
|
||||
if(d == -1) {
|
||||
if(is_dir(dirname))
|
||||
ok = true;
|
||||
else
|
||||
ok = false;
|
||||
}
|
||||
else {
|
||||
do {
|
||||
ndirname = de.name;
|
||||
#ifdef __HAVE_DRIVES__
|
||||
if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/")))
|
||||
if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/")))
|
||||
#else
|
||||
if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/")))
|
||||
if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/")))
|
||||
#endif
|
||||
entries.push_back(ndirname);
|
||||
} while(_findnext(d, &de) == 0);
|
||||
_findclose(d);
|
||||
rewind();
|
||||
}
|
||||
entries.push_back(ndirname);
|
||||
} while(_findnext(d, &de) == 0);
|
||||
_findclose(d);
|
||||
rewind();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -153,26 +153,26 @@ void gposixdir::cd(const char *name, bool relative)
|
||||
|
||||
const gdirentry *gposixdir::nextentry(const char *mask, bool nameonly)
|
||||
{
|
||||
while(last_entry < entries.size()) {
|
||||
if(mask and not gwildmat(entries[last_entry].c_str(), mask)) {
|
||||
++last_entry;
|
||||
continue;
|
||||
}
|
||||
ret.name = entries[last_entry];
|
||||
ret.dirname = dirname.c_str();
|
||||
if(not nameonly) {
|
||||
std::string pn = ret.dirname;
|
||||
pn += "/";
|
||||
pn += ret.name;
|
||||
size_t skipfrom;
|
||||
while((skipfrom=pn.find("//")) != pn.npos)
|
||||
pn.erase(skipfrom, 1);
|
||||
stat(pn.c_str(), &ret.stat_info);
|
||||
}
|
||||
++last_entry;
|
||||
return &ret;
|
||||
}
|
||||
return NULL;
|
||||
while(last_entry < entries.size()) {
|
||||
if(mask and not gwildmat(entries[last_entry].c_str(), mask)) {
|
||||
++last_entry;
|
||||
continue;
|
||||
}
|
||||
ret.name = entries[last_entry];
|
||||
ret.dirname = dirname.c_str();
|
||||
if(not nameonly) {
|
||||
std::string pn = ret.dirname;
|
||||
pn += "/";
|
||||
pn += ret.name;
|
||||
size_t skipfrom;
|
||||
while((skipfrom=pn.find("//")) != pn.npos)
|
||||
pn.erase(skipfrom, 1);
|
||||
stat(pn.c_str(), &ret.stat_info);
|
||||
}
|
||||
++last_entry;
|
||||
return &ret;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -39,13 +39,13 @@
|
||||
class gdirentry {
|
||||
|
||||
public:
|
||||
std::string name;
|
||||
struct stat stat_info;
|
||||
const char *dirname;
|
||||
gdirentry();
|
||||
~gdirentry();
|
||||
bool is_directory() const { return S_ISDIR(stat_info.st_mode); }
|
||||
bool is_file() const { return S_ISREG(stat_info.st_mode); }
|
||||
std::string name;
|
||||
struct stat stat_info;
|
||||
const char *dirname;
|
||||
gdirentry();
|
||||
~gdirentry();
|
||||
bool is_directory() const { return S_ISDIR(stat_info.st_mode); }
|
||||
bool is_file() const { return S_ISREG(stat_info.st_mode); }
|
||||
};
|
||||
|
||||
|
||||
@@ -54,20 +54,20 @@ public:
|
||||
class gposixdir {
|
||||
|
||||
private:
|
||||
std::string dirname;
|
||||
gdirentry ret;
|
||||
gstrarray entries;
|
||||
uint32_t last_entry;
|
||||
std::string dirname;
|
||||
gdirentry ret;
|
||||
gstrarray entries;
|
||||
uint32_t last_entry;
|
||||
|
||||
public:
|
||||
bool ok;
|
||||
gposixdir();
|
||||
gposixdir(const char *name);
|
||||
~gposixdir();
|
||||
void cd(const char *name, bool relative=false);
|
||||
inline void rewind() { last_entry = 0; }
|
||||
const gdirentry *nextentry(const char *mask=NULL, bool nameonly=false);
|
||||
inline const char *fullpath() { return dirname.c_str(); }
|
||||
bool ok;
|
||||
gposixdir();
|
||||
gposixdir(const char *name);
|
||||
~gposixdir();
|
||||
void cd(const char *name, bool relative=false);
|
||||
inline void rewind() { last_entry = 0; }
|
||||
const gdirentry *nextentry(const char *mask=NULL, bool nameonly=false);
|
||||
inline const char *fullpath() { return dirname.c_str(); }
|
||||
};
|
||||
|
||||
|
||||
|
@@ -40,10 +40,10 @@
|
||||
#undef SH_COMPAT
|
||||
#endif
|
||||
#elif !defined(SH_DENYNO)
|
||||
#define SH_DENYRW 0x10 // Deny read/write
|
||||
#define SH_DENYWR 0x20 // Deny write
|
||||
#define SH_DENYRD 0x30 // Deny read
|
||||
#define SH_DENYNO 0x40 // Deny nothing
|
||||
#define SH_DENYRW 0x10 // Deny read/write
|
||||
#define SH_DENYWR 0x20 // Deny write
|
||||
#define SH_DENYRD 0x30 // Deny read
|
||||
#define SH_DENYNO 0x40 // Deny nothing
|
||||
#endif
|
||||
|
||||
#ifndef SH_COMPAT
|
||||
|
@@ -45,15 +45,15 @@ typedef std::vector<std::string> gstrarray;
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
inline void tokenize(gstrarray& array, const char* str, const char* delim = NULL) {
|
||||
if(delim == NULL)
|
||||
delim = ", \t";
|
||||
char* tmp = throw_xstrdup(str);
|
||||
char* token = strtok(tmp, delim);
|
||||
while(token) {
|
||||
array.push_back(token);
|
||||
token = strtok(NULL, delim);
|
||||
}
|
||||
throw_xfree(tmp);
|
||||
if(delim == NULL)
|
||||
delim = ", \t";
|
||||
char* tmp = throw_xstrdup(str);
|
||||
char* token = strtok(tmp, delim);
|
||||
while(token) {
|
||||
array.push_back(token);
|
||||
token = strtok(NULL, delim);
|
||||
}
|
||||
throw_xfree(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -299,60 +299,60 @@ char *gcpuid(char *_cpuname)
|
||||
|
||||
/* Step 1. Try to toggle alignment check flag; does not exist on 386. */
|
||||
"pushfl\n\t"
|
||||
"popl %%eax\n\t"
|
||||
"movl %%eax,%%ecx\n\t"
|
||||
"orl $0x00040000,%%eax\n\t" /* sets a alignment check flag */
|
||||
"pushl %%eax\n\t"
|
||||
"popl %%eax\n\t"
|
||||
"movl %%eax,%%ecx\n\t"
|
||||
"orl $0x00040000,%%eax\n\t" /* sets a alignment check flag */
|
||||
"pushl %%eax\n\t"
|
||||
"popfl\n\t"
|
||||
"pushfl\n\t"
|
||||
"popl %%eax\n\t"
|
||||
"xorl %%ecx,%%eax\n\t"
|
||||
"andl $0x00040000,%%eax\n\t" /* test alignment check flag */
|
||||
"pushl %%ecx\n\t"
|
||||
"popl %%eax\n\t"
|
||||
"xorl %%ecx,%%eax\n\t"
|
||||
"andl $0x00040000,%%eax\n\t" /* test alignment check flag */
|
||||
"pushl %%ecx\n\t"
|
||||
"popfl\n\t"
|
||||
|
||||
"testl %%eax,%%eax\n\t" /* alignment check flag is set? */
|
||||
"jnz try486\n\t"
|
||||
"testl %%eax,%%eax\n\t" /* alignment check flag is set? */
|
||||
"jnz try486\n\t"
|
||||
|
||||
/* NexGen CPU does not have aligment check flag. */
|
||||
"pushfl\n\t"
|
||||
"movl $0x5555, %%eax\n\t"
|
||||
"xorl %%edx, %%edx\n\t"
|
||||
"movl $2, %%ecx\n\t"
|
||||
"movl $0x5555, %%eax\n\t"
|
||||
"xorl %%edx, %%edx\n\t"
|
||||
"movl $2, %%ecx\n\t"
|
||||
"clc\n\t"
|
||||
"divl %%ecx\n\t"
|
||||
"jz nexgen\n\t"
|
||||
"divl %%ecx\n\t"
|
||||
"jz nexgen\n\t"
|
||||
"popfl\n\t"
|
||||
"movl $3,%0\n\t" /* CPU 386 */
|
||||
"jmp end\n"
|
||||
"movl $3,%0\n\t" /* CPU 386 */
|
||||
"jmp end\n"
|
||||
|
||||
"nexgen:"
|
||||
"popfl\n\t"
|
||||
"movl $5,%0\n\t" /* CPU NX586 */
|
||||
"movl $0x4778654e,%1\n\t" /* store vendor string */
|
||||
"movl $0x72446e65,%1+4\n\t" /* "NexGenDriven" */
|
||||
"movl $0x6e657669,%1+8\n\t"
|
||||
// "movl $0,%1+12\n\t" // vendor is zero-filled already
|
||||
"jmp end\n"
|
||||
"movl $5,%0\n\t" /* CPU NX586 */
|
||||
"movl $0x4778654e,%1\n\t" /* store vendor string */
|
||||
"movl $0x72446e65,%1+4\n\t" /* "NexGenDriven" */
|
||||
"movl $0x6e657669,%1+8\n\t"
|
||||
// "movl $0,%1+12\n\t" // vendor is zero-filled already
|
||||
"jmp end\n"
|
||||
|
||||
/* Step2. Try to toggle identification flag; does not exist on early 486s.*/
|
||||
"try486:"
|
||||
"pushfl\n\t"
|
||||
"popl %%eax\n\t"
|
||||
"movl %%eax,%%ecx\n\t"
|
||||
"xorl $0x00200000,%%eax\n\t" /* sets a identification bit */
|
||||
"pushl %%eax\n\t"
|
||||
"popl %%eax\n\t"
|
||||
"movl %%eax,%%ecx\n\t"
|
||||
"xorl $0x00200000,%%eax\n\t" /* sets a identification bit */
|
||||
"pushl %%eax\n\t"
|
||||
"popfl\n\t"
|
||||
"pushfl\n\t"
|
||||
"popl %%eax\n\t"
|
||||
"xorl %%ecx,%%eax\n\t"
|
||||
"andl $0x00200000,%%eax\n\t" /* test identification bit */
|
||||
"pushl %%ecx\n\t"
|
||||
"popl %%eax\n\t"
|
||||
"xorl %%ecx,%%eax\n\t"
|
||||
"andl $0x00200000,%%eax\n\t" /* test identification bit */
|
||||
"pushl %%ecx\n\t"
|
||||
"popfl\n\t"
|
||||
|
||||
"testl %%eax,%%eax\n\t" /* if identification flag is set then cpuid CPU's command may be used */
|
||||
"jnz trycpuid\n\t"
|
||||
"movl $4,%0\n\t" /* CPU 486 */
|
||||
"testl %%eax,%%eax\n\t" /* if identification flag is set then cpuid CPU's command may be used */
|
||||
"jnz trycpuid\n\t"
|
||||
"movl $4,%0\n\t" /* CPU 486 */
|
||||
|
||||
/*
|
||||
* Check Cyrix CPU
|
||||
@@ -362,14 +362,14 @@ char *gcpuid(char *_cpuname)
|
||||
* Note: CPUID is enabled on M2, so it passes another way.
|
||||
*/
|
||||
"pushfl\n\t"
|
||||
"movl $0x5555, %%eax\n\t"
|
||||
"xorl %%edx, %%edx\n\t"
|
||||
"movl $2, %%ecx\n\t"
|
||||
"movl $0x5555, %%eax\n\t"
|
||||
"xorl %%edx, %%edx\n\t"
|
||||
"movl $2, %%ecx\n\t"
|
||||
"clc\n\t"
|
||||
"divl %%ecx\n\t"
|
||||
"jnc trycyrix\n\t"
|
||||
"divl %%ecx\n\t"
|
||||
"jnc trycyrix\n\t"
|
||||
"popfl\n\t"
|
||||
"jmp end\n" /* You may use Intel CPU */
|
||||
"jmp end\n" /* You may use Intel CPU */
|
||||
|
||||
"trycyrix:"
|
||||
"popfl\n\t"
|
||||
@@ -379,44 +379,44 @@ char *gcpuid(char *_cpuname)
|
||||
* CPU, we couldn't distinguish it from Cyrix's (including IBM
|
||||
* brand of Cyrix CPUs).
|
||||
*/
|
||||
"movl $0x69727943,%1\n\t" /* store vendor string */
|
||||
"movl $0x736e4978,%1+4\n\t" /* "CyrixInstead" */
|
||||
"movl $0x64616574,%1+8\n\t"
|
||||
"jmp end\n"
|
||||
"movl $0x69727943,%1\n\t" /* store vendor string */
|
||||
"movl $0x736e4978,%1+4\n\t" /* "CyrixInstead" */
|
||||
"movl $0x64616574,%1+8\n\t"
|
||||
"jmp end\n"
|
||||
|
||||
/* Step 3. Use the `cpuid' instruction. */
|
||||
"trycpuid:"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
".byte 0x0f,0xa2\n\t" /* cpuid 0 */
|
||||
"movl %%eax,%2\n\t" /* "cpuid 1" capability */
|
||||
"movl %%ebx,%1\n\t" /* store vendor string */
|
||||
"movl %%edx,%1+4\n\t"
|
||||
"movl %%ecx,%1+8\n\t"
|
||||
// "movb $0,%1+12\n\t" // vendor is zero-filled already
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
".byte 0x0f,0xa2\n\t" /* cpuid 0 */
|
||||
"movl %%eax,%2\n\t" /* "cpuid 1" capability */
|
||||
"movl %%ebx,%1\n\t" /* store vendor string */
|
||||
"movl %%edx,%1+4\n\t"
|
||||
"movl %%ecx,%1+8\n\t"
|
||||
// "movb $0,%1+12\n\t" // vendor is zero-filled already
|
||||
|
||||
"andl %%eax,%%eax\n\t" /* "cpuid 1" is allowed? (eax==1?) */
|
||||
"jz i586\n\t" /* no, skip "cpuid 1" */
|
||||
|
||||
"movl $1,%%eax\n\t"
|
||||
".byte 0x0f,0xa2\n\t" // cpuid 1
|
||||
// "movl %%eax,%6\n\t" // store cpu_id
|
||||
// "movl %%edx,%7\n\t" // store cpu_feature
|
||||
"movl $1,%%eax\n\t"
|
||||
".byte 0x0f,0xa2\n\t" // cpuid 1
|
||||
// "movl %%eax,%6\n\t" // store cpu_id
|
||||
// "movl %%edx,%7\n\t" // store cpu_feature
|
||||
|
||||
"movb %%al,%%bl\n\t"
|
||||
"shrb $4,%%bl\n\t" // extract CPU model
|
||||
"movb %%bl,%4\n\t" // store model
|
||||
"movb %%al,%%bl\n\t"
|
||||
"shrb $4,%%bl\n\t" // extract CPU model
|
||||
"movb %%bl,%4\n\t" // store model
|
||||
|
||||
"andl $0x0F0F,%%eax\n\t" // extract CPU family type and stepping
|
||||
"movb %%al,%5\n\t" // store stepping
|
||||
"movb %%ah,%3\n\t" // store family
|
||||
"cmpb $5,%%ah\n\t"
|
||||
"jae i586\n\t"
|
||||
"andl $0x0F0F,%%eax\n\t" // extract CPU family type and stepping
|
||||
"movb %%al,%5\n\t" // store stepping
|
||||
"movb %%ah,%3\n\t" // store family
|
||||
"cmpb $5,%%ah\n\t"
|
||||
"jae i586\n\t"
|
||||
|
||||
/* less than Pentium; must be 486 */
|
||||
"movl $4,%0\n\t" /* CPU 486 */
|
||||
"jmp end\n"
|
||||
"movl $4,%0\n\t" /* CPU 486 */
|
||||
"jmp end\n"
|
||||
"i586:\n\t" /* Pentium and greater. Store family type into CPU type var */
|
||||
"movb %%ah,%0\n"
|
||||
"movb %%ah,%0\n"
|
||||
"end:\n\t"
|
||||
"nop\n\t"
|
||||
|
||||
|
Reference in New Issue
Block a user