mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=10973
This commit is contained in:
parent
20dea204ca
commit
121043ac9f
|
@ -9149,3 +9149,17 @@ David 22 Aug 2006
|
|||
client_types.C,h
|
||||
cpu_sched.C
|
||||
cs_apps.C
|
||||
|
||||
David 22 Aug 2006
|
||||
- change XML_PARSER to take a MIOFILE* instead of a FILE*.
|
||||
This allows it to be used anywhere in BOINC.
|
||||
|
||||
client/
|
||||
log_flags.C
|
||||
lib/
|
||||
miofile.C,h
|
||||
parse.C,h
|
||||
sched/
|
||||
sched_config.C
|
||||
sea/
|
||||
insecure.sh
|
||||
|
|
|
@ -132,9 +132,11 @@ int CONFIG::parse_options(XML_PARSER& xp) {
|
|||
|
||||
int CONFIG::parse(FILE* f) {
|
||||
char tag[256];
|
||||
XML_PARSER xp(f);
|
||||
MIOFILE mf;
|
||||
XML_PARSER xp(&mf);
|
||||
bool is_tag;
|
||||
|
||||
mf.init_file(f);
|
||||
if (!xp.parse_start("cc_config")) return ERR_XML_PARSE;
|
||||
while (!xp.get(tag, is_tag)) {
|
||||
if (!is_tag) {
|
||||
|
|
|
@ -87,6 +87,15 @@ char* MIOFILE::fgets(char* dst, int len) {
|
|||
return dst;
|
||||
}
|
||||
|
||||
int MIOFILE::ungetc(int c) {
|
||||
if (f) {
|
||||
return ::ungetc(c, f);
|
||||
}
|
||||
buf--;
|
||||
*buf = c;
|
||||
return c;
|
||||
}
|
||||
|
||||
// copy from a file to static buffer
|
||||
//
|
||||
int copy_element_contents(MIOFILE& in, const char* end_tag, char* p, int len) {
|
||||
|
|
|
@ -50,6 +50,11 @@ public:
|
|||
void init_buf(char*);
|
||||
int printf(const char* format, ...);
|
||||
char* fgets(char*, int);
|
||||
int ungetc(int);
|
||||
inline int getc() {
|
||||
if (f) return ::getc(f);
|
||||
return (*buf)?(*buf++):EOF;
|
||||
}
|
||||
private:
|
||||
MFILE* mf;
|
||||
FILE* f;
|
||||
|
|
10
lib/parse.C
10
lib/parse.C
|
@ -407,7 +407,7 @@ int skip_unrecognized(char* buf, FILE* in) {
|
|||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
||||
XML_PARSER::XML_PARSER(FILE* _f) {
|
||||
XML_PARSER::XML_PARSER(MIOFILE* _f) {
|
||||
f = _f;
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ XML_PARSER::XML_PARSER(FILE* _f) {
|
|||
bool XML_PARSER::scan_nonws(int& first_char) {
|
||||
int c;
|
||||
while (1) {
|
||||
c = getc(f);
|
||||
c = f->getc();
|
||||
if (c == EOF) return true;
|
||||
if (isspace(c)) continue;
|
||||
first_char = c;
|
||||
|
@ -433,7 +433,7 @@ bool XML_PARSER::scan_nonws(int& first_char) {
|
|||
bool XML_PARSER::scan_tag(char* buf) {
|
||||
int c;
|
||||
while (1) {
|
||||
c = getc(f);
|
||||
c = f->getc();
|
||||
if (c == EOF) return true;
|
||||
if (c == '>') {
|
||||
*buf = 0;
|
||||
|
@ -450,10 +450,10 @@ bool XML_PARSER::scan_tag(char* buf) {
|
|||
bool XML_PARSER::copy_until_tag(char* buf) {
|
||||
int c;
|
||||
while (1) {
|
||||
c = getc(f);
|
||||
c = f->getc();
|
||||
if (c == EOF) return true;
|
||||
if (c == '<') {
|
||||
ungetc(c, f);
|
||||
f->ungetc(c);
|
||||
*buf = 0;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -33,13 +33,15 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include "miofile.h"
|
||||
|
||||
class XML_PARSER {
|
||||
FILE* f;
|
||||
MIOFILE* f;
|
||||
bool scan_nonws(int&);
|
||||
bool scan_tag(char*);
|
||||
bool copy_until_tag(char*);
|
||||
public:
|
||||
XML_PARSER(FILE*);
|
||||
XML_PARSER(MIOFILE*);
|
||||
bool get(char*, bool&);
|
||||
bool parse_start(char*);
|
||||
bool parse_str(char*, char*, char*);
|
||||
|
|
|
@ -37,9 +37,11 @@ const char* CONFIG_FILE = "config.xml";
|
|||
|
||||
int SCHED_CONFIG::parse(FILE* f) {
|
||||
char tag[1024], temp[1024];
|
||||
XML_PARSER xp(f);
|
||||
bool is_tag;
|
||||
MIOFILE mf;
|
||||
XML_PARSER xp(&mf);
|
||||
|
||||
mf.init_file(f);
|
||||
memset(this, 0, sizeof(SCHED_CONFIG));
|
||||
max_wus_to_send = 10;
|
||||
default_disk_max_used_gb = 100.;
|
||||
|
|
|
@ -53,16 +53,17 @@ else
|
|||
exit
|
||||
fi
|
||||
|
||||
# If the user forgets to cd to the boinc data directory, this script can do serious damage
|
||||
# If the user forgets to cd to the boinc data directory,
|
||||
# this script can do serious damage
|
||||
# so show the directory we are about to modify
|
||||
echo "Changing directory $(pwd) file ownership to user $user and group $group - OK? (y/n)"
|
||||
echo "Changing directory $(pwd) ownership to user $user and group $group - OK? (y/n)"
|
||||
read line
|
||||
if [ "$line" != "y" ]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
# if the booinc client is not here, assume it is the wrong directory
|
||||
# if the boinc client is not here, assume it is the wrong directory
|
||||
if [ ! -f "boinc_client" ]
|
||||
then
|
||||
echo "Can't find boinc_client in directory $(pwd); exiting"
|
||||
|
|
Loading…
Reference in New Issue