8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 21:23:04 +01:00
This commit is contained in:
robocop 2014-02-25 06:13:30 +00:00
parent 6e921f72ed
commit caaf525d3c
14 changed files with 374 additions and 245 deletions

View File

@ -45,7 +45,7 @@ _br_find_exe (BrInitError *error)
*error = BR_INIT_ERROR_DISABLED;
return NULL;
#else
char *path, *path2, *line, *result;
char *line, *result;
size_t buf_size;
ssize_t size;
struct stat stat_buf;
@ -56,14 +56,15 @@ _br_find_exe (BrInitError *error)
buf_size = SSIZE_MAX - 1;
else
buf_size = PATH_MAX - 1;
path = (char *) malloc (buf_size);
if (path == NULL) {
char* path = (char *) malloc (buf_size);
if (path == NULL)
{
/* Cannot allocate memory. */
if (error)
*error = BR_INIT_ERROR_NOMEM;
return NULL;
}
path2 = (char *) malloc (buf_size);
char* path2 = (char *) malloc (buf_size);
if (path2 == NULL) {
/* Cannot allocate memory. */
if (error)
@ -74,11 +75,13 @@ _br_find_exe (BrInitError *error)
strncpy (path2, "/proc/self/exe", buf_size - 1);
while (1) {
while (1)
{
int i;
size = readlink (path2, path, buf_size - 1);
if (size == -1) {
if (size == -1)
{
/* Error. */
free (path2);
break;
@ -90,14 +93,16 @@ _br_find_exe (BrInitError *error)
/* Check whether the symlink's target is also a symlink.
* We want to get the final target. */
i = stat (path, &stat_buf);
if (i == -1) {
if (i == -1)
{
/* Error. */
free (path2);
break;
}
/* stat() success. */
if (!S_ISLNK (stat_buf.st_mode)) {
if (!S_ISLNK (stat_buf.st_mode))
{
/* path is not a symlink. Done. */
free (path2);
return path;
@ -113,7 +118,8 @@ _br_find_exe (BrInitError *error)
buf_size = PATH_MAX + 128;
line = (char *) realloc (path, buf_size);
if (line == NULL) {
if (line == NULL)
{
/* Cannot allocate memory. */
free (path);
if (error)
@ -122,7 +128,8 @@ _br_find_exe (BrInitError *error)
}
f = fopen ("/proc/self/maps", "r");
if (f == NULL) {
if (f == NULL)
{
free (line);
if (error)
*error = BR_INIT_ERROR_OPEN_MAPS;
@ -131,7 +138,8 @@ _br_find_exe (BrInitError *error)
/* The first entry should be the executable name. */
result = fgets (line, (int) buf_size, f);
if (result == NULL) {
if (result == NULL)
{
fclose (f);
free (line);
if (error)
@ -141,7 +149,8 @@ _br_find_exe (BrInitError *error)
/* Get rid of newline character. */
buf_size = strlen (line);
if (buf_size <= 0) {
if (buf_size <= 0)
{
/* Huh? An empty string? */
fclose (f);
free (line);
@ -156,7 +165,8 @@ _br_find_exe (BrInitError *error)
path = strchr (line, '/');
/* Sanity check. */
if (strstr (line, " r-xp ") == NULL || path == NULL) {
if (strstr (line, " r-xp ") == NULL || path == NULL)
{
fclose (f);
free (line);
if (error)
@ -200,7 +210,8 @@ _br_find_exe_for_symbol (const void *symbol, BrInitError *error)
address_string = (char *) malloc (address_string_len);
found = (char *) NULL;
while (!feof (f)) {
while (!feof (f))
{
char *start_addr, *end_addr, *end_addr_end, *file;
void *start_addr_p, *end_addr_p;
size_t len;
@ -247,7 +258,8 @@ _br_find_exe_for_symbol (const void *symbol, BrInitError *error)
/* Transform the addresses into a string in the form of 0xdeadbeef,
* then transform that into a pointer. */
if (address_string_len < len + 3) {
if (address_string_len < len + 3)
{
address_string_len = len + 3;
address_string = (char *) realloc (address_string, address_string_len);
}
@ -263,7 +275,8 @@ _br_find_exe_for_symbol (const void *symbol, BrInitError *error)
sscanf (address_string, "%p", &end_addr_p);
if (symbol >= start_addr_p && symbol < end_addr_p) {
if (symbol >= start_addr_p && symbol < end_addr_p)
{
found = file;
break;
}
@ -273,9 +286,9 @@ _br_find_exe_for_symbol (const void *symbol, BrInitError *error)
fclose (f);
if (found == NULL)
return (char *) NULL;
else
return strdup (found);
return (char*) NULL;
return strdup (found);
#endif /* ENABLE_BINRELOC */
}
@ -344,12 +357,13 @@ br_init_lib (BrInitError *error)
char *
br_find_exe (const char *default_exe)
{
if (exe == (char *) NULL) {
if (exe == (char *) NULL)
{
/* BinReloc is not initialized. */
if (default_exe != (const char *) NULL)
return strdup (default_exe);
else
return (char *) NULL;
return (char *) NULL;
}
return strdup (exe);
}
@ -372,12 +386,13 @@ br_find_exe (const char *default_exe)
char *
br_find_exe_dir (const char *default_dir)
{
if (exe == NULL) {
if (exe == NULL)
{
/* BinReloc not initialized. */
if (default_dir != NULL)
return strdup (default_dir);
else
return NULL;
return NULL;
}
return br_dirname (exe);
@ -402,12 +417,13 @@ br_find_prefix (const char *default_prefix)
{
char *dir1, *dir2;
if (exe == (char *) NULL) {
if (exe == (char *) NULL)
{
/* BinReloc not initialized. */
if (default_prefix != (const char *) NULL)
return strdup (default_prefix);
else
return (char *) NULL;
return (char *) NULL;
}
dir1 = br_dirname (exe);
@ -436,12 +452,13 @@ br_find_bin_dir (const char *default_bin_dir)
char *prefix, *dir;
prefix = br_find_prefix ((const char *) NULL);
if (prefix == (char *) NULL) {
if (prefix == (char *) NULL)
{
/* BinReloc not initialized. */
if (default_bin_dir != (const char *) NULL)
return strdup (default_bin_dir);
else
return (char *) NULL;
return (char *) NULL;
}
dir = br_build_path (prefix, "bin");
@ -469,12 +486,13 @@ br_find_sbin_dir (const char *default_sbin_dir)
char *prefix, *dir;
prefix = br_find_prefix ((const char *) NULL);
if (prefix == (char *) NULL) {
if (prefix == (char *) NULL)
{
/* BinReloc not initialized. */
if (default_sbin_dir != (const char *) NULL)
return strdup (default_sbin_dir);
else
return (char *) NULL;
return (char *) NULL;
}
dir = br_build_path (prefix, "sbin");
@ -503,12 +521,13 @@ br_find_data_dir (const char *default_data_dir)
char *prefix, *dir;
prefix = br_find_prefix ((const char *) NULL);
if (prefix == (char *) NULL) {
if (prefix == (char *) NULL)
{
/* BinReloc not initialized. */
if (default_data_dir != (const char *) NULL)
return strdup (default_data_dir);
else
return (char *) NULL;
return (char *) NULL;
}
dir = br_build_path (prefix, "share");
@ -536,12 +555,13 @@ br_find_locale_dir (const char *default_locale_dir)
char *data_dir, *dir;
data_dir = br_find_data_dir ((const char *) NULL);
if (data_dir == (char *) NULL) {
if (data_dir == (char *) NULL)
{
/* BinReloc not initialized. */
if (default_locale_dir != (const char *) NULL)
return strdup (default_locale_dir);
else
return (char *) NULL;
return (char *) NULL;
}
dir = br_build_path (data_dir, "locale");
@ -569,12 +589,13 @@ br_find_lib_dir (const char *default_lib_dir)
char *prefix, *dir;
prefix = br_find_prefix ((const char *) NULL);
if (prefix == (char *) NULL) {
if (prefix == (char *) NULL)
{
/* BinReloc not initialized. */
if (default_lib_dir != (const char *) NULL)
return strdup (default_lib_dir);
else
return (char *) NULL;
return (char *) NULL;
}
dir = br_build_path (prefix, "lib");
@ -602,12 +623,13 @@ br_find_libexec_dir (const char *default_libexec_dir)
char *prefix, *dir;
prefix = br_find_prefix ((const char *) NULL);
if (prefix == (char *) NULL) {
if (prefix == (char *) NULL)
{
/* BinReloc not initialized. */
if (default_libexec_dir != (const char *) NULL)
return strdup (default_libexec_dir);
else
return (char *) NULL;
return (char *) NULL;
}
dir = br_build_path (prefix, "libexec");
@ -635,12 +657,13 @@ br_find_etc_dir (const char *default_etc_dir)
char *prefix, *dir;
prefix = br_find_prefix ((const char *) NULL);
if (prefix == (char *) NULL) {
if (prefix == (char *) NULL)
{
/* BinReloc not initialized. */
if (default_etc_dir != (const char *) NULL)
return strdup (default_etc_dir);
else
return (char *) NULL;
return (char *) NULL;
}
dir = br_build_path (prefix, "etc");
@ -690,10 +713,12 @@ br_build_path (const char *dir, const char *file)
int must_free = 0;
len = strlen (dir);
if (len > 0 && dir[len - 1] != '/') {
if (len > 0 && dir[len - 1] != '/')
{
dir2 = br_strcat (dir, "/");
must_free = 1;
} else
}
else
dir2 = (char *) dir;
result = br_strcat (dir2, file);
@ -753,11 +778,13 @@ br_dirname (const char *path)
while (end > path && *end == '/')
end--;
result = br_strndup (path, end - path + 1);
if (result[0] == 0) {
if (result[0] == 0)
{
free (result);
return strdup ("/");
} else
return result;
}
return result;
}

View File

@ -71,7 +71,8 @@ int main(int argc, char** argv)
char buffer[200];
struct texttype this_textobj;
if (argc <= 1) {
if (argc <= 1)
{
printf("usage: dtest Intl_module_name\n");
return (1);
}
@ -79,7 +80,8 @@ int main(int argc, char** argv)
FPTR_INT func = 0;
for (int i = 1; i < argc; i++) {
for (int i = 1; i < argc; i++)
{
#ifdef LIKE_JRD
{
@ -94,22 +96,24 @@ int main(int argc, char** argv)
func = (FPTR_INT) ISC_lookup_entrypoint(path.c_str(), entry, NULL);
}
#else
if (strcmp(vector[i], "ask") == 0) {
if (strcmp(vector[i], "ask") == 0)
{
gets(buffer);
func = (FPTR_INT) ISC_lookup_entrypoint(buffer, "ld_init", NULL);
}
else
func =
(FPTR_INT) ISC_lookup_entrypoint(vector[i], "ld_init", NULL);
func = (FPTR_INT) ISC_lookup_entrypoint(vector[i], "ld_init", NULL);
#endif
if (func == NULL)
printf("Cannot find %s.init\n", vector[i]);
else {
else
{
FULL_DEBUG("This testobj %ld\n", &this_textobj);
FULL_DEBUG("size of %d\n", sizeof(this_textobj));
if ((*func) (99, &this_textobj) != 99)
printf("%s.Init returned bad result\n", vector[i]);
else {
else
{
FULL_DEBUG("Called init ok\n");
FULL_DEBUG("ld_init is %ld %ld\n",
this_textobj.
@ -120,7 +124,8 @@ int main(int argc, char** argv)
texttype_functions[(int) intl_fn_NULL], func);
if (func == NULL)
printf("%s.Init OK can't find ID\n", vector[i]);
else {
else
{
FULL_DEBUG("About to call ID fn\n");
(*func) (sizeof(buffer), buffer);
FULL_DEBUG("Back from ID fn \n");
@ -132,7 +137,8 @@ int main(int argc, char** argv)
FULL_DEBUG("ld_to_key is %ld\n", func);
if (func == NULL)
printf("%s: Can't find str_to_key\n", vector[i]);
else {
else
{
try_fc("cote", func);
try_fc("COTE", func);
try_fc("co-te", func);

View File

@ -61,8 +61,10 @@ main(int argc, char *argv[])
int usage = 0;
char *filename = NULL;
for (i = 1; i < argc && !usage; i++) {
if (argv[i][0] == '-') {
for (i = 1; i < argc && !usage; i++)
{
if (argv[i][0] == '-')
{
if (strcmp(argv[i], "-euc") == 0)
option_euc++;
else if (strcmp(argv[i], "-sjis") == 0)
@ -78,14 +80,16 @@ main(int argc, char *argv[])
filename = argv[i];
}
if (usage) {
if (usage)
{
fprintf(stderr,
"usage: mapgen4 [-condense | -euc | -sjis] <name of unicode map file>\n");
exit(1);
}
f = fopen(filename, "r");
if (!f) {
if (!f)
{
fprintf(stderr, "Unable to open file '%s'\n", filename);
exit(1);
}
@ -106,7 +110,8 @@ main(int argc, char *argv[])
printf("\n");
while (fgets(line, sizeof(line), f)) {
while (fgets(line, sizeof(line), f))
{
unsigned int unicode;
unsigned int codepoint;
char *p;
@ -126,9 +131,11 @@ main(int argc, char *argv[])
continue;
p = line;
if (option_sjis) {
if (option_sjis)
{
unsigned int sjis_point;
if (1 != sscanf(p, "0x%04x\t", &sjis_point)) {
if (1 != sscanf(p, "0x%04x\t", &sjis_point))
{
fprintf(stderr, "Problem in input file - line %d\n",
linecount);
exit(1);
@ -137,7 +144,8 @@ main(int argc, char *argv[])
}
codepoint = 0;
if (1 != sscanf(p, "0x%04x\t", &codepoint)) {
if (1 != sscanf(p, "0x%04x\t", &codepoint))
{
fprintf(stderr, "Problem in input file - line %d\n",
linecount);
exit(1);
@ -148,12 +156,14 @@ main(int argc, char *argv[])
codepoint += 0x8080;
unicode = 0;
if (0 == sscanf(p, "0x%04x\t", &unicode)) {
if (0 == sscanf(p, "0x%04x\t", &unicode))
{
/* Conversion is not defined */
codepoint_conversion.table[codepoint].not_defined++;
declare(codepoint, unicode, "NOT DEFINED");
}
else {
else
{
/* Find start of comment defining Unicode name */
p = strchr(p, '#');
if (p)
@ -169,8 +179,10 @@ main(int argc, char *argv[])
/* Declare any standard ASCII characters that didn't exist in the table */
for (i = 0; i <= 0x7f; i++)
{
if (!codepoint_conversion.table[i].exists)
declare(i, i, "ASCII");
}
printf("\n");
printf("\n");
@ -213,7 +225,8 @@ void declare(unsigned short codepoint, unsigned short unicode, char *name)
if (codepoint > codepoint_conversion.high_point)
codepoint_conversion.high_point = codepoint;
if (codepoint_conversion.table[codepoint].exists++) {
if (codepoint_conversion.table[codepoint].exists++)
{
if (unicode != codepoint_conversion.table[codepoint].equivilant)
fprintf(stderr,
"Error: duplicate unequal mappings for 0x%04x : 0x%04x and 0x%04x\n",
@ -230,21 +243,25 @@ void declare(unsigned short codepoint, unsigned short unicode, char *name)
codepoint_conversion.table[codepoint].codepoint = codepoint;
strcpy(codepoint_conversion.table[codepoint].name, name);
if (!codepoint_conversion.table[codepoint].not_defined) {
if (!codepoint_conversion.table[codepoint].not_defined)
{
codepoint_conversion.table[codepoint].equivilant = unicode;
if (unicode < unicode_conversion.low_point)
unicode_conversion.low_point = unicode;
if (unicode > unicode_conversion.high_point)
unicode_conversion.high_point = unicode;
if (!unicode_conversion.table[unicode].exists++) {
if (!unicode_conversion.table[unicode].exists++)
{
unicode_conversion.table[unicode].codepoint = unicode;
if (unicode != UNICODE_REPLACEMENT_CHARACTER) {
if (unicode != UNICODE_REPLACEMENT_CHARACTER)
{
unicode_conversion.table[unicode].equivilant = codepoint;
strcpy(unicode_conversion.table[unicode].name, name);
}
}
else {
else
{
if (unicode != UNICODE_REPLACEMENT_CHARACTER)
fprintf(stderr,
"Warning: Multiple mappings to Unicode 0x%04x : 0x%04x and 0x%04x\n",
@ -255,12 +272,13 @@ void declare(unsigned short codepoint, unsigned short unicode, char *name)
}
void print_direct_table(char *name, TABLE * table)
void print_direct_table(char *name, TABLE* table)
{
int i;
printf("static const USHORT %s_map[256] = {\n", name);
for (i = 0; i < 256; i++) {
for (i = 0; i < 256; i++)
{
if (table->table[i].exists != 1 || table->table[i].not_defined)
printf("/* %02X */ UNICODE_REPLACEMENT_CHARACTER,\n", i);
else
@ -271,7 +289,7 @@ void print_direct_table(char *name, TABLE * table)
}
void print_indexed_table(char *name, TABLE * table,
void print_indexed_table(char *name, TABLE* table,
unsigned short replacement)
{
unsigned int index;
@ -282,26 +300,29 @@ void print_indexed_table(char *name, TABLE * table,
printf("static const USHORT %s_mapping_array[] = {\n",
name);
for (index = 0; index < 256; index++)
{
if (replacement == UNICODE_REPLACEMENT_CHARACTER)
printf
("/* U+XX%02X */\tUNICODE_REPLACEMENT_CHARACTER,\t/* %d */\n",
printf("/* U+XX%02X */\tUNICODE_REPLACEMENT_CHARACTER,\t/* %d */\n",
index % 256, index);
else
printf("/* U+XX%02X */\tCANT_MAP_CHARACTER,\t/* %d */\n",
index % 256, index);
}
memset(upper_byte, 0, sizeof(upper_byte));
codepoint = 0;
while (codepoint < 0xFFFF + 1) {
if (!table->table[codepoint].exists) {
while (codepoint < 0xFFFF + 1)
{
if (!table->table[codepoint].exists)
{
codepoint++;
continue;
}
upper_byte[codepoint / 256] = index;
while ((index % 256) < (codepoint % 256)) {
while ((index % 256) < (codepoint % 256))
{
if (replacement == UNICODE_REPLACEMENT_CHARACTER)
printf
("/* U+%04X */\tUNICODE_REPLACEMENT_CHARACTER,\t/* %d */\n",
printf("/* U+%04X */\tUNICODE_REPLACEMENT_CHARACTER,\t/* %d */\n",
(codepoint & 0xFF00) + (index % 256), index);
else
printf("/* U+%04X */\tCANT_MAP_CHARACTER,\t/* %d */\n",
@ -309,10 +330,10 @@ void print_indexed_table(char *name, TABLE * table,
index++;
}
do {
if (!table->table[codepoint].exists) {
if (!table->table[codepoint].exists)
{
if (replacement == UNICODE_REPLACEMENT_CHARACTER)
printf
("/* U+%04X */\tUNICODE_REPLACEMENT_CHARACTER,\t/* %d */\n",
printf("/* U+%04X */\tUNICODE_REPLACEMENT_CHARACTER,\t/* %d */\n",
codepoint, index);
else
printf("/* U+%04X */\tCANT_MAP_CHARACTER,\t/* %d */\n",
@ -337,9 +358,8 @@ void print_indexed_table(char *name, TABLE * table,
}
void print_condensed_indexed_table(
char *name,
TABLE * table, unsigned short replacement)
void print_condensed_indexed_table(char *name,
TABLE* table, unsigned short replacement)
{
unsigned int index;
unsigned int codepoint;
@ -351,7 +371,8 @@ void print_condensed_indexed_table(
printf("\n");
printf("/* %5d to %5d */\n", 0, 255);
for (index = 0; index < 256; index++) {
for (index = 0; index < 256; index++)
{
if (replacement)
printf("0x%04X,", replacement);
else
@ -364,8 +385,10 @@ void print_condensed_indexed_table(
memset(upper_byte, 0, sizeof(upper_byte));
codepoint = 0;
while (codepoint < 0xFFFF + 1) {
if (!table->table[codepoint].exists) {
while (codepoint < 0xFFFF + 1)
{
if (!table->table[codepoint].exists)
{
codepoint++;
continue;
}
@ -374,7 +397,8 @@ void print_condensed_indexed_table(
printf("\n");
printf("/* %5d to %5d */\n", index, index + 255);
while ((index % 256) < (codepoint % 256)) {
while ((index % 256) < (codepoint % 256))
{
if (replacement)
printf("0x%04X,", replacement);
else
@ -386,7 +410,8 @@ void print_condensed_indexed_table(
index++;
}
do {
if (!table->table[codepoint].exists) {
if (!table->table[codepoint].exists)
{
if (replacement)
printf("0x%04X,", replacement);
else

View File

@ -3655,8 +3655,7 @@ static processing_state create_db(const TEXT* statement, TEXT* d_name)
const TEXT* p = NULL;
// If there is a user parameter, we will set it into the create stmt.
if (global_usr || global_psw ||
(*ISQL_charset && strcmp(ISQL_charset, DEFCHARSET)))
if (global_usr || global_psw || (*ISQL_charset && strcmp(ISQL_charset, DEFCHARSET)))
{
strip_quotes(isqlGlob.User, usr);
strip_quotes(Password, psw);
@ -3693,8 +3692,7 @@ static processing_state create_db(const TEXT* statement, TEXT* d_name)
if (*ISQL_charset && strcmp(ISQL_charset, DEFCHARSET))
sprintf(local_statement + strlen(local_statement),
" SET NAMES \'%s\' ", ISQL_charset);
sprintf(local_statement + strlen(local_statement), "%s",
p);
sprintf(local_statement + strlen(local_statement), "%s", p);
}
}
}
@ -3718,10 +3716,8 @@ static processing_state create_db(const TEXT* statement, TEXT* d_name)
strlen(isqlGlob.User) + strlen(Password) + 24 + 2 * cnt;
if (*ISQL_charset && strcmp(ISQL_charset, DEFCHARSET))
arglength +=
strlen(ISQL_charset) + strlen(" SET NAMES \'\' ");
new_local_statement =
(TEXT*) ISQL_ALLOC(arglength + 1);
arglength += strlen(ISQL_charset) + strlen(" SET NAMES \'\' ");
new_local_statement = (TEXT*) ISQL_ALLOC(arglength + 1);
if (!new_local_statement)
{
@ -3755,8 +3751,7 @@ static processing_state create_db(const TEXT* statement, TEXT* d_name)
ISQL_FREE(new_local_statement);
return (FAIL);
}
copy_str(&temp_str, &temp_local_stmt_str, &done,
str_begin, str_end, str_flag);
copy_str(&temp_str, &temp_local_stmt_str, &done, str_begin, str_end, str_flag);
}
if (new_local_statement)
@ -3771,8 +3766,7 @@ static processing_state create_db(const TEXT* statement, TEXT* d_name)
sprintf(temp_str + strlen(temp_str), " PASSWORD \'%s\' ", psw);
if (*ISQL_charset && strcmp(ISQL_charset, DEFCHARSET))
sprintf(temp_str + strlen(temp_str),
" SET NAMES \'%s\' ", ISQL_charset);
sprintf(temp_str + strlen(temp_str), " SET NAMES \'%s\' ", ISQL_charset);
if (new_local_statement)
temp_str = new_local_statement + strlen(new_local_statement);

View File

@ -11,16 +11,20 @@ void ProcessFile(FILE *in, bool stripFirstComment)
{
char s[256];
bool striping = false;
while (fgets(s, sizeof(s), in)) {
if (stripFirstComment) {
while (fgets(s, sizeof(s), in))
{
if (stripFirstComment)
{
char *x = strstr(s, "/*");
if (x) {
if (x)
{
striping = true;
stripFirstComment = false;
continue;
}
}
if (striping) {
if (striping)
{
char *x = strstr(s, "*/");
if (x) {
striping = false;
@ -28,12 +32,14 @@ void ProcessFile(FILE *in, bool stripFirstComment)
continue;
}
const char* include = "#include";
if (memcmp(s, include, strlen(include))) {
if (memcmp(s, include, strlen(include)))
{
fputs(s, stdout);
continue;
}
char *p = strchr(s, '<');
if (p) {
if (p)
{
fputs(s, stdout);
continue;
}

View File

@ -76,7 +76,7 @@ time_t first_time, last_time, curr_time;
int curr_repeat = 0;
ULONG intervals[TEST_REPEATS];
void report_time();
void report_time(const char* s);
void init_time();
void start_time();
void stop_time();
@ -101,7 +101,8 @@ void start_time()
void stop_time()
{
if (ftime(&tp) != -1) {
if (ftime(&tp) != -1)
{
curr_time = (tp.time * 1000) + tp.millitm;
intervals[curr_repeat++] = curr_time - last_time;
}
@ -109,8 +110,7 @@ void stop_time()
printf("ftime() failed\n");
}
void report_time(s)
char *s;
void report_time(const char* s)
{
int i;
ULONG max_interval = 0;
@ -121,7 +121,8 @@ void report_time(s)
/* Doesn't handle single repeat case */
/* Ignores the first timing */
for (i = 1; i < curr_repeat; i++) {
for (i = 1; i < curr_repeat; i++)
{
sum_interval += intervals[i];
if (intervals[i] > max_interval)
max_interval = intervals[i];
@ -129,21 +130,19 @@ void report_time(s)
min_interval = intervals[i];
}
avg_interval =
(sum_interval - (max_interval + min_interval)) / (curr_repeat - 3);
avg_interval = (sum_interval - (max_interval + min_interval)) / (curr_repeat - 3);
printf("%s: %4ld avg ms %4ld min ms %4ld max ms\n",
s, avg_interval, min_interval, max_interval);
}
main(argc, argv)
int argc;
char **argv;
main(int argc, char** argv)
{
int i, j, k, r;
init_time();
for (r = 0; r < TEST_REPEATS; ++r) {
for (r = 0; r < TEST_REPEATS; ++r)
{
start_time();
{
for (j = 0; j < MCOUNT; ++j)
@ -154,7 +153,8 @@ main(argc, argv)
report_time("Empty Loop");
init_time();
for (r = 0; r < TEST_REPEATS; ++r) {
for (r = 0; r < TEST_REPEATS; ++r)
{
start_time();
{
for (j = 0; j < MCOUNT; ++j)
@ -166,12 +166,14 @@ main(argc, argv)
printf("\n\nTiming memset (destination aligments & blocksizes)\n\n");
for (k = 0; k < BSIZES; ++k) {
for (k = 0; k < BSIZES; ++k)
{
/* Aligned */
do_test_memset((UCHAR *) destination, block_sizes[k]);
}
for (k = 0; k < BSIZES; ++k) {
for (k = 0; k < BSIZES; ++k)
{
/* Unaligned */
do_test_memset((UCHAR *) destination + 1, block_sizes[k]);
}
@ -180,22 +182,22 @@ main(argc, argv)
printf
("\n\nTiming memcpy (source aligments, destination alignments & blocksizes)\n\n");
for (k = 0; k < BSIZES; ++k) {
for (k = 0; k < BSIZES; ++k)
{
/* Both aligned */
do_test_memcpy((UCHAR *) source, (UCHAR *) destination,
block_sizes[k]);
do_test_memcpy((UCHAR *) source, (UCHAR *) destination, block_sizes[k]);
}
for (k = 0; k < BSIZES; ++k) {
for (k = 0; k < BSIZES; ++k)
{
/* Both on SAME alignment */
do_test_memcpy((UCHAR *) source + 1, (UCHAR *) destination + 1,
block_sizes[k]);
do_test_memcpy((UCHAR *) source + 1, (UCHAR *) destination + 1, block_sizes[k]);
}
for (k = 0; k < BSIZES; ++k) {
for (k = 0; k < BSIZES; ++k)
{
/* Different alignments */
do_test_memcpy((UCHAR *) source + 1, (UCHAR *) destination + 3,
block_sizes[k]);
do_test_memcpy((UCHAR *) source + 1, (UCHAR *) destination + 3, block_sizes[k]);
}
fflush(stdout);
@ -209,9 +211,7 @@ empty_procedure()
{
}
do_test_memset(dest, size)
void *dest;
int size;
do_test_memset(void* dest, int size)
{
int j;
int r;
@ -219,7 +219,8 @@ do_test_memset(dest, size)
init_time();
for (r = 0; r < TEST_REPEATS; r++) {
for (r = 0; r < TEST_REPEATS; r++)
{
start_time();
for (j = 0; j < MCOUNT; ++j)
MOV_fill((SLONG *) dest, (ULONG) size);
@ -230,7 +231,8 @@ do_test_memset(dest, size)
report_time(message_buffer);
init_time();
for (r = 0; r < TEST_REPEATS; r++) {
for (r = 0; r < TEST_REPEATS; r++)
{
start_time();
for (j = 0; j < MCOUNT; ++j)
memset(dest, 0, size);
@ -241,13 +243,16 @@ do_test_memset(dest, size)
report_time(message_buffer);
init_time();
for (r = 0; r < TEST_REPEATS; r++) {
for (r = 0; r < TEST_REPEATS; r++)
{
char *p, *p_end;
start_time();
for (j = 0; j < MCOUNT; ++j)
{
for (p = dest, p_end = p + size; p < p_end;)
*p++ = 0;
}
stop_time();
}
sprintf(message_buffer, "Dest align %1d Size %4d %20s",
@ -261,11 +266,13 @@ const int SIZE_OPTIMAL_MEMCPY_INLINE = 16;
const int SIZE_OPTIMAL_MEMCPY_MEMCPY = 160;
init_time();
for (r = 0; r < TEST_REPEATS; r++) {
for (r = 0; r < TEST_REPEATS; r++)
{
char *p, *p_end;
start_time();
for (j = 0; j < MCOUNT; ++j)
{
if (size < SIZE_OPTIMAL_MEMSET_INLINE)
for (p = dest, p_end = p + size; p < p_end;)
*p++ = 0;
@ -273,6 +280,7 @@ const int SIZE_OPTIMAL_MEMCPY_MEMCPY = 160;
memset(dest, 0, size);
else
MOV_fill((SLONG *) dest, (ULONG) size);
}
stop_time();
}
sprintf(message_buffer, "Dest align %1d Size %4d %20s",
@ -281,18 +289,15 @@ const int SIZE_OPTIMAL_MEMCPY_MEMCPY = 160;
}
do_test_memcpy(src, dest, size)
void *src;
void *dest;
int size;
do_test_memcpy(void* src, void* dest, int size)
{
int j;
int r;
char message_buffer[150];
init_time();
for (r = 0; r < TEST_REPEATS; r++) {
for (r = 0; r < TEST_REPEATS; r++)
{
start_time();
{
for (j = 0; j < MCOUNT; ++j)
@ -306,7 +311,8 @@ do_test_memcpy(src, dest, size)
report_time(message_buffer);
init_time();
for (r = 0; r < TEST_REPEATS; r++) {
for (r = 0; r < TEST_REPEATS; r++)
{
start_time();
{
for (j = 0; j < MCOUNT; ++j)
@ -321,9 +327,11 @@ do_test_memcpy(src, dest, size)
/* MOV_faster can only do aligned moves, so don't test it otherwise */
if (((((U_IPTR) dest) % sizeof(ULONG)) == 0) &&
((((U_IPTR) src) % sizeof(ULONG)) == 0)) {
((((U_IPTR) src) % sizeof(ULONG)) == 0))
{
init_time();
for (r = 0; r < TEST_REPEATS; r++) {
for (r = 0; r < TEST_REPEATS; r++)
{
start_time();
{
for (j = 0; j < MCOUNT; ++j)
@ -338,13 +346,16 @@ do_test_memcpy(src, dest, size)
}
init_time();
for (r = 0; r < TEST_REPEATS; r++) {
for (r = 0; r < TEST_REPEATS; r++)
{
char *p, *q, *p_end;
start_time();
for (j = 0; j < MCOUNT; ++j)
{
for (p = dest, q = src, p_end = p + size; p < p_end;)
*p++ = *q++;
}
stop_time();
}
sprintf(message_buffer, "Src align %1d Dest align %1d Size %4d %20s",
@ -353,11 +364,13 @@ do_test_memcpy(src, dest, size)
report_time(message_buffer);
init_time();
for (r = 0; r < TEST_REPEATS; r++) {
for (r = 0; r < TEST_REPEATS; r++)
{
char *p, *q, *p_end;
start_time();
for (j = 0; j < MCOUNT; ++j)
{
if (size < SIZE_OPTIMAL_MEMCPY_INLINE)
for (p = dest, q = src, p_end = p + size; p < p_end;)
*p++ = *q++;
@ -367,6 +380,7 @@ do_test_memcpy(src, dest, size)
MOV_faster((SLONG *) src, (SLONG *) dest, (ULONG) size);
else
memcpy(dest, src, size);
}
stop_time();
}
sprintf(message_buffer, "Src align %1d Dest align %1d Size %4d %20s",
@ -389,7 +403,7 @@ USHORT CVT_make_string()
{
}
SSHORT CVT2_compare()
int CVT2_compare()
{
}

View File

@ -80,18 +80,16 @@ int main( int argc, char **argv)
SSHORT msg_number;
printf("\nHit Ctrl-D (or Ctrl-Z) at prompt to exit level\n");
printf
("You will be prompted for facility, module, routine and message text\n");
printf
("You *must* enter module and routine names for each message; be prepared\n");
printf("You will be prompted for facility, module, routine and message text\n");
printf("You *must* enter module and routine names for each message; be prepared\n");
printf("You may assign an optional symbol for the message\n");
printf
("Escape sequences may be entered and will be translated to single bytes\n");
printf("Escape sequences may be entered and will be translated to single bytes\n");
READY;
START_TRANSACTION;
for (;;) {
for (;;)
{
printf("Facility: ");
if (!gets(facility))
break;
@ -100,7 +98,8 @@ int main( int argc, char **argv)
ascii_str_upper(facility);
FOR X IN FACILITIES WITH X.FACILITY = facility
count++;
for (;;) {
for (;;)
{
bool sys_error = false;
printf("Message number (%d) ? ", msg_number + 1);
@ -134,7 +133,8 @@ int main( int argc, char **argv)
END_FOR
printf(" Modify? ");
if (mustget(yesno) && (yesno[0] == 'y' || yesno[0] == 'Y')) {
if (mustget(yesno) && (yesno[0] == 'y' || yesno[0] == 'Y'))
{
module[0] = 0;
printf(" Module: ");
if (!gets(module))
@ -151,7 +151,8 @@ int main( int argc, char **argv)
printf(" Symbol: ");
if (!gets(symbol))
break;
if (sys_error || X.FAC_CODE == 0) {
if (sys_error || X.FAC_CODE == 0)
{
printf("SQLCODE: ");
if (mustget(nstring))
sql_number = atoi(nstring);
@ -171,9 +172,7 @@ int main( int argc, char **argv)
if (text[0])
while (!translate(text, Y.TEXT, sizeof(Y.TEXT)))
{
printf
("Message too long: max length: %d\n",
sizeof(Y.TEXT));
printf("Message too long: max length: %d\n", sizeof(Y.TEXT));
mustget(text);
}
if (symbol[0])
@ -197,7 +196,8 @@ int main( int argc, char **argv)
}
}
END_FOR;
if (!count) {
if (!count)
{
printf("Facilty %s not found\n Known facilities are:\n",
facility);
FOR F IN FACILITIES SORTED BY F.FACILITY
@ -228,7 +228,8 @@ static void ascii_str_upper( char* str)
*
**************************************/
while (*str) {
while (*str)
{
/* subtract 32 if necessary */
if (*str >= LOWER_A && *str <= LOWER_Z)
@ -314,7 +315,8 @@ static bool get_sql_class(char* sql_class)
* return true if we get one, otherwise false
*
**************************************/
while (true) {
while (true)
{
printf(" SQLCLASS: ");
gets(sql_class);
const SSHORT length = strlen(sql_class);
@ -344,7 +346,8 @@ static bool get_sql_subclass(char* sql_sub_class)
* return true if we get one, otherwise false
*
**************************************/
while (true) {
while (true)
{
printf("SQLSUBCLASS: ");
gets(sql_sub_class);
const SSHORT length = strlen(sql_sub_class);
@ -373,7 +376,8 @@ static bool get_symbol(char* symbol)
* return true when we get one
*
**************************************/
while (true) {
while (true)
{
fprintf(stderr, "Symbols are required for system errors!\n");
printf(" Symbol: ");
gets(symbol);
@ -425,7 +429,8 @@ static bool translate(const char* source, char* target, SSHORT length)
if (!--length)
return false;
if (*q == '\\') {
if (*q == '\\')
{
*q++;
switch (*q)
{

View File

@ -82,6 +82,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
if (*p != '-')
sw_bad = true;
else
{
switch (UPPER(p[1]))
{
case 'D':
@ -95,6 +96,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
default:
sw_bad = true;
}
}
if (sw_bad)
{
printf("Invalid option \"%s\". Valid options are:\n", p);
@ -108,7 +110,8 @@ int CLIB_ROUTINE main( int argc, char *argv[])
if (ind_jrd = fopen(INCLUDE_INDICATOR, "r"))
{
if (!fstat(fileno(ind_jrd), &file_stat)) {
if (!fstat(fileno(ind_jrd), &file_stat))
{
isc_encode_date(localtime(&file_stat.st_mtime), (ISC_QUAD*) &date_jrd);
flag_jrd = false;
}
@ -117,7 +120,8 @@ int CLIB_ROUTINE main( int argc, char *argv[])
if (ind_msg = fopen(MESSAGE_INDICATOR, "r"))
{
if (!fstat(fileno(ind_msg), &file_stat)) {
if (!fstat(fileno(ind_msg), &file_stat))
{
isc_encode_date(localtime(&file_stat.st_mtime), (ISC_QUAD*) &date_msg);
flag_msg = false;
}
@ -129,7 +133,8 @@ int CLIB_ROUTINE main( int argc, char *argv[])
flag_loc = true;
if (ind_loc = fopen(LOCALE_INDICATOR, "r"))
{
if (!fstat(fileno(ind_loc), &file_stat)) {
if (!fstat(fileno(ind_loc), &file_stat))
{
isc_encode_date(localtime(&file_stat.st_mtime), (ISC_QUAD*) &date_loc);
flag_loc = false;
}
@ -173,22 +178,31 @@ int CLIB_ROUTINE main( int argc, char *argv[])
FINISH;
if (flag_jrd)
if (ind_jrd = fopen(INCLUDE_INDICATOR, "w")) {
{
if (ind_jrd = fopen(INCLUDE_INDICATOR, "w"))
{
fputc(' ', ind_jrd);
fclose(ind_jrd);
}
}
if (flag_msg)
if (ind_msg = fopen(MESSAGE_INDICATOR, "w")) {
{
if (ind_msg = fopen(MESSAGE_INDICATOR, "w"))
{
fputc(' ', ind_msg);
fclose(ind_msg);
}
}
if (flag_loc)
if (ind_loc = fopen(LOCALE_INDICATOR, "w")) {
{
if (ind_loc = fopen(LOCALE_INDICATOR, "w"))
{
fputc(' ', ind_loc);
fclose(ind_loc);
}
}
exit(FINI_OK);
}

View File

@ -96,14 +96,11 @@ int main( int argc, char **argv)
memset(pub, 0, sizeof(pub));
printf("\nHit Ctrl-D (or Ctrl-Z) at prompt to exit level\n");
printf
("You will be prompted for facility, module, routine and message text\n");
printf
("You *must* enter module and routine names for each message; be prepared\n");
printf("You will be prompted for facility, module, routine and message text\n");
printf("You *must* enter module and routine names for each message; be prepared\n");
printf("You will be returned a message number for the message\n");
printf("You may assign an optional symbol for the message\n");
printf
("Escape sequences may be entered and will be translated to single bytes\n");
printf("Escape sequences may be entered and will be translated to single bytes\n");
READY;
START_TRANSACTION;
@ -140,7 +137,8 @@ int main( int argc, char **argv)
/* All JRD messages are public. Only ask if entering messages
* in a component other than JRD */
if (X.FAC_CODE != 0) {
if (X.FAC_CODE != 0)
{
printf("Public [y/n]: ");
gets((char*) pub);
if (*pub == 'Y' || *pub == 'y')
@ -177,13 +175,15 @@ int main( int argc, char **argv)
S.SQL_CODE = sql_num;
strcpy(S.GDS_SYMBOL, symbol);
if (sql_class[0]) {
if (sql_class[0])
{
strcpy(S.SQL_CLASS, sql_class);
S.SQL_CLASS.NULL = FALSE;
}
else
S.SQL_CLASS.NULL = TRUE;
if (sql_sub_class[0]) {
if (sql_sub_class[0])
{
strcpy(S.SQL_SUBCLASS, sql_sub_class);
S.SQL_SUBCLASS.NULL = FALSE;
}
@ -199,9 +199,9 @@ int main( int argc, char **argv)
strcpy(Y.MODULE, module);
strcpy(Y.ROUTINE, routine);
strcpy(Y.SYMBOL, symbol);
if (!translate(text, (UCHAR*) Y.TEXT, sizeof(Y.TEXT))) {
printf
("Message too long: max length: %d\n",
if (!translate(text, (UCHAR*) Y.TEXT, sizeof(Y.TEXT)))
{
printf("Message too long: max length: %d\n",
sizeof(Y.TEXT));
break;
}
@ -212,7 +212,8 @@ int main( int argc, char **argv)
END_MODIFY;
}
END_FOR;
if (!count) {
if (!count)
{
printf("Facilty %s not found\n Known facilities are:\n",
facility);
FOR F IN FACILITIES SORTED BY F.FACILITY
@ -240,7 +241,8 @@ static void ascii_str_upper( UCHAR * str)
*
**************************************/
while (*str) {
while (*str)
{
/* subtract 32 if necessary */
if (*str >= LOWER_A && *str <= LOWER_Z)
@ -317,7 +319,8 @@ static bool get_sql_code( SSHORT * sql_code)
/* Allow for leading sign */
if (*p == '+')
p++;
else if (*p == '-') {
else if (*p == '-')
{
p++;
sign = -1;
}
@ -327,7 +330,8 @@ static bool get_sql_code( SSHORT * sql_code)
p++;
/* and if anything is left, convert to a number .. */
if (*p && isdigit(*p)) {
if (*p && isdigit(*p))
{
sql_num = sign * atoi((char*) p);
*sql_code = sql_num;
ret = true;
@ -342,7 +346,8 @@ static bool get_sql_code( SSHORT * sql_code)
if (ret)
{
bool got_it = false;
if (sql_num < 0) {
if (sql_num < 0)
{
srch_num = 1000 + sql_num;
FOR M IN MESSAGES WITH M.FAC_CODE = FAC_SQL_NEGATIVE
AND M.NUMBER = srch_num
@ -350,7 +355,8 @@ static bool get_sql_code( SSHORT * sql_code)
got_it = true;
END_FOR;
}
else {
else
{
srch_num = sql_num;
FOR M IN MESSAGES WITH M.FAC_CODE = FAC_SQL_POSITIVE
AND M.NUMBER = srch_num
@ -358,9 +364,9 @@ static bool get_sql_code( SSHORT * sql_code)
got_it = true;
END_FOR;
}
if (!got_it) {
printf("Warning: SQL code %d is not in the SQLERR facility.\n",
sql_num);
if (!got_it)
{
printf("Warning: SQL code %d is not in the SQLERR facility.\n", sql_num);
printf("You will need to add it there too.\n");
}
}
@ -391,10 +397,8 @@ static bool get_sql_subclass( char* sql_sub_class)
if (length == 3)
return true;
else {
fprintf(stderr, "Sqlsubclass is three characters!\n");
continue;
}
fprintf(stderr, "Sqlsubclass is three characters!\n");
}
return false;
@ -415,7 +419,8 @@ static bool get_symbol( char* symbol)
* or false if user breaks out
*
**************************************/
while (true) {
while (true)
{
fprintf(stderr, "Symbols are required for system errors!\n");
printf(" Symbol: ");
gets(symbol);
@ -456,20 +461,22 @@ static bool store_sql_msg()
break;
STORE Y IN MESSAGES USING
if (sql_num < 0) {
if (sql_num < 0)
{
Y.NUMBER = 1000 + sql_num;
Y.FAC_CODE = FAC_SQL_NEGATIVE;
}
else {
else
{
Y.NUMBER = sql_num;
Y.FAC_CODE = FAC_SQL_POSITIVE;
}
/* translate escape sequences to single bytes */
if (!translate(text, (UCHAR*) Y.TEXT, sizeof(Y.TEXT))) {
printf("Message too long: max length: %d\n",
sizeof(Y.TEXT));
if (!translate(text, (UCHAR*) Y.TEXT, sizeof(Y.TEXT)))
{
printf("Message too long: max length: %d\n", sizeof(Y.TEXT));
return false;
}
END_STORE;
@ -498,7 +505,8 @@ static bool translate( const UCHAR* source, UCHAR* target, SSHORT length)
{
if (!--length)
return false;
if (*q == '\\') {
if (*q == '\\')
{
*q++;
switch (*q)
{

View File

@ -67,6 +67,7 @@ void main( int argc, char **argv)
{
const char* p = *argv++;
if (*p == '-')
{
switch (UPPER(p[1]))
{
case 'F':
@ -85,6 +86,7 @@ void main( int argc, char **argv)
sw_all = true;
continue;
}
}
printf("Bad switch %s\n", *p);
exit(FINI_ERROR);
}
@ -124,17 +126,20 @@ static bool check_option(const SCHAR* string,
**************************************/
SCHAR **format;
if (!strcmp(string, "BYTE")) {
if (!strcmp(string, "BYTE"))
{
*option_ptr |= OPT_byte;
return true;
}
if (!strcmp(string, "SIGNED")) {
if (!strcmp(string, "SIGNED"))
{
*option_ptr |= OPT_signed;
return true;
}
if (!strcmp(string, "SANS_DOLLAR")) {
if (!strcmp(string, "SANS_DOLLAR"))
{
*option_ptr |= OPT_sans_dollar;
return true;
}
@ -143,10 +148,13 @@ static bool check_option(const SCHAR* string,
return false;
for (format = formats; *format; format += 2)
if (!strcmp(string, *format)) {
{
if (!strcmp(string, *format))
{
*format_ptr = format[1];
return true;
}
}
return false;
}
@ -166,7 +174,8 @@ static void define_format( const SCHAR* name, SCHAR * format)
**************************************/
SCHAR **ptr;
if (!name) {
if (!name)
{
printf("Format redefined\n");
return;
}
@ -212,7 +221,8 @@ static void gen( const char* language, const char* filename)
FOR X IN TEMPLATES WITH X.LANGUAGE EQ language
if (!filename)
filename = FILE;
if (!(output = fopen(filename, "w"))) {
if (!(output = fopen(filename, "w")))
{
perror(FILE);
return;
}
@ -247,7 +257,8 @@ static void process_line( FILE * file, const SCHAR* line_ptr)
/* If the line doesn't start with a $, just copy it */
if (*line != '$') {
if (*line != '$')
{
fprintf(output, "%s\n", line);
return;
}
@ -258,11 +269,13 @@ static void process_line( FILE * file, const SCHAR* line_ptr)
SCHAR** word = words;
++line;
while (*line) {
while (*line)
{
*word = 0;
while (*line == ' ' || *line == '\t')
line++;
if (*line == '"') {
if (*line == '"')
{
++line;
break;
}
@ -274,24 +287,30 @@ static void process_line( FILE * file, const SCHAR* line_ptr)
--word;
}
if (!format) {
if (!format)
{
for (format = p, line; *line;)
{
if ((c = *line++) != '\\')
*p++ = c;
else if (*line == 'n') {
else if (*line == 'n')
{
*p++ = '\n';
++line;
}
else if (*line == 't') {
else if (*line == 't')
{
*p++ = '\t';
++line;
}
else
*p++ = c;
}
*p = 0;
}
if (!words[0]) {
if (!words[0])
{
printf("no class for line\n");
return;
}
@ -354,12 +373,14 @@ static void put_symbol(FILE* file,
**************************************/
SCHAR buffer[64];
if (!format) {
if (!format)
{
printf("No format for symbol\n");
return;
}
if (options & OPT_byte) {
if (options & OPT_byte)
{
if (value > 255)
return;
value = (UCHAR) value;
@ -368,11 +389,14 @@ static void put_symbol(FILE* file,
if (options & OPT_signed)
value = (SCHAR) value;
if (options & OPT_sans_dollar) {
if (options & OPT_sans_dollar)
{
SCHAR* p;
for (p = buffer; *symbol; symbol++)
{
if (*symbol != '$')
*p++ = *symbol;
}
*p = 0;
symbol = buffer;
}
@ -396,7 +420,8 @@ static void put_symbols(FILE* file,
**************************************/
int count = 0;
if (words[1] && strcmp(words[1], "*")) {
if (words[1] && strcmp(words[1], "*"))
{
FOR X IN SYMBOLS WITH X.CLASS EQ words[0] AND X.TYPE EQ words[1] SORTED BY X.SEQUENCE
++count;
put_symbol(file, format, X.SYMBOL, X.VALUE, options);
@ -404,7 +429,8 @@ static void put_symbols(FILE* file,
if (!count)
printf("No symbols found for %s/%s\n", words[0], words[1]);
}
else {
else
{
FOR X IN SYMBOLS WITH X.CLASS EQ words[0] SORTED BY X.SEQUENCE
++count;
put_symbol(file, format, X.SYMBOL, X.VALUE, options);

View File

@ -56,7 +56,8 @@ int main( int argc, char **argv)
READY;
START_TRANSACTION;
for (;;) {
for (;;)
{
printf("Facility: ");
if (!gets(facility))
break;

View File

@ -396,11 +396,11 @@ static SSHORT get_switches(int argc,
break;
case IN_SW_IBMGR_PIDFILE:
{
Firebird::PathName pf(string);
pf.copyTo(ibmgr_data->pidfile, sizeof(ibmgr_data->pidfile));
{
Firebird::PathName pf(string);
pf.copyTo(ibmgr_data->pidfile, sizeof(ibmgr_data->pidfile));
}
break;
}
case IN_SW_IBMGR_0:
SRVRMGR_msg_get(MSG_INVPAR, msg);

View File

@ -981,7 +981,9 @@ static void print_db_header( FILE* file, const header_page* header)
SLONG number;
const UCHAR* p = header->hdr_data;
for (const UCHAR* const end = p + header->hdr_page_size; p < end && *p != HDR_end; p += 2 + p[1])
for (const UCHAR* const end = p + header->hdr_page_size;
p < end && *p != HDR_end;
p += 2 + p[1])
{
switch (*p)
{
@ -1124,8 +1126,7 @@ static void write_headers(FILE* file, rbdb* rbdb, ULONG lower, ULONG upper)
fprintf(file, "data page, checksum %d\n", page->pag_checksum);
const data_page* data = (data_page*) page;
fprintf(file, "\trelation %d, sequence %ld, records on page %d\n",
data->dpg_relation, data->dpg_sequence,
data->dpg_count);
data->dpg_relation, data->dpg_sequence, data->dpg_count);
fprintf(file, "\t%s%s%s%s\n",
(data->pag_flags & dpg_orphan) ? "orphan " : "",
(data->pag_flags & dpg_full) ? "full " : "",
@ -1163,8 +1164,7 @@ static void write_headers(FILE* file, rbdb* rbdb, ULONG lower, ULONG upper)
fprintf(file, "blob page, checksum %d\n", page->pag_checksum);
const blob_page* blob = (blob_page*) page;
fprintf(file, "\tlead page: %ld, sequence: %ld, length: %d\n",
blob->blp_lead_page, blob->blp_sequence,
blob->blp_length);
blob->blp_lead_page, blob->blp_sequence, blob->blp_length);
fprintf(file, "\tcontains %s\n",
(blob->pag_flags & blp_pointers) ? "pointers" : "data");
}

View File

@ -83,12 +83,14 @@ int CLIB_ROUTINE main( int argc, char **argv)
{
TEXT c;
while (c = *p++)
{
switch (UPPER(c))
{
case 'Z':
printf("Firebird relay version %s\n", FB_VERSION);
exit(FINI_OK);
}
}
}
}
@ -117,7 +119,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
fprintf(stderr, "gds_relay received inconsistent message");
}
#endif
if (kill(msg[0], msg[1])) {
if (kill(msg[0], msg[1]))
{
#ifdef DEV_BUILD
fprintf(stderr, "gds_relay error on kill()");
#endif