Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
607753a2
...
607753a27c22aa1fb47ba50acb6445f3e2a6edd8
authored
2007-11-05 09:14:08 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Keep the namespace clean.
1 parent
18590880
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
79 deletions
mh/mh_whatnow.c
mh/send.c
sql/mysql.c
sql/odbc.c
sql/postgres.c
mh/mh_whatnow.c
View file @
607753a
...
...
@@ -441,7 +441,7 @@ refile (struct mh_whatnow_env *wh, int argc, char **argv, int *status)
/* Send action */
static
int
send
(
struct
mh_whatnow_env
*
wh
,
int
argc
,
char
**
argv
,
int
*
status
)
call_
send
(
struct
mh_whatnow_env
*
wh
,
int
argc
,
char
**
argv
,
int
*
status
)
{
if
(
invoke
(
"sendproc"
,
MHBINDIR
"/send"
,
argc
,
argv
,
wh
->
file
,
NULL
)
==
0
)
annotate
(
wh
);
...
...
@@ -541,7 +541,7 @@ static struct action_tab whatnow_tab[] = {
{
"push"
,
push
},
{
"quit"
,
quit
},
{
"refile"
,
refile
},
{
"send"
,
send
},
{
"send"
,
call_
send
},
{
"whom"
,
whom
},
{
NULL
}
};
...
...
mh/send.c
View file @
607753a
...
...
@@ -696,7 +696,7 @@ _action_send (void *item, void *data)
}
static
int
send
(
int
argc
,
char
**
argv
)
do_
send
(
int
argc
,
char
**
argv
)
{
int
i
,
rc
;
char
*
p
;
...
...
@@ -762,5 +762,5 @@ main (int argc, char **argv)
argc
=
1
;
}
return
send
(
argc
,
argv
);
return
do_
send
(
argc
,
argv
);
}
...
...
sql/mysql.c
View file @
607753a
...
...
@@ -61,7 +61,7 @@ do_mysql_query (mu_sql_connection_t conn, char *query)
/* Interface routines */
static
int
init
(
mu_sql_connection_t
conn
)
mu_mysql_
init
(
mu_sql_connection_t
conn
)
{
struct
mu_mysql_data
*
mp
=
calloc
(
1
,
sizeof
(
*
mp
));
if
(
!
mp
)
...
...
@@ -71,7 +71,7 @@ init (mu_sql_connection_t conn)
}
static
int
destroy
(
mu_sql_connection_t
conn
)
mu_mysql_
destroy
(
mu_sql_connection_t
conn
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
free
(
mp
->
mysql
);
...
...
@@ -82,7 +82,7 @@ destroy (mu_sql_connection_t conn)
static
int
connect
(
mu_sql_connection_t
conn
)
mu_mysql_
connect
(
mu_sql_connection_t
conn
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
char
*
host
,
*
socket_name
=
NULL
;
...
...
@@ -115,7 +115,7 @@ connect (mu_sql_connection_t conn)
}
static
int
disconnect
(
mu_sql_connection_t
conn
)
mu_mysql_
disconnect
(
mu_sql_connection_t
conn
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
...
...
@@ -126,7 +126,7 @@ disconnect (mu_sql_connection_t conn)
}
static
int
query
(
mu_sql_connection_t
conn
,
char
*
query
)
mu_mysql_
query
(
mu_sql_connection_t
conn
,
char
*
query
)
{
if
(
do_mysql_query
(
conn
,
query
))
return
MU_ERR_SQL
;
...
...
@@ -135,7 +135,7 @@ query (mu_sql_connection_t conn, char *query)
static
int
store_result
(
mu_sql_connection_t
conn
)
mu_mysql_
store_result
(
mu_sql_connection_t
conn
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
if
(
!
(
mp
->
result
=
mysql_store_result
(
mp
->
mysql
)))
...
...
@@ -148,7 +148,7 @@ store_result (mu_sql_connection_t conn)
}
static
int
release_result
(
mu_sql_connection_t
conn
)
mu_mysql_
release_result
(
mu_sql_connection_t
conn
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
mysql_free_result
(
mp
->
result
);
...
...
@@ -157,7 +157,7 @@ release_result (mu_sql_connection_t conn)
}
static
int
num_columns
(
mu_sql_connection_t
conn
,
size_t
*
np
)
mu_mysql_
num_columns
(
mu_sql_connection_t
conn
,
size_t
*
np
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
*
np
=
mysql_num_fields
(
mp
->
result
);
...
...
@@ -165,7 +165,7 @@ num_columns (mu_sql_connection_t conn, size_t *np)
}
static
int
num_tuples
(
mu_sql_connection_t
conn
,
size_t
*
np
)
mu_mysql_
num_tuples
(
mu_sql_connection_t
conn
,
size_t
*
np
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
*
np
=
mysql_num_rows
(
mp
->
result
);
...
...
@@ -173,7 +173,8 @@ num_tuples (mu_sql_connection_t conn, size_t *np)
}
static
int
get_column
(
mu_sql_connection_t
conn
,
size_t
nrow
,
size_t
ncol
,
char
**
pdata
)
mu_mysql_get_column
(
mu_sql_connection_t
conn
,
size_t
nrow
,
size_t
ncol
,
char
**
pdata
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
MYSQL_ROW
row
;
...
...
@@ -191,7 +192,8 @@ get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata)
}
static
int
get_field_number
(
mu_sql_connection_t
conn
,
const
char
*
fname
,
size_t
*
fno
)
mu_mysql_get_field_number
(
mu_sql_connection_t
conn
,
const
char
*
fname
,
size_t
*
fno
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
MYSQL_FIELD
*
fields
;
...
...
@@ -212,7 +214,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno)
}
static
const
char
*
errstr
(
mu_sql_connection_t
conn
)
mu_mysql_
errstr
(
mu_sql_connection_t
conn
)
{
struct
mu_mysql_data
*
mp
=
conn
->
data
;
return
mysql_error
(
mp
->
mysql
);
...
...
@@ -355,17 +357,17 @@ mu_check_mysql_scrambled_password (const char *scrambled, const char *message)
MU_DECL_SQL_DISPATCH_T
(
mysql
)
=
{
"mysql"
,
3306
,
init
,
destroy
,
connect
,
disconnect
,
query
,
store_result
,
release_result
,
num_tuples
,
num_columns
,
get_column
,
get_field_number
,
errstr
,
mu_mysql_
init
,
mu_mysql_
destroy
,
mu_mysql_
connect
,
mu_mysql_
disconnect
,
mu_mysql_
query
,
mu_mysql_
store_result
,
mu_mysql_
release_result
,
mu_mysql_
num_tuples
,
mu_mysql_
num_columns
,
mu_mysql_
get_column
,
mu_mysql_
get_field_number
,
mu_mysql_
errstr
,
};
...
...
sql/odbc.c
View file @
607753a
...
...
@@ -60,7 +60,7 @@ mu_odbc_diag(struct mu_odbc_data *dp,
/* Interface routines */
static
int
init
(
mu_sql_connection_t
conn
)
odbc_
init
(
mu_sql_connection_t
conn
)
{
struct
mu_odbc_data
*
dp
=
calloc
(
1
,
sizeof
(
*
dp
));
if
(
!
dp
)
...
...
@@ -70,7 +70,7 @@ init (mu_sql_connection_t conn)
}
static
int
destroy
(
mu_sql_connection_t
conn
)
odbc_
destroy
(
mu_sql_connection_t
conn
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
free
(
dp
->
err
.
msg
);
...
...
@@ -83,7 +83,7 @@ destroy (mu_sql_connection_t conn)
}
static
int
connect
(
mu_sql_connection_t
conn
)
odbc_
connect
(
mu_sql_connection_t
conn
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
long
rc
;
...
...
@@ -124,7 +124,7 @@ connect (mu_sql_connection_t conn)
}
static
int
disconnect
(
mu_sql_connection_t
conn
)
odbc_
disconnect
(
mu_sql_connection_t
conn
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
SQLDisconnect
(
dp
->
dbc
);
...
...
@@ -133,7 +133,7 @@ disconnect (mu_sql_connection_t conn)
}
static
int
query
(
mu_sql_connection_t
conn
,
char
*
query
)
odbc_
query
(
mu_sql_connection_t
conn
,
char
*
query
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
long
rc
;
...
...
@@ -171,7 +171,7 @@ query (mu_sql_connection_t conn, char *query)
}
static
int
store_result
(
mu_sql_connection_t
conn
)
odbc_
store_result
(
mu_sql_connection_t
conn
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
mu_list_create
(
&
dp
->
result
);
...
...
@@ -179,17 +179,17 @@ store_result (mu_sql_connection_t conn)
}
static
int
free_char_data
(
void
*
item
,
void
*
data
MU_ARG_UNUSED
)
odbc_
free_char_data
(
void
*
item
,
void
*
data
MU_ARG_UNUSED
)
{
free
(
item
);
return
0
;
}
static
int
release_result
(
mu_sql_connection_t
conn
)
odbc_
release_result
(
mu_sql_connection_t
conn
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
mu_list_do
(
dp
->
result
,
free_char_data
,
NULL
);
mu_list_do
(
dp
->
result
,
odbc_
free_char_data
,
NULL
);
mu_list_destroy
(
&
dp
->
result
);
mu_argcv_free
(
dp
->
fcount
,
dp
->
fnames
);
dp
->
fcount
=
0
;
...
...
@@ -198,7 +198,7 @@ release_result (mu_sql_connection_t conn)
}
static
int
num_columns
(
mu_sql_connection_t
conn
,
size_t
*
np
)
odbc_
num_columns
(
mu_sql_connection_t
conn
,
size_t
*
np
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
SQLSMALLINT
count
;
...
...
@@ -217,7 +217,7 @@ num_columns (mu_sql_connection_t conn, size_t *np)
}
static
int
num_tuples
(
mu_sql_connection_t
conn
,
size_t
*
np
)
odbc_
num_tuples
(
mu_sql_connection_t
conn
,
size_t
*
np
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
SQLINTEGER
count
;
...
...
@@ -232,7 +232,8 @@ num_tuples (mu_sql_connection_t conn, size_t *np)
}
static
int
get_column
(
mu_sql_connection_t
conn
,
size_t
nrow
,
size_t
ncol
,
char
**
pdata
)
odbc_get_column
(
mu_sql_connection_t
conn
,
size_t
nrow
,
size_t
ncol
,
char
**
pdata
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
char
buffer
[
1024
];
...
...
@@ -258,7 +259,8 @@ get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata)
/* FIXME: untested */
static
int
get_field_number
(
mu_sql_connection_t
conn
,
const
char
*
fname
,
size_t
*
fno
)
odbc_get_field_number
(
mu_sql_connection_t
conn
,
const
char
*
fname
,
size_t
*
fno
)
{
size_t
count
;
struct
mu_odbc_data
*
dp
=
conn
->
data
;
...
...
@@ -268,7 +270,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno)
{
int
rc
;
rc
=
num_columns
(
conn
,
&
count
);
rc
=
odbc_
num_columns
(
conn
,
&
count
);
if
(
rc
)
return
rc
;
dp
->
fnames
=
calloc
(
count
+
1
,
sizeof
dp
->
fnames
[
0
]);
...
...
@@ -335,7 +337,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno)
#define DEFAULT_ERROR_BUFFER_SIZE 1024
static
const
char
*
errstr
(
mu_sql_connection_t
conn
)
odbc_
errstr
(
mu_sql_connection_t
conn
)
{
struct
mu_odbc_data
*
dp
=
conn
->
data
;
char
state
[
16
];
...
...
@@ -380,16 +382,16 @@ errstr (mu_sql_connection_t conn)
MU_DECL_SQL_DISPATCH_T
(
odbc
)
=
{
"odbc"
,
0
,
init
,
destroy
,
connect
,
disconnect
,
query
,
store_result
,
release_result
,
num_tuples
,
num_columns
,
get_column
,
get_field_number
,
errstr
,
odbc_
init
,
odbc_
destroy
,
odbc_
connect
,
odbc_
disconnect
,
odbc_
query
,
odbc_
store_result
,
odbc_
release_result
,
odbc_
num_tuples
,
odbc_
num_columns
,
odbc_
get_column
,
odbc_
get_field_number
,
odbc_
errstr
,
};
...
...
sql/postgres.c
View file @
607753a
...
...
@@ -46,7 +46,7 @@ struct mu_pgsql_data
static
int
init
(
mu_sql_connection_t
conn
)
postgres_
init
(
mu_sql_connection_t
conn
)
{
struct
mu_pgsql_data
*
dp
=
calloc
(
1
,
sizeof
(
*
dp
));
if
(
!
dp
)
...
...
@@ -56,7 +56,7 @@ init (mu_sql_connection_t conn)
}
static
int
destroy
(
mu_sql_connection_t
conn
)
postgres_
destroy
(
mu_sql_connection_t
conn
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
free
(
dp
);
...
...
@@ -65,7 +65,7 @@ destroy (mu_sql_connection_t conn)
}
static
int
connect
(
mu_sql_connection_t
conn
)
postgres_
connect
(
mu_sql_connection_t
conn
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
char
portbuf
[
16
];
...
...
@@ -88,7 +88,7 @@ connect (mu_sql_connection_t conn)
}
static
int
disconnect
(
mu_sql_connection_t
conn
)
postgres_
disconnect
(
mu_sql_connection_t
conn
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
PQfinish
(
dp
->
pgconn
);
...
...
@@ -96,7 +96,7 @@ disconnect (mu_sql_connection_t conn)
}
static
int
query
(
mu_sql_connection_t
conn
,
char
*
query
)
postgres_
query
(
mu_sql_connection_t
conn
,
char
*
query
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
ExecStatusType
stat
;
...
...
@@ -114,13 +114,13 @@ query (mu_sql_connection_t conn, char *query)
}
static
int
store_result
(
mu_sql_connection_t
conn
)
postgres_
store_result
(
mu_sql_connection_t
conn
)
{
return
0
;
}
static
int
release_result
(
mu_sql_connection_t
conn
)
postgres_
release_result
(
mu_sql_connection_t
conn
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
PQclear
(
dp
->
res
);
...
...
@@ -129,7 +129,7 @@ release_result (mu_sql_connection_t conn)
}
static
int
num_columns
(
mu_sql_connection_t
conn
,
size_t
*
np
)
postgres_
num_columns
(
mu_sql_connection_t
conn
,
size_t
*
np
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
if
(
!
dp
->
res
)
...
...
@@ -139,7 +139,7 @@ num_columns (mu_sql_connection_t conn, size_t *np)
}
static
int
num_tuples
(
mu_sql_connection_t
conn
,
size_t
*
np
)
postgres_
num_tuples
(
mu_sql_connection_t
conn
,
size_t
*
np
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
if
(
!
dp
->
res
)
...
...
@@ -149,7 +149,8 @@ num_tuples (mu_sql_connection_t conn, size_t *np)
}
static
int
get_column
(
mu_sql_connection_t
conn
,
size_t
nrow
,
size_t
ncol
,
char
**
pdata
)
postgres_get_column
(
mu_sql_connection_t
conn
,
size_t
nrow
,
size_t
ncol
,
char
**
pdata
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
if
(
!
dp
->
res
)
...
...
@@ -159,7 +160,8 @@ get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, char **pdata)
}
static
int
get_field_number
(
mu_sql_connection_t
conn
,
const
char
*
fname
,
size_t
*
fno
)
postgres_get_field_number
(
mu_sql_connection_t
conn
,
const
char
*
fname
,
size_t
*
fno
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
if
(
!
dp
->
res
)
...
...
@@ -170,7 +172,7 @@ get_field_number (mu_sql_connection_t conn, const char *fname, size_t *fno)
}
static
const
char
*
errstr
(
mu_sql_connection_t
conn
)
postgres_
errstr
(
mu_sql_connection_t
conn
)
{
struct
mu_pgsql_data
*
dp
=
conn
->
data
;
return
PQerrorMessage
(
dp
->
pgconn
);
...
...
@@ -180,18 +182,18 @@ errstr (mu_sql_connection_t conn)
MU_DECL_SQL_DISPATCH_T
(
postgres
)
=
{
"postgres"
,
5432
,
init
,
destroy
,
connect
,
disconnect
,
query
,
store_result
,
release_result
,
num_tuples
,
num_columns
,
get_column
,
get_field_number
,
errstr
,
postgres_
init
,
postgres_
destroy
,
postgres_
connect
,
postgres_
disconnect
,
postgres_
query
,
postgres_
store_result
,
postgres_
release_result
,
postgres_
num_tuples
,
postgres_
num_columns
,
postgres_
get_column
,
postgres_
get_field_number
,
postgres_
errstr
,
};
#endif
...
...
Please
register
or
sign in
to post a comment