mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 21:23:03 +01:00
Style.
This commit is contained in:
parent
dfe3ac2caf
commit
7c01c50390
@ -42,28 +42,30 @@ static const struct tbl
|
|||||||
{
|
{
|
||||||
const char* tbl_string;
|
const char* tbl_string;
|
||||||
SSHORT tbl_code;
|
SSHORT tbl_code;
|
||||||
} types[] = {
|
} types[] =
|
||||||
{"null", LCK_null},
|
{
|
||||||
{"pr", LCK_PR},
|
{"null", LCK_null},
|
||||||
{"sr", LCK_SR},
|
{"pr", LCK_PR},
|
||||||
{"pw", LCK_PW},
|
{"sr", LCK_SR},
|
||||||
{"sw", LCK_SW},
|
{"pw", LCK_PW},
|
||||||
{"ex", LCK_EX},
|
{"sw", LCK_SW},
|
||||||
{NULL, LCK_none}
|
{"ex", LCK_EX},
|
||||||
|
{NULL, LCK_none}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct tagg
|
static const struct tagg
|
||||||
{
|
{
|
||||||
const char* tagg_string;
|
const char* tagg_string;
|
||||||
SSHORT tagg_code;
|
SSHORT tagg_code;
|
||||||
} aggs[] = {
|
} aggs[] =
|
||||||
{"min", LCK_MIN},
|
{
|
||||||
{"max", LCK_MAX},
|
{"min", LCK_MIN},
|
||||||
{"cnt", LCK_CNT},
|
{"max", LCK_MAX},
|
||||||
{"sum", LCK_SUM},
|
{"cnt", LCK_CNT},
|
||||||
{"avg", LCK_AVG},
|
{"sum", LCK_SUM},
|
||||||
{"any", LCK_ANY},
|
{"avg", LCK_AVG},
|
||||||
{NULL, 0}
|
{"any", LCK_ANY},
|
||||||
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int wait, sw_release, locks[100], levels[100];
|
static int wait, sw_release, locks[100], levels[100];
|
||||||
@ -92,7 +94,8 @@ void main( int argc, char **argv)
|
|||||||
printf("pid = %d\n\n", getpid());
|
printf("pid = %d\n\n", getpid());
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (LOCK_init(status_vector, getpid(), 1, &lck_owner_handle)) {
|
if (LOCK_init(status_vector, getpid(), 1, &lck_owner_handle))
|
||||||
|
{
|
||||||
printf("LOCK_init failed\n");
|
printf("LOCK_init failed\n");
|
||||||
isc_print_status(status_vector);
|
isc_print_status(status_vector);
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -123,7 +126,8 @@ void main( int argc, char **argv)
|
|||||||
if (!strcmp(op, "rel"))
|
if (!strcmp(op, "rel"))
|
||||||
{
|
{
|
||||||
const SSHORT n = atoi(arg);
|
const SSHORT n = atoi(arg);
|
||||||
if (n < slot && (lock = locks[n])) {
|
if (n < slot && (lock = locks[n]))
|
||||||
|
{
|
||||||
LOCK_deq(lock);
|
LOCK_deq(lock);
|
||||||
locks[n] = 0;
|
locks[n] = 0;
|
||||||
}
|
}
|
||||||
@ -146,7 +150,8 @@ void main( int argc, char **argv)
|
|||||||
if (!strcmp(op, "rd"))
|
if (!strcmp(op, "rd"))
|
||||||
{
|
{
|
||||||
const SSHORT n = atoi(arg);
|
const SSHORT n = atoi(arg);
|
||||||
if (n >= slot || !(lock = locks[n])) {
|
if (n >= slot || !(lock = locks[n]))
|
||||||
|
{
|
||||||
printf("bad lock\n");
|
printf("bad lock\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -157,7 +162,8 @@ void main( int argc, char **argv)
|
|||||||
if (!strcmp(op, "wd"))
|
if (!strcmp(op, "wd"))
|
||||||
{
|
{
|
||||||
const SSHORT n = atoi(arg);
|
const SSHORT n = atoi(arg);
|
||||||
if (n >= slot || !(lock = locks[n])) {
|
if (n >= slot || !(lock = locks[n]))
|
||||||
|
{
|
||||||
printf("bad lock\n");
|
printf("bad lock\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -169,7 +175,8 @@ void main( int argc, char **argv)
|
|||||||
if (!strcmp(op, "qd"))
|
if (!strcmp(op, "qd"))
|
||||||
{
|
{
|
||||||
const SSHORT agg = lookup_agg(arg);
|
const SSHORT agg = lookup_agg(arg);
|
||||||
if (!agg) {
|
if (!agg)
|
||||||
|
{
|
||||||
printf("bad query aggregate\n");
|
printf("bad query aggregate\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -184,11 +191,13 @@ void main( int argc, char **argv)
|
|||||||
{
|
{
|
||||||
const SSHORT n = atoi(arg);
|
const SSHORT n = atoi(arg);
|
||||||
scanf("%s", op);
|
scanf("%s", op);
|
||||||
if (!(type = lookup_lock(op))) {
|
if (!(type = lookup_lock(op)))
|
||||||
|
{
|
||||||
printf("bad lock type\n");
|
printf("bad lock type\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (n >= slot || !(lock = locks[n])) {
|
if (n >= slot || !(lock = locks[n]))
|
||||||
|
{
|
||||||
printf("bad lock\n");
|
printf("bad lock\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -224,12 +233,14 @@ void main( int argc, char **argv)
|
|||||||
type, /* lock type */
|
type, /* lock type */
|
||||||
(sw_release ? ast : NULL), slot, /* AST and argument */
|
(sw_release ? ast : NULL), slot, /* AST and argument */
|
||||||
0, wait, status_vector, lck_owner_handle);
|
0, wait, status_vector, lck_owner_handle);
|
||||||
if (lock) {
|
if (lock)
|
||||||
|
{
|
||||||
printf("lock# %d = %d\n", slot, lock);
|
printf("lock# %d = %d\n", slot, lock);
|
||||||
levels[slot] = type;
|
levels[slot] = type;
|
||||||
locks[slot++] = lock;
|
locks[slot++] = lock;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
printf("*** LOCK REJECTED: status_vector[1] = %d", status_vector[1]);
|
printf("*** LOCK REJECTED: status_vector[1] = %d", status_vector[1]);
|
||||||
switch (status_vector[1])
|
switch (status_vector[1])
|
||||||
{
|
{
|
||||||
@ -274,18 +285,21 @@ static int ast(void* slot_void)
|
|||||||
|
|
||||||
printf("*** blocking AST for lock# %d ", slot);
|
printf("*** blocking AST for lock# %d ", slot);
|
||||||
|
|
||||||
if (sw_release < 0) {
|
if (sw_release < 0)
|
||||||
|
{
|
||||||
printf("In the AST routine.\n");
|
printf("In the AST routine.\n");
|
||||||
printf("Enter ar value [1=nothing, 2=release, 3=downgrade]:");
|
printf("Enter ar value [1=nothing, 2=release, 3=downgrade]:");
|
||||||
scanf("%d", &sw_release_use);
|
scanf("%d", &sw_release_use);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw_release_use == 1) {
|
if (sw_release_use == 1)
|
||||||
|
{
|
||||||
printf("-- ignored ***\n");
|
printf("-- ignored ***\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw_release_use > 2 && levels[slot] == LCK_EX) {
|
if (sw_release_use > 2 && levels[slot] == LCK_EX)
|
||||||
|
{
|
||||||
LOCK_convert(locks[slot], LCK_SR, wait, NULL, 0, status_vector);
|
LOCK_convert(locks[slot], LCK_SR, wait, NULL, 0, status_vector);
|
||||||
levels[slot] = LCK_SR;
|
levels[slot] = LCK_SR;
|
||||||
printf("-- down graded to SR ***\n");
|
printf("-- down graded to SR ***\n");
|
||||||
|
@ -191,14 +191,20 @@ int CLIB_ROUTINE main( int argc, char *argv[])
|
|||||||
redir_err = _open_osfhandle(redir_err, 0);
|
redir_err = _open_osfhandle(redir_err, 0);
|
||||||
#endif
|
#endif
|
||||||
if (redir_in != 0)
|
if (redir_in != 0)
|
||||||
|
{
|
||||||
if (dup2((int) redir_in, 0))
|
if (dup2((int) redir_in, 0))
|
||||||
close((int) redir_in);
|
close((int) redir_in);
|
||||||
|
}
|
||||||
if (redir_out != 1)
|
if (redir_out != 1)
|
||||||
|
{
|
||||||
if (dup2((int) redir_out, 1))
|
if (dup2((int) redir_out, 1))
|
||||||
close((int) redir_out);
|
close((int) redir_out);
|
||||||
|
}
|
||||||
if (redir_err != 2)
|
if (redir_err != 2)
|
||||||
|
{
|
||||||
if (dup2((int) redir_err, 2))
|
if (dup2((int) redir_err, 2))
|
||||||
close((int) redir_err);
|
close((int) redir_err);
|
||||||
|
}
|
||||||
argv += 4;
|
argv += 4;
|
||||||
argc -= 4;
|
argc -= 4;
|
||||||
}
|
}
|
||||||
@ -961,8 +967,7 @@ static void prt_history(OUTFILE outfile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void prt_lock(OUTFILE outfile,
|
static void prt_lock(OUTFILE outfile, const lhb* LOCK_header, lbl* lock, USHORT sw_series)
|
||||||
const lhb* LOCK_header, lbl* lock, USHORT sw_series)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -1343,16 +1348,16 @@ static void prt_que2(OUTFILE outfile,
|
|||||||
|
|
||||||
static void prt_html_begin(OUTFILE outfile)
|
static void prt_html_begin(OUTFILE outfile)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
* p r t _ h t m l _ b e g i n
|
* p r t _ h t m l _ b e g i n
|
||||||
*
|
*
|
||||||
**************************************
|
**************************************
|
||||||
*
|
*
|
||||||
* Functional description
|
* Functional description
|
||||||
* Print the html header if heeded
|
* Print the html header if heeded
|
||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
if (!sw_html_format)
|
if (!sw_html_format)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1363,16 +1368,16 @@ static void prt_html_begin(OUTFILE outfile)
|
|||||||
|
|
||||||
static void prt_html_end(OUTFILE outfile)
|
static void prt_html_end(OUTFILE outfile)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
* p r t _ h t m l _ e n d
|
* p r t _ h t m l _ e n d
|
||||||
*
|
*
|
||||||
**************************************
|
**************************************
|
||||||
*
|
*
|
||||||
* Functional description
|
* Functional description
|
||||||
* Print the html finishing items
|
* Print the html finishing items
|
||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
if (!sw_html_format)
|
if (!sw_html_format)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user