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
20e01ba3
Commit
20e01ba3
authored
Nov 06, 2001
by
jani@hynda.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added internal command \! to mysql client which can be used
to execute system commands within the client in UNIX.
parent
1dd8fd59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
client/mysql.cc
client/mysql.cc
+28
-2
No files found.
client/mysql.cc
View file @
20e01ba3
...
...
@@ -38,7 +38,7 @@
#include <signal.h>
#include <violite.h>
const
char
*
VER
=
"11.1
7
"
;
const
char
*
VER
=
"11.1
8
"
;
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
...
...
@@ -159,7 +159,7 @@ static int com_quit(String *str,char*),
com_connect
(
String
*
str
,
char
*
),
com_status
(
String
*
str
,
char
*
),
com_use
(
String
*
str
,
char
*
),
com_source
(
String
*
str
,
char
*
),
com_rehash
(
String
*
str
,
char
*
),
com_tee
(
String
*
str
,
char
*
),
com_notee
(
String
*
str
,
char
*
);
com_notee
(
String
*
str
,
char
*
)
,
com_shell
(
String
*
str
,
char
*
)
;
#ifndef __WIN__
static
int
com_nopager
(
String
*
str
,
char
*
),
com_pager
(
String
*
str
,
char
*
),
...
...
@@ -217,6 +217,9 @@ static COMMANDS commands[] = {
{
"source"
,
'.'
,
com_source
,
1
,
"Execute a SQL script file. Takes a file name as an argument."
},
{
"status"
,
's'
,
com_status
,
0
,
"Get status information from the server."
},
#ifndef __WIN__
{
"system"
,
'!'
,
com_shell
,
1
,
"Execute a system shell command."
},
#endif
{
"tee"
,
'T'
,
com_tee
,
1
,
"Set outfile [to_outfile]. Append everything into given outfile."
},
{
"use"
,
'u'
,
com_use
,
1
,
...
...
@@ -2053,6 +2056,29 @@ com_rehash(String *buffer __attribute__((unused)),
return
0
;
}
#ifndef __WIN__
static
int
com_shell
(
String
*
buffer
,
char
*
line
__attribute__
((
unused
)))
{
char
*
shell_cmd
;
if
(
!
(
shell_cmd
=
strchr
(
line
,
' '
)))
{
put_info
(
"Usage:
\\
! shell-command"
,
INFO_ERROR
);
return
-
1
;
}
/* The output of the shell command does not
get directed to the pager or the outfile */
if
(
system
(
shell_cmd
)
==
-
1
)
{
put_info
(
strerror
(
errno
),
INFO_ERROR
,
errno
);
return
-
1
;
}
return
0
;
}
#endif
static
int
com_print
(
String
*
buffer
,
char
*
line
__attribute__
((
unused
)))
{
...
...
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