Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9147f8b5
Commit
9147f8b5
authored
Feb 28, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portability fixes
parent
050543bd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
22 deletions
+53
-22
cmd-line-utils/libedit/readline.c
cmd-line-utils/libedit/readline.c
+2
-2
include/my_global.h
include/my_global.h
+1
-1
include/my_xml.h
include/my_xml.h
+16
-10
strings/xml.c
strings/xml.c
+34
-9
No files found.
cmd-line-utils/libedit/readline.c
View file @
9147f8b5
...
@@ -1239,7 +1239,7 @@ filename_completion_function(const char *text, int state)
...
@@ -1239,7 +1239,7 @@ filename_completion_function(const char *text, int state)
/* otherwise, get first entry where first */
/* otherwise, get first entry where first */
/* filename_len characters are equal */
/* filename_len characters are equal */
if
(
entry
->
d_name
[
0
]
==
filename
[
0
]
if
(
entry
->
d_name
[
0
]
==
filename
[
0
]
#if
defined(__SVR4) || defined(__linux__)
#if
def HAVE_DIRENT_H
&&
strlen
(
entry
->
d_name
)
>=
filename_len
&&
strlen
(
entry
->
d_name
)
>=
filename_len
#else
#else
&&
entry
->
d_namlen
>=
filename_len
&&
entry
->
d_namlen
>=
filename_len
...
@@ -1252,7 +1252,7 @@ filename_completion_function(const char *text, int state)
...
@@ -1252,7 +1252,7 @@ filename_completion_function(const char *text, int state)
if
(
entry
)
{
/* match found */
if
(
entry
)
{
/* match found */
struct
stat
stbuf
;
struct
stat
stbuf
;
#if
defined(__SVR4) || defined(__linux__)
#if
def HAVE_DIRENT_H
len
=
strlen
(
entry
->
d_name
)
+
len
=
strlen
(
entry
->
d_name
)
+
#else
#else
len
=
entry
->
d_namlen
+
len
=
entry
->
d_namlen
+
...
...
include/my_global.h
View file @
9147f8b5
...
@@ -110,6 +110,7 @@
...
@@ -110,6 +110,7 @@
#define __STDC_EXT__ 1
/* To get large file support on hpux */
#define __STDC_EXT__ 1
/* To get large file support on hpux */
#endif
#endif
#ifdef HPUX11
/*
/*
Fix warnings on HPUX11
Fix warnings on HPUX11
There is something really strange with HPUX11 include files as you get
There is something really strange with HPUX11 include files as you get
...
@@ -121,7 +122,6 @@
...
@@ -121,7 +122,6 @@
#endif
#endif
/* Fix type of socklen as this is depending on the above define */
/* Fix type of socklen as this is depending on the above define */
#ifdef HPUX11
#undef SOCKET_SIZE_TYPE
#undef SOCKET_SIZE_TYPE
#ifdef _XOPEN_SOURCE_EXTENDED
#ifdef _XOPEN_SOURCE_EXTENDED
#define SOCKET_SIZE_TYPE socklen_t
#define SOCKET_SIZE_TYPE socklen_t
...
...
include/my_xml.h
View file @
9147f8b5
...
@@ -37,16 +37,22 @@ typedef struct xml_stack_st
...
@@ -37,16 +37,22 @@ typedef struct xml_stack_st
void
*
user_data
;
void
*
user_data
;
int
(
*
enter
)(
struct
xml_stack_st
*
st
,
const
char
*
val
,
uint
len
);
int
(
*
enter
)(
struct
xml_stack_st
*
st
,
const
char
*
val
,
uint
len
);
int
(
*
value
)(
struct
xml_stack_st
*
st
,
const
char
*
val
,
uint
len
);
int
(
*
value
)(
struct
xml_stack_st
*
st
,
const
char
*
val
,
uint
len
);
int
(
*
leave
)(
struct
xml_stack_st
*
st
,
const
char
*
val
,
uint
len
);
int
(
*
leave
_xml
)(
struct
xml_stack_st
*
st
,
const
char
*
val
,
uint
len
);
}
MY_XML_PARSER
;
}
MY_XML_PARSER
;
void
my_xml_parser_create
(
MY_XML_PARSER
*
st
);
void
my_xml_parser_create
(
MY_XML_PARSER
*
st
);
void
my_xml_parser_free
(
MY_XML_PARSER
*
st
);
void
my_xml_parser_free
(
MY_XML_PARSER
*
st
);
int
my_xml_parse
(
MY_XML_PARSER
*
st
,
const
char
*
str
,
uint
len
);
int
my_xml_parse
(
MY_XML_PARSER
*
st
,
const
char
*
str
,
uint
len
);
void
my_xml_set_value_handler
(
MY_XML_PARSER
*
st
,
int
(
*
)(
MY_XML_PARSER
*
,
const
char
*
,
uint
len
));
void
my_xml_set_value_handler
(
MY_XML_PARSER
*
st
,
int
(
*
)(
MY_XML_PARSER
*
,
void
my_xml_set_enter_handler
(
MY_XML_PARSER
*
st
,
int
(
*
)(
MY_XML_PARSER
*
,
const
char
*
,
uint
len
));
const
char
*
,
void
my_xml_set_leave_handler
(
MY_XML_PARSER
*
st
,
int
(
*
)(
MY_XML_PARSER
*
,
const
char
*
,
uint
len
));
uint
len
));
void
my_xml_set_enter_handler
(
MY_XML_PARSER
*
st
,
int
(
*
)(
MY_XML_PARSER
*
,
const
char
*
,
uint
len
));
void
my_xml_set_leave_handler
(
MY_XML_PARSER
*
st
,
int
(
*
)(
MY_XML_PARSER
*
,
const
char
*
,
uint
len
));
void
my_xml_set_user_data
(
MY_XML_PARSER
*
st
,
void
*
);
void
my_xml_set_user_data
(
MY_XML_PARSER
*
st
,
void
*
);
uint
my_xml_error_pos
(
MY_XML_PARSER
*
st
);
uint
my_xml_error_pos
(
MY_XML_PARSER
*
st
);
...
...
strings/xml.c
View file @
9147f8b5
...
@@ -37,6 +37,7 @@ typedef struct xml_attr_st
...
@@ -37,6 +37,7 @@ typedef struct xml_attr_st
const
char
*
end
;
const
char
*
end
;
}
MY_XML_ATTR
;
}
MY_XML_ATTR
;
static
const
char
*
lex2str
(
int
lex
)
static
const
char
*
lex2str
(
int
lex
)
{
{
switch
(
lex
)
switch
(
lex
)
...
@@ -97,7 +98,8 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a)
...
@@ -97,7 +98,8 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a)
else
if
(
(
p
->
cur
[
0
]
==
'"'
)
||
(
p
->
cur
[
0
]
==
'\''
)
)
else
if
(
(
p
->
cur
[
0
]
==
'"'
)
||
(
p
->
cur
[
0
]
==
'\''
)
)
{
{
p
->
cur
++
;
p
->
cur
++
;
for
(
;
(
p
->
cur
<
p
->
end
)
&&
(
p
->
cur
[
0
]
!=
a
->
beg
[
0
]);
p
->
cur
++
);
for
(
;
(
p
->
cur
<
p
->
end
)
&&
(
p
->
cur
[
0
]
!=
a
->
beg
[
0
]);
p
->
cur
++
)
{}
a
->
end
=
p
->
cur
;
a
->
end
=
p
->
cur
;
if
(
a
->
beg
[
0
]
==
p
->
cur
[
0
])
p
->
cur
++
;
if
(
a
->
beg
[
0
]
==
p
->
cur
[
0
])
p
->
cur
++
;
a
->
beg
++
;
a
->
beg
++
;
...
@@ -106,7 +108,10 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a)
...
@@ -106,7 +108,10 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a)
}
}
else
else
{
{
for
(
;
(
p
->
cur
<
p
->
end
)
&&
!
strchr
(
"?'
\"
=/<>
\t\r\n
"
,
p
->
cur
[
0
]);
p
->
cur
++
);
for
(;
(
p
->
cur
<
p
->
end
)
&&
!
strchr
(
"?'
\"
=/<>
\t\r\n
"
,
p
->
cur
[
0
]);
p
->
cur
++
)
{}
a
->
end
=
p
->
cur
;
a
->
end
=
p
->
cur
;
my_xml_norm_text
(
a
);
my_xml_norm_text
(
a
);
lex
=
MY_XML_IDENT
;
lex
=
MY_XML_IDENT
;
...
@@ -145,6 +150,7 @@ static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len)
...
@@ -145,6 +150,7 @@ static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len)
return
st
->
enter
?
st
->
enter
(
st
,
st
->
attr
,
st
->
attrend
-
st
->
attr
)
:
MY_XML_OK
;
return
st
->
enter
?
st
->
enter
(
st
,
st
->
attr
,
st
->
attrend
-
st
->
attr
)
:
MY_XML_OK
;
}
}
static
void
mstr
(
char
*
s
,
const
char
*
src
,
uint
l1
,
uint
l2
)
static
void
mstr
(
char
*
s
,
const
char
*
src
,
uint
l1
,
uint
l2
)
{
{
l1
=
l1
<
l2
?
l1
:
l2
;
l1
=
l1
<
l2
?
l1
:
l2
;
...
@@ -152,6 +158,7 @@ static void mstr(char *s,const char *src,uint l1, uint l2)
...
@@ -152,6 +158,7 @@ static void mstr(char *s,const char *src,uint l1, uint l2)
s
[
l1
]
=
'\0'
;
s
[
l1
]
=
'\0'
;
}
}
static
int
my_xml_leave
(
MY_XML_PARSER
*
p
,
const
char
*
str
,
uint
slen
)
static
int
my_xml_leave
(
MY_XML_PARSER
*
p
,
const
char
*
str
,
uint
slen
)
{
{
char
*
e
;
char
*
e
;
...
@@ -172,7 +179,7 @@ static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen)
...
@@ -172,7 +179,7 @@ static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen)
return
MY_XML_ERROR
;
return
MY_XML_ERROR
;
}
}
rc
=
p
->
leave
?
p
->
leave
(
p
,
p
->
attr
,
p
->
attrend
-
p
->
attr
)
:
MY_XML_OK
;
rc
=
p
->
leave
_xml
?
p
->
leave_xml
(
p
,
p
->
attr
,
p
->
attrend
-
p
->
attr
)
:
MY_XML_OK
;
*
e
=
'\0'
;
*
e
=
'\0'
;
p
->
attrend
=
e
;
p
->
attrend
=
e
;
...
@@ -237,7 +244,8 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
...
@@ -237,7 +244,8 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
}
}
else
else
{
{
sprintf
(
p
->
errstr
,
"3: %s unexpected (ident or '/' wanted)"
,
lex2str
(
lex
));
sprintf
(
p
->
errstr
,
"3: %s unexpected (ident or '/' wanted)"
,
lex2str
(
lex
));
return
MY_XML_ERROR
;
return
MY_XML_ERROR
;
}
}
...
@@ -256,7 +264,8 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
...
@@ -256,7 +264,8 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
}
}
else
else
{
{
sprintf
(
p
->
errstr
,
"4: %s unexpected (ident or string wanted)"
,
lex2str
(
lex
));
sprintf
(
p
->
errstr
,
"4: %s unexpected (ident or string wanted)"
,
lex2str
(
lex
));
return
MY_XML_ERROR
;
return
MY_XML_ERROR
;
}
}
}
}
...
@@ -318,35 +327,47 @@ gt:
...
@@ -318,35 +327,47 @@ gt:
return
MY_XML_OK
;
return
MY_XML_OK
;
}
}
void
my_xml_parser_create
(
MY_XML_PARSER
*
p
)
void
my_xml_parser_create
(
MY_XML_PARSER
*
p
)
{
{
bzero
((
void
*
)
p
,
sizeof
(
p
[
0
]));
bzero
((
void
*
)
p
,
sizeof
(
p
[
0
]));
}
}
void
my_xml_parser_free
(
MY_XML_PARSER
*
p
__attribute__
((
unused
)))
void
my_xml_parser_free
(
MY_XML_PARSER
*
p
__attribute__
((
unused
)))
{
{
}
}
void
my_xml_set_value_handler
(
MY_XML_PARSER
*
p
,
int
(
*
action
)(
MY_XML_PARSER
*
p
,
const
char
*
s
,
uint
l
))
void
my_xml_set_value_handler
(
MY_XML_PARSER
*
p
,
int
(
*
action
)(
MY_XML_PARSER
*
p
,
const
char
*
s
,
uint
l
))
{
{
p
->
value
=
action
;
p
->
value
=
action
;
}
}
void
my_xml_set_enter_handler
(
MY_XML_PARSER
*
p
,
int
(
*
action
)(
MY_XML_PARSER
*
p
,
const
char
*
s
,
uint
l
))
void
my_xml_set_enter_handler
(
MY_XML_PARSER
*
p
,
int
(
*
action
)(
MY_XML_PARSER
*
p
,
const
char
*
s
,
uint
l
))
{
{
p
->
enter
=
action
;
p
->
enter
=
action
;
}
}
void
my_xml_set_leave_handler
(
MY_XML_PARSER
*
p
,
int
(
*
action
)(
MY_XML_PARSER
*
p
,
const
char
*
s
,
uint
l
))
void
my_xml_set_leave_handler
(
MY_XML_PARSER
*
p
,
int
(
*
action
)(
MY_XML_PARSER
*
p
,
const
char
*
s
,
uint
l
))
{
{
p
->
leave
=
action
;
p
->
leave
_xml
=
action
;
}
}
void
my_xml_set_user_data
(
MY_XML_PARSER
*
p
,
void
*
user_data
)
void
my_xml_set_user_data
(
MY_XML_PARSER
*
p
,
void
*
user_data
)
{
{
p
->
user_data
=
user_data
;
p
->
user_data
=
user_data
;
}
}
const
char
*
my_xml_error_string
(
MY_XML_PARSER
*
p
)
const
char
*
my_xml_error_string
(
MY_XML_PARSER
*
p
)
{
{
return
p
->
errstr
;
return
p
->
errstr
;
...
@@ -358,8 +379,10 @@ uint my_xml_error_pos(MY_XML_PARSER *p)
...
@@ -358,8 +379,10 @@ uint my_xml_error_pos(MY_XML_PARSER *p)
const
char
*
beg
=
p
->
beg
;
const
char
*
beg
=
p
->
beg
;
const
char
*
s
;
const
char
*
s
;
for
(
s
=
p
->
beg
;
s
<
p
->
cur
;
s
++
)
for
(
s
=
p
->
beg
;
s
<
p
->
cur
;
s
++
)
{
if
(
s
[
0
]
==
'\n'
)
if
(
s
[
0
]
==
'\n'
)
beg
=
s
;
beg
=
s
;
}
return
p
->
cur
-
beg
;
return
p
->
cur
-
beg
;
}
}
...
@@ -368,7 +391,9 @@ uint my_xml_error_lineno(MY_XML_PARSER *p)
...
@@ -368,7 +391,9 @@ uint my_xml_error_lineno(MY_XML_PARSER *p)
uint
res
=
0
;
uint
res
=
0
;
const
char
*
s
;
const
char
*
s
;
for
(
s
=
p
->
beg
;
s
<
p
->
cur
;
s
++
)
for
(
s
=
p
->
beg
;
s
<
p
->
cur
;
s
++
)
{
if
(
s
[
0
]
==
'\n'
)
if
(
s
[
0
]
==
'\n'
)
res
++
;
res
++
;
}
return
res
;
return
res
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment