file
stringlengths 18
26
| data
stringlengths 3
1.04M
|
---|---|
the_stack_data/88272.c | // Usando switch, faça um programa para ler dois valores e apresentar
// para o usuário o menu de opções conforme abaixo. Em seguida, o
// programa deverá ler a opção indicada pelo usuário e efetuar a operação
// desejada. Adicionalmente, o programa deve apresentar uma mensagem
// de erro caso a opção digitada for inválida.
#include <stdio.h>
int main()
{
float numero_1, numero_2;
int numero_operacao;
printf("Insira dois numeros: ");
scanf("%f%f", &numero_1, &numero_2);
printf("1- Somar os dois numeros\n2- Subtrair os dois numeros\n3- Multiplicar os dois numeros\n4- Dividir os dois numeros (o denominador não pode ser zero)\n5- Sair\n\nDigite uma opcao: ");
scanf("%d", &numero_operacao);
switch (numero_operacao)
{
case 1:
printf("%f", numero_1 + numero_2);
break;
case 2:
printf("%f", numero_1 - numero_2);
break;
case 3:
printf("%f", numero_1 * numero_2);
break;
case 4:
if (numero_2 != 0)
{
printf("%f", numero_1 / numero_2);
}
else
{
printf("Nao eh possivel dividir por 0");
}
break;
case 5:
break;
default:
printf("Entrada invalida");
}
return 0;
} |
the_stack_data/1139612.c | /***************************************************************************/
/* */
/* ftdbgmem.c */
/* */
/* Memory debugger (body). */
/* */
/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifdef FT_DEBUG_MEMORY
#define KEEPALIVE /* `Keep alive' means that freed blocks aren't released
* to the heap. This is useful to detect double-frees
* or weird heap corruption, but it uses large amounts of
* memory, however.
*/
#include FT_CONFIG_STANDARD_LIBRARY_H
FT_BASE_DEF( const char* ) _ft_debug_file = 0;
FT_BASE_DEF( long ) _ft_debug_lineno = 0;
extern void
FT_DumpMemory( FT_Memory memory );
typedef struct FT_MemSourceRec_* FT_MemSource;
typedef struct FT_MemNodeRec_* FT_MemNode;
typedef struct FT_MemTableRec_* FT_MemTable;
#define FT_MEM_VAL( addr ) ((FT_PtrDist)(FT_Pointer)( addr ))
/*
* This structure holds statistics for a single allocation/release
* site. This is useful to know where memory operations happen the
* most.
*/
typedef struct FT_MemSourceRec_
{
const char* file_name;
long line_no;
FT_Long cur_blocks; /* current number of allocated blocks */
FT_Long max_blocks; /* max. number of allocated blocks */
FT_Long all_blocks; /* total number of blocks allocated */
FT_Long cur_size; /* current cumulative allocated size */
FT_Long max_size; /* maximum cumulative allocated size */
FT_Long all_size; /* total cumulative allocated size */
FT_Long cur_max; /* current maximum allocated size */
FT_UInt32 hash;
FT_MemSource link;
} FT_MemSourceRec;
/*
* We don't need a resizable array for the memory sources, because
* their number is pretty limited within FreeType.
*/
#define FT_MEM_SOURCE_BUCKETS 128
/*
* This structure holds information related to a single allocated
* memory block. If KEEPALIVE is defined, blocks that are freed by
* FreeType are never released to the system. Instead, their `size'
* field is set to -size. This is mainly useful to detect double frees,
* at the price of large memory footprint during execution.
*/
typedef struct FT_MemNodeRec_
{
FT_Byte* address;
FT_Long size; /* < 0 if the block was freed */
FT_MemSource source;
#ifdef KEEPALIVE
const char* free_file_name;
FT_Long free_line_no;
#endif
FT_MemNode link;
} FT_MemNodeRec;
/*
* The global structure, containing compound statistics and all hash
* tables.
*/
typedef struct FT_MemTableRec_
{
FT_ULong size;
FT_ULong nodes;
FT_MemNode* buckets;
FT_ULong alloc_total;
FT_ULong alloc_current;
FT_ULong alloc_max;
FT_ULong alloc_count;
FT_Bool bound_total;
FT_ULong alloc_total_max;
FT_Bool bound_count;
FT_ULong alloc_count_max;
FT_MemSource sources[FT_MEM_SOURCE_BUCKETS];
FT_Bool keep_alive;
FT_Memory memory;
FT_Pointer memory_user;
FT_Alloc_Func alloc;
FT_Free_Func free;
FT_Realloc_Func realloc;
} FT_MemTableRec;
#define FT_MEM_SIZE_MIN 7
#define FT_MEM_SIZE_MAX 13845163
#define FT_FILENAME( x ) ((x) ? (x) : "unknown file")
/*
* Prime numbers are ugly to handle. It would be better to implement
* L-Hashing, which is 10% faster and doesn't require divisions.
*/
static const FT_UInt ft_mem_primes[] =
{
7,
11,
19,
37,
73,
109,
163,
251,
367,
557,
823,
1237,
1861,
2777,
4177,
6247,
9371,
14057,
21089,
31627,
47431,
71143,
106721,
160073,
240101,
360163,
540217,
810343,
1215497,
1823231,
2734867,
4102283,
6153409,
9230113,
13845163,
};
static FT_ULong
ft_mem_closest_prime( FT_ULong num )
{
FT_UInt i;
for ( i = 0;
i < sizeof ( ft_mem_primes ) / sizeof ( ft_mem_primes[0] ); i++ )
if ( ft_mem_primes[i] > num )
return ft_mem_primes[i];
return FT_MEM_SIZE_MAX;
}
extern void
ft_mem_debug_panic( const char* fmt,
... )
{
va_list ap;
printf( "FreeType.Debug: " );
va_start( ap, fmt );
vprintf( fmt, ap );
va_end( ap );
printf( "\n" );
exit( EXIT_FAILURE );
}
static FT_Pointer
ft_mem_table_alloc( FT_MemTable table,
FT_Long size )
{
FT_Memory memory = table->memory;
FT_Pointer block;
memory->user = table->memory_user;
block = table->alloc( memory, size );
memory->user = table;
return block;
}
static void
ft_mem_table_free( FT_MemTable table,
FT_Pointer block )
{
FT_Memory memory = table->memory;
memory->user = table->memory_user;
table->free( memory, block );
memory->user = table;
}
static void
ft_mem_table_resize( FT_MemTable table )
{
FT_ULong new_size;
new_size = ft_mem_closest_prime( table->nodes );
if ( new_size != table->size )
{
FT_MemNode* new_buckets;
FT_ULong i;
new_buckets = (FT_MemNode *)
ft_mem_table_alloc( table,
new_size * sizeof ( FT_MemNode ) );
if ( new_buckets == NULL )
return;
FT_ARRAY_ZERO( new_buckets, new_size );
for ( i = 0; i < table->size; i++ )
{
FT_MemNode node, next, *pnode;
FT_PtrDist hash;
node = table->buckets[i];
while ( node )
{
next = node->link;
hash = FT_MEM_VAL( node->address ) % new_size;
pnode = new_buckets + hash;
node->link = pnode[0];
pnode[0] = node;
node = next;
}
}
if ( table->buckets )
ft_mem_table_free( table, table->buckets );
table->buckets = new_buckets;
table->size = new_size;
}
}
static FT_MemTable
ft_mem_table_new( FT_Memory memory )
{
FT_MemTable table;
table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) );
if ( table == NULL )
goto Exit;
FT_ZERO( table );
table->size = FT_MEM_SIZE_MIN;
table->nodes = 0;
table->memory = memory;
table->memory_user = memory->user;
table->alloc = memory->alloc;
table->realloc = memory->realloc;
table->free = memory->free;
table->buckets = (FT_MemNode *)
memory->alloc( memory,
table->size * sizeof ( FT_MemNode ) );
if ( table->buckets )
FT_ARRAY_ZERO( table->buckets, table->size );
else
{
memory->free( memory, table );
table = NULL;
}
Exit:
return table;
}
static void
ft_mem_table_destroy( FT_MemTable table )
{
FT_ULong i;
FT_DumpMemory( table->memory );
if ( table )
{
FT_Long leak_count = 0;
FT_ULong leaks = 0;
/* remove all blocks from the table, revealing leaked ones */
for ( i = 0; i < table->size; i++ )
{
FT_MemNode *pnode = table->buckets + i, next, node = *pnode;
while ( node )
{
next = node->link;
node->link = 0;
if ( node->size > 0 )
{
printf(
"leaked memory block at address %p, size %8ld in (%s:%ld)\n",
node->address, node->size,
FT_FILENAME( node->source->file_name ),
node->source->line_no );
leak_count++;
leaks += node->size;
ft_mem_table_free( table, node->address );
}
node->address = NULL;
node->size = 0;
ft_mem_table_free( table, node );
node = next;
}
table->buckets[i] = 0;
}
ft_mem_table_free( table, table->buckets );
table->buckets = NULL;
table->size = 0;
table->nodes = 0;
/* remove all sources */
for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ )
{
FT_MemSource source, next;
for ( source = table->sources[i]; source != NULL; source = next )
{
next = source->link;
ft_mem_table_free( table, source );
}
table->sources[i] = NULL;
}
printf(
"FreeType: total memory allocations = %ld\n", table->alloc_total );
printf(
"FreeType: maximum memory footprint = %ld\n", table->alloc_max );
ft_mem_table_free( table, table );
if ( leak_count > 0 )
ft_mem_debug_panic(
"FreeType: %ld bytes of memory leaked in %ld blocks\n",
leaks, leak_count );
printf( "FreeType: no memory leaks detected\n" );
}
}
static FT_MemNode*
ft_mem_table_get_nodep( FT_MemTable table,
FT_Byte* address )
{
FT_PtrDist hash;
FT_MemNode *pnode, node;
hash = FT_MEM_VAL( address );
pnode = table->buckets + ( hash % table->size );
for (;;)
{
node = pnode[0];
if ( !node )
break;
if ( node->address == address )
break;
pnode = &node->link;
}
return pnode;
}
static FT_MemSource
ft_mem_table_get_source( FT_MemTable table )
{
FT_UInt32 hash;
FT_MemSource node, *pnode;
/* cast to FT_PtrDist first since void* can be larger */
/* than FT_UInt32 and GCC 4.1.1 emits a warning */
hash = (FT_UInt32)(FT_PtrDist)(void*)_ft_debug_file +
(FT_UInt32)( 5 * _ft_debug_lineno );
pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];
for ( ;; )
{
node = *pnode;
if ( node == NULL )
break;
if ( node->file_name == _ft_debug_file &&
node->line_no == _ft_debug_lineno )
goto Exit;
pnode = &node->link;
}
node = (FT_MemSource)ft_mem_table_alloc( table, sizeof ( *node ) );
if ( node == NULL )
ft_mem_debug_panic(
"not enough memory to perform memory debugging\n" );
node->file_name = _ft_debug_file;
node->line_no = _ft_debug_lineno;
node->cur_blocks = 0;
node->max_blocks = 0;
node->all_blocks = 0;
node->cur_size = 0;
node->max_size = 0;
node->all_size = 0;
node->cur_max = 0;
node->link = NULL;
node->hash = hash;
*pnode = node;
Exit:
return node;
}
static void
ft_mem_table_set( FT_MemTable table,
FT_Byte* address,
FT_ULong size,
FT_Long delta )
{
FT_MemNode *pnode, node;
if ( table )
{
FT_MemSource source;
pnode = ft_mem_table_get_nodep( table, address );
node = *pnode;
if ( node )
{
if ( node->size < 0 )
{
/* This block was already freed. Our memory is now completely */
/* corrupted! */
/* This can only happen in keep-alive mode. */
ft_mem_debug_panic(
"memory heap corrupted (allocating freed block)" );
}
else
{
/* This block was already allocated. This means that our memory */
/* is also corrupted! */
ft_mem_debug_panic(
"memory heap corrupted (re-allocating allocated block at"
" %p, of size %ld)\n"
"org=%s:%d new=%s:%d\n",
node->address, node->size,
FT_FILENAME( node->source->file_name ), node->source->line_no,
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );
}
}
/* we need to create a new node in this table */
node = (FT_MemNode)ft_mem_table_alloc( table, sizeof ( *node ) );
if ( node == NULL )
ft_mem_debug_panic( "not enough memory to run memory tests" );
node->address = address;
node->size = size;
node->source = source = ft_mem_table_get_source( table );
if ( delta == 0 )
{
/* this is an allocation */
source->all_blocks++;
source->cur_blocks++;
if ( source->cur_blocks > source->max_blocks )
source->max_blocks = source->cur_blocks;
}
if ( size > (FT_ULong)source->cur_max )
source->cur_max = size;
if ( delta != 0 )
{
/* we are growing or shrinking a reallocated block */
source->cur_size += delta;
table->alloc_current += delta;
}
else
{
/* we are allocating a new block */
source->cur_size += size;
table->alloc_current += size;
}
source->all_size += size;
if ( source->cur_size > source->max_size )
source->max_size = source->cur_size;
node->free_file_name = NULL;
node->free_line_no = 0;
node->link = pnode[0];
pnode[0] = node;
table->nodes++;
table->alloc_total += size;
if ( table->alloc_current > table->alloc_max )
table->alloc_max = table->alloc_current;
if ( table->nodes * 3 < table->size ||
table->size * 3 < table->nodes )
ft_mem_table_resize( table );
}
}
static void
ft_mem_table_remove( FT_MemTable table,
FT_Byte* address,
FT_Long delta )
{
if ( table )
{
FT_MemNode *pnode, node;
pnode = ft_mem_table_get_nodep( table, address );
node = *pnode;
if ( node )
{
FT_MemSource source;
if ( node->size < 0 )
ft_mem_debug_panic(
"freeing memory block at %p more than once at (%s:%ld)\n"
"block allocated at (%s:%ld) and released at (%s:%ld)",
address,
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,
FT_FILENAME( node->source->file_name ), node->source->line_no,
FT_FILENAME( node->free_file_name ), node->free_line_no );
/* scramble the node's content for additional safety */
FT_MEM_SET( address, 0xF3, node->size );
if ( delta == 0 )
{
source = node->source;
source->cur_blocks--;
source->cur_size -= node->size;
table->alloc_current -= node->size;
}
if ( table->keep_alive )
{
/* we simply invert the node's size to indicate that the node */
/* was freed. */
node->size = -node->size;
node->free_file_name = _ft_debug_file;
node->free_line_no = _ft_debug_lineno;
}
else
{
table->nodes--;
*pnode = node->link;
node->size = 0;
node->source = NULL;
ft_mem_table_free( table, node );
if ( table->nodes * 3 < table->size ||
table->size * 3 < table->nodes )
ft_mem_table_resize( table );
}
}
else
ft_mem_debug_panic(
"trying to free unknown block at %p in (%s:%ld)\n",
address,
FT_FILENAME( _ft_debug_file ), _ft_debug_lineno );
}
}
extern FT_Pointer
ft_mem_debug_alloc( FT_Memory memory,
FT_Long size )
{
FT_MemTable table = (FT_MemTable)memory->user;
FT_Byte* block;
if ( size <= 0 )
ft_mem_debug_panic( "negative block size allocation (%ld)", size );
/* return NULL if the maximum number of allocations was reached */
if ( table->bound_count &&
table->alloc_count >= table->alloc_count_max )
return NULL;
/* return NULL if this allocation would overflow the maximum heap size */
if ( table->bound_total &&
table->alloc_total_max - table->alloc_current > (FT_ULong)size )
return NULL;
block = (FT_Byte *)ft_mem_table_alloc( table, size );
if ( block )
{
ft_mem_table_set( table, block, (FT_ULong)size, 0 );
table->alloc_count++;
}
_ft_debug_file = "<unknown>";
_ft_debug_lineno = 0;
return (FT_Pointer)block;
}
extern void
ft_mem_debug_free( FT_Memory memory,
FT_Pointer block )
{
FT_MemTable table = (FT_MemTable)memory->user;
if ( block == NULL )
ft_mem_debug_panic( "trying to free NULL in (%s:%ld)",
FT_FILENAME( _ft_debug_file ),
_ft_debug_lineno );
ft_mem_table_remove( table, (FT_Byte*)block, 0 );
if ( !table->keep_alive )
ft_mem_table_free( table, block );
table->alloc_count--;
_ft_debug_file = "<unknown>";
_ft_debug_lineno = 0;
}
extern FT_Pointer
ft_mem_debug_realloc( FT_Memory memory,
FT_Long cur_size,
FT_Long new_size,
FT_Pointer block )
{
FT_MemTable table = (FT_MemTable)memory->user;
FT_MemNode node, *pnode;
FT_Pointer new_block;
FT_Long delta;
const char* file_name = FT_FILENAME( _ft_debug_file );
FT_Long line_no = _ft_debug_lineno;
/* unlikely, but possible */
if ( new_size == cur_size )
return block;
/* the following is valid according to ANSI C */
#if 0
if ( block == NULL || cur_size == 0 )
ft_mem_debug_panic( "trying to reallocate NULL in (%s:%ld)",
file_name, line_no );
#endif
/* while the following is allowed in ANSI C also, we abort since */
/* such case should be handled by FreeType. */
if ( new_size <= 0 )
ft_mem_debug_panic(
"trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)",
block, cur_size, file_name, line_no );
/* check `cur_size' value */
pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block );
node = *pnode;
if ( !node )
ft_mem_debug_panic(
"trying to reallocate unknown block at %p in (%s:%ld)",
block, file_name, line_no );
if ( node->size <= 0 )
ft_mem_debug_panic(
"trying to reallocate freed block at %p in (%s:%ld)",
block, file_name, line_no );
if ( node->size != cur_size )
ft_mem_debug_panic( "invalid ft_realloc request for %p. cur_size is "
"%ld instead of %ld in (%s:%ld)",
block, cur_size, node->size, file_name, line_no );
/* return NULL if the maximum number of allocations was reached */
if ( table->bound_count &&
table->alloc_count >= table->alloc_count_max )
return NULL;
delta = (FT_Long)( new_size - cur_size );
/* return NULL if this allocation would overflow the maximum heap size */
if ( delta > 0 &&
table->bound_total &&
table->alloc_current + (FT_ULong)delta > table->alloc_total_max )
return NULL;
new_block = (FT_Byte *)ft_mem_table_alloc( table, new_size );
if ( new_block == NULL )
return NULL;
ft_mem_table_set( table, (FT_Byte*)new_block, new_size, delta );
ft_memcpy( new_block, block, cur_size < new_size ? cur_size : new_size );
ft_mem_table_remove( table, (FT_Byte*)block, delta );
_ft_debug_file = "<unknown>";
_ft_debug_lineno = 0;
if ( !table->keep_alive )
ft_mem_table_free( table, block );
return new_block;
}
extern FT_Int
ft_mem_debug_init( FT_Memory memory )
{
FT_MemTable table;
FT_Int result = 0;
if ( getenv( "FT2_DEBUG_MEMORY" ) )
{
table = ft_mem_table_new( memory );
if ( table )
{
const char* p;
memory->user = table;
memory->alloc = ft_mem_debug_alloc;
memory->realloc = ft_mem_debug_realloc;
memory->free = ft_mem_debug_free;
p = getenv( "FT2_ALLOC_TOTAL_MAX" );
if ( p != NULL )
{
FT_Long total_max = ft_atol( p );
if ( total_max > 0 )
{
table->bound_total = 1;
table->alloc_total_max = (FT_ULong)total_max;
}
}
p = getenv( "FT2_ALLOC_COUNT_MAX" );
if ( p != NULL )
{
FT_Long total_count = ft_atol( p );
if ( total_count > 0 )
{
table->bound_count = 1;
table->alloc_count_max = (FT_ULong)total_count;
}
}
p = getenv( "FT2_KEEP_ALIVE" );
if ( p != NULL )
{
FT_Long keep_alive = ft_atol( p );
if ( keep_alive > 0 )
table->keep_alive = 1;
}
result = 1;
}
}
return result;
}
extern void
ft_mem_debug_done( FT_Memory memory )
{
FT_MemTable table = (FT_MemTable)memory->user;
if ( table )
{
memory->free = table->free;
memory->realloc = table->realloc;
memory->alloc = table->alloc;
ft_mem_table_destroy( table );
memory->user = NULL;
}
}
static int
ft_mem_source_compare( const void* p1,
const void* p2 )
{
FT_MemSource s1 = *(FT_MemSource*)p1;
FT_MemSource s2 = *(FT_MemSource*)p2;
if ( s2->max_size > s1->max_size )
return 1;
else if ( s2->max_size < s1->max_size )
return -1;
else
return 0;
}
extern void
FT_DumpMemory( FT_Memory memory )
{
FT_MemTable table = (FT_MemTable)memory->user;
if ( table )
{
FT_MemSource* bucket = table->sources;
FT_MemSource* limit = bucket + FT_MEM_SOURCE_BUCKETS;
FT_MemSource* sources;
FT_UInt nn, count;
const char* fmt;
count = 0;
for ( ; bucket < limit; bucket++ )
{
FT_MemSource source = *bucket;
for ( ; source; source = source->link )
count++;
}
sources = (FT_MemSource*)ft_mem_table_alloc(
table, sizeof ( *sources ) * count );
count = 0;
for ( bucket = table->sources; bucket < limit; bucket++ )
{
FT_MemSource source = *bucket;
for ( ; source; source = source->link )
sources[count++] = source;
}
ft_qsort( sources, count, sizeof ( *sources ), ft_mem_source_compare );
printf( "FreeType Memory Dump: "
"current=%ld max=%ld total=%ld count=%ld\n",
table->alloc_current, table->alloc_max,
table->alloc_total, table->alloc_count );
printf( " block block sizes sizes sizes source\n" );
printf( " count high sum highsum max location\n" );
printf( "-------------------------------------------------\n" );
fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n";
for ( nn = 0; nn < count; nn++ )
{
FT_MemSource source = sources[nn];
printf( fmt,
source->cur_blocks, source->max_blocks,
source->cur_size, source->max_size, source->cur_max,
FT_FILENAME( source->file_name ),
source->line_no );
}
printf( "------------------------------------------------\n" );
ft_mem_table_free( table, sources );
}
}
#else /* !FT_DEBUG_MEMORY */
/* ANSI C doesn't like empty source files */
typedef int _debug_mem_dummy;
#endif /* !FT_DEBUG_MEMORY */
/* END */
|
the_stack_data/175142131.c | #include <stdio.h>
void line(void);
int main()
{
puts("How to Fight Off a Robot Attack");
line();
puts("A Survival Guide for the 21st Century");
line();
return(0);
}
void line(void)
{
int i;
for (i = 0 ; i <= 50; i++)
putchar('-');
putchar ('\n');
} |
the_stack_data/237642136.c | // #anon_enum$XML_ATTRIBUTE_CDATA=1$XML_ATTRIBUTE_ID=2$XML_ATTRIBUTE_IDREF=3$XML_ATTRIBUTE_IDREFS=4$XML_ATTRIBUTE_ENTITY=5$XML_ATTRIBUTE_ENTITIES=6$XML_ATTRIBUTE_NMTOKEN=7$XML_ATTRIBUTE_NMTOKENS=8$XML_ATTRIBUTE_ENUMERATION=9$XML_ATTRIBUTE_NOTATION=10
// file /usr/include/libxml2/libxml/tree.h line 206
enum anonymous$13 { XML_ATTRIBUTE_CDATA=1, XML_ATTRIBUTE_ID=2, XML_ATTRIBUTE_IDREF=3, XML_ATTRIBUTE_IDREFS=4, XML_ATTRIBUTE_ENTITY=5, XML_ATTRIBUTE_ENTITIES=6, XML_ATTRIBUTE_NMTOKEN=7, XML_ATTRIBUTE_NMTOKENS=8, XML_ATTRIBUTE_ENUMERATION=9, XML_ATTRIBUTE_NOTATION=10 };
// #anon_enum$XML_ELEMENT_NODE=1$XML_ATTRIBUTE_NODE=2$XML_TEXT_NODE=3$XML_CDATA_SECTION_NODE=4$XML_ENTITY_REF_NODE=5$XML_ENTITY_NODE=6$XML_PI_NODE=7$XML_COMMENT_NODE=8$XML_DOCUMENT_NODE=9$XML_DOCUMENT_TYPE_NODE=10$XML_DOCUMENT_FRAG_NODE=11$XML_NOTATION_NODE=12$XML_HTML_DOCUMENT_NODE=13$XML_DTD_NODE=14$XML_ELEMENT_DECL=15$XML_ATTRIBUTE_DECL=16$XML_ENTITY_DECL=17$XML_NAMESPACE_DECL=18$XML_XINCLUDE_START=19$XML_XINCLUDE_END=20$XML_DOCB_DOCUMENT_NODE=21
// file /usr/include/libxml2/libxml/tree.h line 159
enum anonymous$10 { XML_ELEMENT_NODE=1, XML_ATTRIBUTE_NODE=2, XML_TEXT_NODE=3, XML_CDATA_SECTION_NODE=4, XML_ENTITY_REF_NODE=5, XML_ENTITY_NODE=6, XML_PI_NODE=7, XML_COMMENT_NODE=8, XML_DOCUMENT_NODE=9, XML_DOCUMENT_TYPE_NODE=10, XML_DOCUMENT_FRAG_NODE=11, XML_NOTATION_NODE=12, XML_HTML_DOCUMENT_NODE=13, XML_DTD_NODE=14, XML_ELEMENT_DECL=15, XML_ATTRIBUTE_DECL=16, XML_ENTITY_DECL=17, XML_NAMESPACE_DECL=18, XML_XINCLUDE_START=19, XML_XINCLUDE_END=20, XML_DOCB_DOCUMENT_NODE=21 };
// tag-#anon#ST[*{S8}$S8$'name'||*{S8}$S8$'op'||*{S8}$S8$'value'|]
// file ../include/zebra_xpath.h line 30
struct anonymous$65;
// tag-#anon#ST[*{SYM#tag-nmem_control#}$SYM#tag-nmem_control#$'nmem'||S32'no_eq'||U32'$pad0'||ARR32{*{S8}$S8$}$*{S8}$S8$$'eq'|]
// file charmap.c line 83
struct anonymous$35;
// tag-#anon#ST[*{cS8}$cS8$'op'||*{SYM#tag-xpath_predicate#}$SYM#tag-xpath_predicate#$'left'||*{SYM#tag-xpath_predicate#}$SYM#tag-xpath_predicate#$'right'|]
// file ../include/zebra_xpath.h line 36
struct anonymous$68;
// tag-#anon#ST[S32'__lock'||U32'__futex'||U64'__total_seq'||U64'__wakeup_seq'||U64'__woken_seq'||*{V}$V$'__mutex'||U32'__nwaiters'||U32'__broadcast_seq'|]
// file /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h line 141
struct anonymous$92;
// tag-#anon#ST[S32'entry_size'|]
// file zebramap.c line 52
struct anonymous$46;
// tag-#anon#ST[S32'readers_reading'||S32'writers_writing'||SYM#tag-#anon#UN[SYM#tag-__pthread_mutex_s#'__data'||ARR40{S8}$S8$'__size'||S64'__align'|]#'mutex'||SYM#tag-#anon#UN[SYM#tag-#anon#ST[S32'__lock'||U32'__futex'||U64'__total_seq'||U64'__wakeup_seq'||U64'__woken_seq'||*{V}$V$'__mutex'||U32'__nwaiters'||U32'__broadcast_seq'|]#'__data'||ARR48{S8}$S8$'__size'||S64'__align'|]#'lock_free'|]
// file ../include/zebra-lock.h line 54
struct anonymous$56;
// tag-#anon#ST[S32'type'||S32'major'||S32'minor'||U32'$pad0'||*{*{SYM#tag-Z_AttributeElement#}$SYM#tag-Z_AttributeElement#$}$*{SYM#tag-Z_AttributeElement#}$SYM#tag-Z_AttributeElement#$$'attributeList'||S32'num_attributes'||U32'$pad1'|]
// file ../include/attrfind.h line 28
struct anonymous$89;
// tag-#anon#ST[SYM#tag-#anon#UN[SYM#tag-__pthread_mutex_s#'__data'||ARR40{S8}$S8$'__size'||S64'__align'|]#'mutex'||S32'state'||U32'$pad0'|]
// file ../include/zebra-lock.h line 36
struct anonymous$54;
// tag-#anon#ST[SYM#tag-#anon#UN[SYM#tag-__pthread_mutex_s#'__data'||ARR40{S8}$S8$'__size'||S64'__align'|]#'mutex'||SYM#tag-#anon#UN[SYM#tag-#anon#ST[S32'__lock'||U32'__futex'||U64'__total_seq'||U64'__wakeup_seq'||U64'__woken_seq'||*{V}$V$'__mutex'||U32'__nwaiters'||U32'__broadcast_seq'|]#'__data'||ARR48{S8}$S8$'__size'||S64'__align'|]#'cond'|]
// file ../include/zebra-lock.h line 70
struct anonymous$49;
// tag-#anon#UN[*{S16}$S16$'oid'||*{S8}$S8$'uri'|]
// file /usr/include/yaz/z-core.h line 811
union anonymous$62;
// tag-#anon#UN[*{S64}$S64$'actualNumber'||*{S64}$S64$'approxNumber'|]
// file /usr/include/yaz/z-exp.h line 341
union anonymous$64;
// tag-#anon#UN[*{S64}$S64$'integer'||*{S8}$S8$'internationalString'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'octetString'||*{S16}$S16$'objectIdentifier'||*{S32}$S32$'boolean'||*{V}$V$'null'||*{SYM#tag-Z_Unit#}$SYM#tag-Z_Unit#$'unit'||*{SYM#tag-Z_IntUnit#}$SYM#tag-Z_IntUnit#$'valueAndUnit'|]
// file /usr/include/yaz/z-grs.h line 152
union anonymous$59;
// tag-#anon#UN[*{S64}$S64$'integer'||*{S8}$S8$'string'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'octets'||*{S16}$S16$'oid'||*{SYM#tag-Z_Unit#}$SYM#tag-Z_Unit#$'unit'||*{SYM#tag-Z_IntUnit#}$SYM#tag-Z_IntUnit#$'valueAndUnit'|]
// file /usr/include/yaz/z-exp.h line 718
union anonymous$74;
// tag-#anon#UN[*{S64}$S64$'known'||*{S64}$S64$'zprivate'|]
// file /usr/include/yaz/z-core.h line 603
union anonymous$15;
// tag-#anon#UN[*{S64}$S64$'known'||*{SYM#tag-Z_ProxSupportPrivate#}$SYM#tag-Z_ProxSupportPrivate#$'zprivate'|]
// file /usr/include/yaz/z-exp.h line 920
union anonymous$22;
// tag-#anon#UN[*{S64}$S64$'number'||*{S8}$S8$'string'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'opaque'|]
// file /usr/include/yaz/zes-update.h line 117
union anonymous$45;
// tag-#anon#UN[*{S64}$S64$'numeric'||*{SYM#tag-Z_ComplexAttribute#}$SYM#tag-Z_ComplexAttribute#$'complex'|]
// file /usr/include/yaz/z-core.h line 583
union anonymous$8;
// tag-#anon#UN[*{S64}$S64$'primitive'||*{SYM#tag-Z_ElementInfoList#}$SYM#tag-Z_ElementInfoList#$'structured'|]
// file /usr/include/yaz/z-exp.h line 407
union anonymous$70;
// tag-#anon#UN[*{S64}$S64$'req'||*{S64}$S64$'permission'||*{S64}$S64$'immediate'|]
// file /usr/include/yaz/z-diag1.h line 261
union anonymous$2;
// tag-#anon#UN[*{S8}$S8$'character'||*{SYM#tag-Z_Encryption#}$SYM#tag-Z_Encryption#$'encrypted'|]
// file /usr/include/yaz/z-accform1.h line 59
union anonymous$52;
// tag-#anon#UN[*{S8}$S8$'characterInfo'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'binaryInfo'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'externallyDefinedInfo'||*{S16}$S16$'oid'|]
// file /usr/include/yaz/z-core.h line 1282
union anonymous$4;
// tag-#anon#UN[*{S8}$S8$'elementSetName'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'externalSpec'|]
// file /usr/include/yaz/z-core.h line 801
union anonymous$67;
// tag-#anon#UN[*{S8}$S8$'ianaType'||*{S8}$S8$'z3950type'||*{S8}$S8$'otherType'|]
// file /usr/include/yaz/z-exp.h line 789
union anonymous$75;
// tag-#anon#UN[*{S8}$S8$'package'||*{SYM#tag-Z_Query#}$SYM#tag-Z_Query#$'query'|]
// file /usr/include/yaz/zes-pquery.h line 67
union anonymous$94;
// tag-#anon#UN[*{S8}$S8$'packageName'||*{SYM#tag-Z_ESExportSpecification#}$SYM#tag-Z_ESExportSpecification#$'exportPackage'|]
// file /usr/include/yaz/zes-psched.h line 73
union anonymous$96;
// tag-#anon#UN[*{S8}$S8$'packageName'||*{SYM#tag-Z_ESExportSpecification#}$SYM#tag-Z_ESExportSpecification#$'packageSpec'|]
// file /usr/include/yaz/zes-expi.h line 68
union anonymous$87;
// tag-#anon#UN[*{S8}$S8$'phoneNumber'||*{S8}$S8$'faxNumber'||*{S8}$S8$'x400address'||*{S8}$S8$'emailAddress'||*{S8}$S8$'pagerNumber'||*{S8}$S8$'ftpAddress'||*{S8}$S8$'ftamAddress'||*{S8}$S8$'printerAddress'||*{SYM#tag-Z_ESDestinationOther#}$SYM#tag-Z_ESDestinationOther#$'other'|]
// file /usr/include/yaz/zes-exps.h line 71
union anonymous$85;
// tag-#anon#UN[*{S8}$S8$'sortField'||*{SYM#tag-Z_Specification#}$SYM#tag-Z_Specification#$'elementSpec'||*{SYM#tag-Z_SortAttributes#}$SYM#tag-Z_SortAttributes#$'sortAttributes'|]
// file /usr/include/yaz/z-core.h line 1109
union anonymous$83;
// tag-#anon#UN[*{S8}$S8$'string'||*{S32}$S32$'accept'||*{V}$V$'acknowledge'||*{SYM#tag-Z_DiagRec#}$SYM#tag-Z_DiagRec#$'diagnostic'||*{SYM#tag-Z_Encryption#}$SYM#tag-Z_Encryption#$'encrypted'|]
// file /usr/include/yaz/z-accform1.h line 88
union anonymous$55;
// tag-#anon#UN[*{S8}$S8$'string'||*{S64}$S64$'numeric'|]
// file /usr/include/yaz/z-core.h line 1320
union anonymous$7;
// tag-#anon#UN[*{S8}$S8$'timeStamp'||*{S8}$S8$'versionNumber'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'previousVersion'|]
// file /usr/include/yaz/zes-update.h line 105
union anonymous$38;
// tag-#anon#UN[*{S8}$S8$'v2Addinfo'||*{S8}$S8$'v3Addinfo'|]
// file /usr/include/yaz/z-core.h line 745
union anonymous$40;
// tag-#anon#UN[*{SYM#tag-Z_AdminEsRequest#}$SYM#tag-Z_AdminEsRequest#$'esRequest'||*{SYM#tag-Z_AdminTaskPackage#}$SYM#tag-Z_AdminTaskPackage#$'taskPackage'|]
// file /usr/include/yaz/zes-admin.h line 54
union anonymous$19;
// tag-#anon#UN[*{SYM#tag-Z_AttributesPlusTerm#}$SYM#tag-Z_AttributesPlusTerm#$'attributesPlusTerm'||*{S8}$S8$'resultSetId'||*{SYM#tag-Z_ResultSetPlusAttributes#}$SYM#tag-Z_ResultSetPlusAttributes#$'resultAttr'|]
// file /usr/include/yaz/z-core.h line 511
union anonymous$100;
// tag-#anon#UN[*{SYM#tag-Z_Challenge1#}$SYM#tag-Z_Challenge1#$'challenge'||*{SYM#tag-Z_Response1#}$SYM#tag-Z_Response1#$'response'|]
// file /usr/include/yaz/z-accform1.h line 47
union anonymous$39;
// tag-#anon#UN[*{SYM#tag-Z_DRNType#}$SYM#tag-Z_DRNType#$'challenge'||*{SYM#tag-Z_DRNType#}$SYM#tag-Z_DRNType#$'response'|]
// file /usr/include/yaz/z-accdes1.h line 28
union anonymous$43;
// tag-#anon#UN[*{SYM#tag-Z_DateMonthAndDay#}$SYM#tag-Z_DateMonthAndDay#$'monthAndDay'||*{S64}$S64$'julianDay'||*{S64}$S64$'weekNumber'||*{SYM#tag-Z_DateQuarter#}$SYM#tag-Z_DateQuarter#$'quarter'||*{SYM#tag-Z_DateSeason#}$SYM#tag-Z_DateSeason#$'season'|]
// file /usr/include/yaz/z-date.h line 103
union anonymous$41;
// tag-#anon#UN[*{SYM#tag-Z_DefaultDiagFormat#}$SYM#tag-Z_DefaultDiagFormat#$'defaultDiagRec'||*{SYM#tag-Z_DiagFormat#}$SYM#tag-Z_DiagFormat#$'explicitDiagnostic'|]
// file /usr/include/yaz/z-diag1.h line 86
union anonymous$20;
// tag-#anon#UN[*{SYM#tag-Z_DefaultDiagFormat#}$SYM#tag-Z_DefaultDiagFormat#$'defaultFormat'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'externallyDefined'|]
// file /usr/include/yaz/z-core.h line 733
union anonymous$5;
// tag-#anon#UN[*{SYM#tag-Z_EIExportInvocationEsRequest#}$SYM#tag-Z_EIExportInvocationEsRequest#$'esRequest'||*{SYM#tag-Z_EIExportInvocationTaskPackage#}$SYM#tag-Z_EIExportInvocationTaskPackage#$'taskPackage'|]
// file /usr/include/yaz/zes-expi.h line 58
union anonymous$86;
// tag-#anon#UN[*{SYM#tag-Z_ESExportSpecificationEsRequest#}$SYM#tag-Z_ESExportSpecificationEsRequest#$'esRequest'||*{SYM#tag-Z_ESExportSpecificationTaskPackage#}$SYM#tag-Z_ESExportSpecificationTaskPackage#$'taskPackage'|]
// file /usr/include/yaz/zes-exps.h line 51
union anonymous$84;
// tag-#anon#UN[*{SYM#tag-Z_ElementRequestCompositeElementPrimitives#}$SYM#tag-Z_ElementRequestCompositeElementPrimitives#$'primitives'||*{SYM#tag-Z_ElementRequestCompositeElementSpecs#}$SYM#tag-Z_ElementRequestCompositeElementSpecs#$'specs'|]
// file /usr/include/yaz/z-espec1.h line 77
union anonymous$26;
// tag-#anon#UN[*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'databaseRecord'||*{SYM#tag-Z_DiagRec#}$SYM#tag-Z_DiagRec#$'surrogateDiagnostic'||*{SYM#tag-Z_FragmentSyntax#}$SYM#tag-Z_FragmentSyntax#$'startingFragment'||*{SYM#tag-Z_FragmentSyntax#}$SYM#tag-Z_FragmentSyntax#$'intermediateFragment'||*{SYM#tag-Z_FragmentSyntax#}$SYM#tag-Z_FragmentSyntax#$'finalFragment'|]
// file /usr/include/yaz/z-core.h line 707
union anonymous$18;
// tag-#anon#UN[*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'externallyTagged'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'notExternallyTagged'|]
// file /usr/include/yaz/z-core.h line 723
union anonymous$36;
// tag-#anon#UN[*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'marcHoldingsRecord'||*{SYM#tag-Z_HoldingsAndCircData#}$SYM#tag-Z_HoldingsAndCircData#$'holdingsAndCirc'|]
// file /usr/include/yaz/z-opac.h line 44
union anonymous$34;
// tag-#anon#UN[*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'record'||*{SYM#tag-Z_DiagRec#}$SYM#tag-Z_DiagRec#$'diagnostic'|]
// file /usr/include/yaz/zes-update0.h line 137
union anonymous$37;
// tag-#anon#UN[*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'record'||*{SYM#tag-Z_IUTaskPackageRecordStructureSurrogateDiagnostics#}$SYM#tag-Z_IUTaskPackageRecordStructureSurrogateDiagnostics#$'surrogateDiagnostics'|]
// file /usr/include/yaz/zes-update.h line 147
union anonymous$6;
// tag-#anon#UN[*{SYM#tag-Z_IORequest#}$SYM#tag-Z_IORequest#$'esRequest'||*{SYM#tag-Z_IOTaskPackage#}$SYM#tag-Z_IOTaskPackage#$'taskPackage'|]
// file /usr/include/yaz/zes-order.h line 63
union anonymous$90;
// tag-#anon#UN[*{SYM#tag-Z_IU0UpdateEsRequest#}$SYM#tag-Z_IU0UpdateEsRequest#$'esRequest'||*{SYM#tag-Z_IU0UpdateTaskPackage#}$SYM#tag-Z_IU0UpdateTaskPackage#$'taskPackage'|]
// file /usr/include/yaz/zes-update0.h line 66
union anonymous$33;
// tag-#anon#UN[*{SYM#tag-Z_IUUpdateEsRequest#}$SYM#tag-Z_IUUpdateEsRequest#$'esRequest'||*{SYM#tag-Z_IUUpdateTaskPackage#}$SYM#tag-Z_IUUpdateTaskPackage#$'taskPackage'|]
// file /usr/include/yaz/zes-update.h line 69
union anonymous;
// tag-#anon#UN[*{SYM#tag-Z_IntUnit#}$SYM#tag-Z_IntUnit#$'unit'||*{V}$V$'businessDaily'||*{V}$V$'continuous'||*{S8}$S8$'other'|]
// file /usr/include/yaz/zes-psched.h line 106
union anonymous$99;
// tag-#anon#UN[*{SYM#tag-Z_Iso2022#}$SYM#tag-Z_Iso2022#$'iso2022'||*{SYM#tag-Z_Iso10646#}$SYM#tag-Z_Iso10646#$'iso10646'||*{SYM#tag-Z_PrivateCharacterSet#}$SYM#tag-Z_PrivateCharacterSet#$'zprivate'|]
// file /usr/include/yaz/z-charneg.h line 72
union anonymous$69;
// tag-#anon#UN[*{SYM#tag-Z_Iso2022#}$SYM#tag-Z_Iso2022#$'iso2022'||*{SYM#tag-Z_Iso10646#}$SYM#tag-Z_Iso10646#$'iso10646'||*{SYM#tag-Z_PrivateCharacterSet#}$SYM#tag-Z_PrivateCharacterSet#$'zprivate'||*{V}$V$'none'|]
// file /usr/include/yaz/z-charneg.h line 92
union anonymous$72;
// tag-#anon#UN[*{SYM#tag-Z_Iso2022OriginProposal#}$SYM#tag-Z_Iso2022OriginProposal#$'originProposal'||*{SYM#tag-Z_Iso2022TargetResponse#}$SYM#tag-Z_Iso2022TargetResponse#$'targetResponse'|]
// file /usr/include/yaz/z-charneg.h line 142
union anonymous$81;
// tag-#anon#UN[*{SYM#tag-Z_KRBRequest#}$SYM#tag-Z_KRBRequest#$'challenge'||*{SYM#tag-Z_KRBResponse#}$SYM#tag-Z_KRBResponse#$'response'|]
// file /usr/include/yaz/z-acckrb1.h line 32
union anonymous$44;
// tag-#anon#UN[*{SYM#tag-Z_NetworkAddressIA#}$SYM#tag-Z_NetworkAddressIA#$'internetAddress'||*{SYM#tag-Z_NetworkAddressOPA#}$SYM#tag-Z_NetworkAddressOPA#$'osiPresentationAddress'||*{SYM#tag-Z_NetworkAddressOther#}$SYM#tag-Z_NetworkAddressOther#$'other'|]
// file /usr/include/yaz/z-exp.h line 834
union anonymous$57;
// tag-#anon#UN[*{SYM#tag-Z_Operand#}$SYM#tag-Z_Operand#$'simple'||*{SYM#tag-Z_Complex#}$SYM#tag-Z_Complex#$'complex'|]
// file /usr/include/yaz/z-core.h line 501
union anonymous$27;
// tag-#anon#UN[*{SYM#tag-Z_OriginProposal#}$SYM#tag-Z_OriginProposal#$'proposal'||*{SYM#tag-Z_TargetResponse#}$SYM#tag-Z_TargetResponse#$'response'|]
// file /usr/include/yaz/z-charneg.h line 62
union anonymous$63;
// tag-#anon#UN[*{SYM#tag-Z_PQSPeriodicQueryScheduleEsRequest#}$SYM#tag-Z_PQSPeriodicQueryScheduleEsRequest#$'esRequest'||*{SYM#tag-Z_PQSPeriodicQueryScheduleTaskPackage#}$SYM#tag-Z_PQSPeriodicQueryScheduleTaskPackage#$'taskPackage'|]
// file /usr/include/yaz/zes-psched.h line 55
union anonymous$95;
// tag-#anon#UN[*{SYM#tag-Z_PQueryPersistentQueryEsRequest#}$SYM#tag-Z_PQueryPersistentQueryEsRequest#$'esRequest'||*{SYM#tag-Z_PQueryPersistentQueryTaskPackage#}$SYM#tag-Z_PQueryPersistentQueryTaskPackage#$'taskPackage'|]
// file /usr/include/yaz/zes-pquery.h line 51
union anonymous$93;
// tag-#anon#UN[*{SYM#tag-Z_PRPersistentResultSetEsRequest#}$SYM#tag-Z_PRPersistentResultSetEsRequest#$'esRequest'||*{SYM#tag-Z_PRPersistentResultSetTaskPackage#}$SYM#tag-Z_PRPersistentResultSetTaskPackage#$'taskPackage'|]
// file /usr/include/yaz/zes-pset.h line 48
union anonymous$0;
// tag-#anon#UN[*{SYM#tag-Z_PrivateCapabilities#}$SYM#tag-Z_PrivateCapabilities#$'zprivate'||*{SYM#tag-Z_RpnCapabilities#}$SYM#tag-Z_RpnCapabilities#$'rpn'||*{SYM#tag-Z_Iso8777Capabilities#}$SYM#tag-Z_Iso8777Capabilities#$'iso8777'||*{SYM#tag-Z_HumanString#}$SYM#tag-Z_HumanString#$'z39_58'||*{SYM#tag-Z_RpnCapabilities#}$SYM#tag-Z_RpnCapabilities#$'erpn'||*{SYM#tag-Z_HumanString#}$SYM#tag-Z_HumanString#$'rankedList'|]
// file /usr/include/yaz/z-exp.h line 869
union anonymous$76;
// tag-#anon#UN[*{SYM#tag-Z_PrivateCharacterSetViaOid#}$SYM#tag-Z_PrivateCharacterSetViaOid#$'viaOid'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'externallySpecified'||*{V}$V$'previouslyAgreedUpon'|]
// file /usr/include/yaz/z-charneg.h line 113
union anonymous$77;
// tag-#anon#UN[*{SYM#tag-Z_PromptIdEnumeratedPrompt#}$SYM#tag-Z_PromptIdEnumeratedPrompt#$'enumeratedPrompt'||*{S8}$S8$'nonEnumeratedPrompt'|]
// file /usr/include/yaz/z-accform1.h line 120
union anonymous$50;
// tag-#anon#UN[*{SYM#tag-Z_Query#}$SYM#tag-Z_Query#$'actualQuery'||*{S8}$S8$'packageName'|]
// file /usr/include/yaz/zes-psched.h line 83
union anonymous$98;
// tag-#anon#UN[*{SYM#tag-Z_QueryExpressionTerm#}$SYM#tag-Z_QueryExpressionTerm#$'term'||*{SYM#tag-Z_Query#}$SYM#tag-Z_Query#$'query'|]
// file /usr/include/yaz/z-uifr1.h line 87
union anonymous$79;
// tag-#anon#UN[*{SYM#tag-Z_Segment#}$SYM#tag-Z_Segment#$'records'||*{V}$V$'recordsWillFollow'|]
// file /usr/include/yaz/zes-admin.h line 89
union anonymous$17;
// tag-#anon#UN[*{SYM#tag-Z_SimpleElement#}$SYM#tag-Z_SimpleElement#$'simpleElement'||*{SYM#tag-Z_ElementRequestCompositeElement#}$SYM#tag-Z_ElementRequestCompositeElement#$'compositeElement'|]
// file /usr/include/yaz/z-espec1.h line 89
union anonymous$29;
// tag-#anon#UN[*{SYM#tag-Z_SortKey#}$SYM#tag-Z_SortKey#$'generic'||*{SYM#tag-Z_SortDbSpecificList#}$SYM#tag-Z_SortDbSpecificList#$'databaseSpecific'|]
// file /usr/include/yaz/z-core.h line 1094
union anonymous$24;
// tag-#anon#UN[*{SYM#tag-Z_SpecificTag#}$SYM#tag-Z_SpecificTag#$'specificTag'||*{SYM#tag-Z_Occurrences#}$SYM#tag-Z_Occurrences#$'wildThing'||*{V}$V$'wildPath'|]
// file /usr/include/yaz/z-espec1.h line 110
union anonymous$32;
// tag-#anon#UN[*{SYM#tag-Z_TargetInfo#}$SYM#tag-Z_TargetInfo#$'targetInfo'||*{SYM#tag-Z_DatabaseInfo#}$SYM#tag-Z_DatabaseInfo#$'databaseInfo'||*{SYM#tag-Z_SchemaInfo#}$SYM#tag-Z_SchemaInfo#$'schemaInfo'||*{SYM#tag-Z_TagSetInfo#}$SYM#tag-Z_TagSetInfo#$'tagSetInfo'||*{SYM#tag-Z_RecordSyntaxInfo#}$SYM#tag-Z_RecordSyntaxInfo#$'recordSyntaxInfo'||*{SYM#tag-Z_AttributeSetInfo#}$SYM#tag-Z_AttributeSetInfo#$'attributeSetInfo'||*{SYM#tag-Z_TermListInfo#}$SYM#tag-Z_TermListInfo#$'termListInfo'||*{SYM#tag-Z_ExtendedServicesInfo#}$SYM#tag-Z_ExtendedServicesInfo#$'extendedServicesInfo'||*{SYM#tag-Z_AttributeDetails#}$SYM#tag-Z_AttributeDetails#$'attributeDetails'||*{SYM#tag-Z_TermListDetails#}$SYM#tag-Z_TermListDetails#$'termListDetails'||*{SYM#tag-Z_ElementSetDetails#}$SYM#tag-Z_ElementSetDetails#$'elementSetDetails'||*{SYM#tag-Z_RetrievalRecordDetails#}$SYM#tag-Z_RetrievalRecordDetails#$'retrievalRecordDetails'||*{SYM#tag-Z_SortDetails#}$SYM#tag-Z_SortDetails#$'sortDetails'||*{SYM#tag-Z_ProcessingInformation#}$SYM#tag-Z_ProcessingInformation#$'processing'||*{SYM#tag-Z_VariantSetInfo#}$SYM#tag-Z_VariantSetInfo#$'variants'||*{SYM#tag-Z_UnitInfo#}$SYM#tag-Z_UnitInfo#$'units'||*{SYM#tag-Z_CategoryList#}$SYM#tag-Z_CategoryList#$'categoryList'|]
// file /usr/include/yaz/z-exp.h line 257
union anonymous$51;
// tag-#anon#UN[*{SYM#tag-Z_TooMany#}$SYM#tag-Z_TooMany#$'tooMany'||*{SYM#tag-Z_BadSpec#}$SYM#tag-Z_BadSpec#$'badSpec'||*{SYM#tag-Z_DbUnavail#}$SYM#tag-Z_DbUnavail#$'dbUnavail'||*{S64}$S64$'unSupOp'||*{SYM#tag-Z_Attribute#}$SYM#tag-Z_Attribute#$'attribute'||*{SYM#tag-Z_AttCombo#}$SYM#tag-Z_AttCombo#$'attCombo'||*{SYM#tag-Z_DiagTerm#}$SYM#tag-Z_DiagTerm#$'term'||*{SYM#tag-Z_Proximity#}$SYM#tag-Z_Proximity#$'proximity'||*{SYM#tag-Z_Scan#}$SYM#tag-Z_Scan#$'scan'||*{SYM#tag-Z_Sort#}$SYM#tag-Z_Sort#$'sort'||*{SYM#tag-Z_Segmentation#}$SYM#tag-Z_Segmentation#$'segmentation'||*{SYM#tag-Z_ExtServices#}$SYM#tag-Z_ExtServices#$'extServices'||*{SYM#tag-Z_AccessCtrl#}$SYM#tag-Z_AccessCtrl#$'accessCtrl'||*{SYM#tag-Z_RecordSyntax#}$SYM#tag-Z_RecordSyntax#$'recordSyntax'|]
// file /usr/include/yaz/z-diag1.h line 318
union anonymous$14;
// tag-#anon#UN[*{SYM#tag-Z_UniverseReportHits#}$SYM#tag-Z_UniverseReportHits#$'databaseHits'||*{SYM#tag-Z_UniverseReportDuplicate#}$SYM#tag-Z_UniverseReportDuplicate#$'duplicate'|]
// file /usr/include/yaz/z-univ.h line 42
union anonymous$30;
// tag-#anon#UN[*{SYM#tag-Z_ValueRange#}$SYM#tag-Z_ValueRange#$'range'||*{SYM#tag-Z_ValueSetEnumerated#}$SYM#tag-Z_ValueSetEnumerated#$'enumerated'|]
// file /usr/include/yaz/z-exp.h line 703
union anonymous$73;
// tag-#anon#UN[*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'general'||*{S64}$S64$'numeric'||*{S8}$S8$'characterString'||*{S16}$S16$'oid'||*{S8}$S8$'dateTime'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'external'||*{SYM#tag-Z_IntUnit#}$SYM#tag-Z_IntUnit#$'integerAndUnit'||*{V}$V$'null'|]
// file /usr/include/yaz/z-core.h line 538
union anonymous$1;
// tag-#anon#UN[*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'octets'||*{S64}$S64$'numeric'||*{S8}$S8$'date'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'ext'||*{S8}$S8$'string'||*{S32}$S32$'trueOrFalse'||*{S16}$S16$'oid'||*{SYM#tag-Z_IntUnit#}$SYM#tag-Z_IntUnit#$'intUnit'||*{V}$V$'elementNotThere'||*{V}$V$'elementEmpty'||*{V}$V$'noDataRequested'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'diagnostic'||*{SYM#tag-Z_GenericRecord#}$SYM#tag-Z_GenericRecord#$'subtree'|]
// file /usr/include/yaz/z-grs.h line 70
union anonymous$28;
// tag-#anon#UN[*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'single_ASN1_type'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'octet_aligned'||*{SYM#tag-odr_bitmask#}$SYM#tag-odr_bitmask#$'arbitrary'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'sutrs'||*{SYM#tag-Z_ExplainRecord#}$SYM#tag-Z_ExplainRecord#$'explainRecord'||*{SYM#tag-Z_ResourceReport1#}$SYM#tag-Z_ResourceReport1#$'resourceReport1'||*{SYM#tag-Z_ResourceReport2#}$SYM#tag-Z_ResourceReport2#$'resourceReport2'||*{SYM#tag-Z_PromptObject1#}$SYM#tag-Z_PromptObject1#$'promptObject1'||*{SYM#tag-Z_GenericRecord#}$SYM#tag-Z_GenericRecord#$'grs1'||*{SYM#tag-Z_TaskPackage#}$SYM#tag-Z_TaskPackage#$'extendedService'||*{SYM#tag-Z_IOItemOrder#}$SYM#tag-Z_IOItemOrder#$'itemOrder'||*{SYM#tag-Z_DiagnosticFormat#}$SYM#tag-Z_DiagnosticFormat#$'diag1'||*{SYM#tag-Z_Espec1#}$SYM#tag-Z_Espec1#$'espec1'||*{SYM#tag-Z_BriefBib#}$SYM#tag-Z_BriefBib#$'summary'||*{SYM#tag-Z_OPACRecord#}$SYM#tag-Z_OPACRecord#$'opac'||*{SYM#tag-Z_SearchInfoReport#}$SYM#tag-Z_SearchInfoReport#$'searchResult1'||*{SYM#tag-Z_IUUpdate#}$SYM#tag-Z_IUUpdate#$'update'||*{SYM#tag-Z_DateTime#}$SYM#tag-Z_DateTime#$'dateTime'||*{SYM#tag-Z_UniverseReport#}$SYM#tag-Z_UniverseReport#$'universeReport'||*{SYM#tag-Z_Admin#}$SYM#tag-Z_Admin#$'adminService'||*{SYM#tag-Z_IU0Update#}$SYM#tag-Z_IU0Update#$'update0'||*{SYM#tag-Z_OtherInformation#}$SYM#tag-Z_OtherInformation#$'userInfo1'||*{SYM#tag-Z_CharSetandLanguageNegotiation#}$SYM#tag-Z_CharSetandLanguageNegotiation#$'charNeg3'||*{SYM#tag-Z_PromptObject1#}$SYM#tag-Z_PromptObject1#$'acfPrompt1'||*{SYM#tag-Z_DES_RN_Object#}$SYM#tag-Z_DES_RN_Object#$'acfDes1'||*{SYM#tag-Z_KRBObject#}$SYM#tag-Z_KRBObject#$'acfKrb1'||*{SYM#tag-Z_MultipleSearchTerms_2#}$SYM#tag-Z_MultipleSearchTerms_2#$'multipleSearchTerms_2'||*{S8}$S8$'cql'||*{SYM#tag-Z_OCLC_UserInformation#}$SYM#tag-Z_OCLC_UserInformation#$'oclc'||*{SYM#tag-Z_PRPersistentResultSet#}$SYM#tag-Z_PRPersistentResultSet#$'persistentResultSet'||*{SYM#tag-Z_PQueryPersistentQuery#}$SYM#tag-Z_PQueryPersistentQuery#$'persistentQuery'||*{SYM#tag-Z_PQSPeriodicQuerySchedule#}$SYM#tag-Z_PQSPeriodicQuerySchedule#$'periodicQuerySchedule'||*{SYM#tag-Z_ESExportSpecification#}$SYM#tag-Z_ESExportSpecification#$'exportSpecification'||*{SYM#tag-Z_EIExportInvocation#}$SYM#tag-Z_EIExportInvocation#$'exportInvocation'||*{SYM#tag-Z_FacetList#}$SYM#tag-Z_FacetList#$'facetList'|]
// file /usr/include/yaz/prt-ext.h line 101
union anonymous$3;
// tag-#anon#UN[*{V}$V$'all'||*{SYM#tag-Z_EIOriginPartNotToKeepRanges#}$SYM#tag-Z_EIOriginPartNotToKeepRanges#$'ranges'|]
// file /usr/include/yaz/zes-expi.h line 90
union anonymous$88;
// tag-#anon#UN[*{V}$V$'all'||*{SYM#tag-Z_ResultsByDB_sList#}$SYM#tag-Z_ResultsByDB_sList#$'list'|]
// file /usr/include/yaz/z-uifr1.h line 65
union anonymous$80;
// tag-#anon#UN[*{V}$V$'all'||*{V}$V$'last'||*{SYM#tag-Z_OccurValues#}$SYM#tag-Z_OccurValues#$'values'|]
// file /usr/include/yaz/z-espec1.h line 132
union anonymous$31;
// tag-#anon#UN[*{V}$V$'any_or_none'||*{SYM#tag-Z_AttributeValueList#}$SYM#tag-Z_AttributeValueList#$'specific'|]
// file /usr/include/yaz/z-exp.h line 1004
union anonymous$9;
// tag-#anon#UN[*{V}$V$'billInvoice'||*{V}$V$'prepay'||*{V}$V$'depositAccount'||*{SYM#tag-Z_IOCreditCardInfo#}$SYM#tag-Z_IOCreditCardInfo#$'creditCard'||*{V}$V$'cardInfoPreviouslySupplied'||*{V}$V$'privateKnown'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'privateNotKnown'|]
// file /usr/include/yaz/zes-order.h line 79
union anonymous$91;
// tag-#anon#UN[*{V}$V$'character'||*{V}$V$'numeric'||*{SYM#tag-Z_HumanString#}$SYM#tag-Z_HumanString#$'structured'|]
// file /usr/include/yaz/z-exp.h line 638
union anonymous$71;
// tag-#anon#UN[*{V}$V$'decade'||*{V}$V$'century'||*{V}$V$'millennium'|]
// file /usr/include/yaz/z-date.h line 85
union anonymous$61;
// tag-#anon#UN[*{V}$V$'first'||*{V}$V$'second'||*{V}$V$'third'||*{V}$V$'fourth'|]
// file /usr/include/yaz/z-date.h line 57
union anonymous$58;
// tag-#anon#UN[*{V}$V$'local'||*{V}$V$'utc'||*{S64}$S64$'utcOffset'|]
// file /usr/include/yaz/z-date.h line 124
union anonymous$42;
// tag-#anon#UN[*{V}$V$'noUser'||*{V}$V$'refused'||*{V}$V$'simple'||*{SYM#tag-Z_OidList#}$SYM#tag-Z_OidList#$'oid'||*{SYM#tag-Z_AltOidList#}$SYM#tag-Z_AltOidList#$'alternative'||*{V}$V$'pwdInv'||*{V}$V$'pwdExp'|]
// file /usr/include/yaz/z-diag1.h line 292
union anonymous$11;
// tag-#anon#UN[*{V}$V$'nonZeroStepSize'||*{V}$V$'specifiedStepSize'||*{V}$V$'termList1'||*{SYM#tag-Z_AttrListList#}$SYM#tag-Z_AttrListList#$'termList2'||*{S64}$S64$'posInResponse'||*{V}$V$'resources'||*{V}$V$'endOfList'|]
// file /usr/include/yaz/z-diag1.h line 186
union anonymous$23;
// tag-#anon#UN[*{V}$V$'op_and'||*{V}$V$'op_or'||*{V}$V$'and_not'||*{SYM#tag-Z_ProximityOperator#}$SYM#tag-Z_ProximityOperator#$'prox'|]
// file /usr/include/yaz/z-core.h line 560
union anonymous$12;
// tag-#anon#UN[*{V}$V$'reIndex'||*{V}$V$'truncate'||*{V}$V$'drop'||*{V}$V$'create'||*{SYM#tag-Z_ImportParameters#}$SYM#tag-Z_ImportParameters#$'import'||*{V}$V$'refresh'||*{V}$V$'commit'||*{V}$V$'shutdown'||*{V}$V$'start'|]
// file /usr/include/yaz/zes-admin.h line 64
union anonymous$16;
// tag-#anon#UN[*{V}$V$'resultSets'||*{S8}$S8$'badSet'||*{S64}$S64$'relation'||*{S64}$S64$'unit'||*{S64}$S64$'distance'||*{SYM#tag-Z_AttributeList#}$SYM#tag-Z_AttributeList#$'attributes'||*{V}$V$'ordered'||*{V}$V$'exclusion'|]
// file /usr/include/yaz/z-diag1.h line 159
union anonymous$21;
// tag-#anon#UN[*{V}$V$'segmentCount'||*{S64}$S64$'segmentSize'|]
// file /usr/include/yaz/z-diag1.h line 251
union anonymous$101;
// tag-#anon#UN[*{V}$V$'sequence'||*{V}$V$'noRsName'||*{S64}$S64$'tooMany'||*{V}$V$'incompatible'||*{V}$V$'generic'||*{V}$V$'dbSpecific'||*{SYM#tag-Z_SortElement#}$SYM#tag-Z_SortElement#$'sortElement'||*{S64}$S64$'key'||*{V}$V$'action'||*{S64}$S64$'illegal'||*{SYM#tag-Z_StringList#}$SYM#tag-Z_StringList#$'inputTooLarge'||*{V}$V$'aggregateTooLarge'|]
// file /usr/include/yaz/z-diag1.h line 215
union anonymous$25;
// tag-#anon#UN[*{V}$V$'sevenBit'||*{V}$V$'eightBit'|]
// file /usr/include/yaz/z-charneg.h line 152
union anonymous$78;
// tag-#anon#UN[*{V}$V$'type_0'||*{SYM#tag-Z_RPNQuery#}$SYM#tag-Z_RPNQuery#$'type_1'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'type_2'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'type_100'||*{SYM#tag-Z_RPNQuery#}$SYM#tag-Z_RPNQuery#$'type_101'||*{SYM#tag-odr_oct#}$SYM#tag-odr_oct#$'type_102'||*{SYM#tag-Z_External#}$SYM#tag-Z_External#$'type_104'|]
// file /usr/include/yaz/z-core.h line 470
union anonymous$82;
// tag-#anon#UN[*{V}$V$'winter'||*{V}$V$'spring'||*{V}$V$'summer'||*{V}$V$'autumn'|]
// file /usr/include/yaz/z-date.h line 71
union anonymous$60;
// tag-#anon#UN[ARR4{S8}$S8$'__size'||S32'__align'|]
// file /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h line 130
union anonymous$53;
// tag-#anon#UN[SYM#tag-#anon#ST[*{S8}$S8$'name'||*{S8}$S8$'op'||*{S8}$S8$'value'|]#'relation'||SYM#tag-#anon#ST[*{cS8}$cS8$'op'||*{SYM#tag-xpath_predicate#}$SYM#tag-xpath_predicate#$'left'||*{SYM#tag-xpath_predicate#}$SYM#tag-xpath_predicate#$'right'|]#'boolean'|]
// file ../include/zebra_xpath.h line 28
union anonymous$66;
// tag-#anon#UN[SYM#tag-#anon#ST[S32'__lock'||U32'__futex'||U64'__total_seq'||U64'__wakeup_seq'||U64'__woken_seq'||*{V}$V$'__mutex'||U32'__nwaiters'||U32'__broadcast_seq'|]#'__data'||ARR48{S8}$S8$'__size'||S64'__align'|]
// file /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h line 139
union anonymous$48;
// tag-#anon#UN[SYM#tag-#anon#ST[S32'entry_size'|]#'sort'|]
// file zebramap.c line 51
union anonymous$97;
// tag-#anon#UN[SYM#tag-__pthread_mutex_s#'__data'||ARR40{S8}$S8$'__size'||S64'__align'|]
// file /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h line 90
union anonymous$47;
// tag-UErrorCode
// file /usr/include/x86_64-linux-gnu/unicode/utypes.h line 476
enum UErrorCode { U_USING_FALLBACK_WARNING=-128, U_ERROR_WARNING_START=-128, U_USING_DEFAULT_WARNING=-127, U_SAFECLONE_ALLOCATED_WARNING=-126, U_STATE_OLD_WARNING=-125, U_STRING_NOT_TERMINATED_WARNING=-124, U_SORT_KEY_TOO_SHORT_WARNING=-123, U_AMBIGUOUS_ALIAS_WARNING=-122, U_DIFFERENT_UCA_VERSION=-121, U_PLUGIN_CHANGED_LEVEL_WARNING=-120, U_ERROR_WARNING_LIMIT=-119, U_ZERO_ERROR=0, U_ILLEGAL_ARGUMENT_ERROR=1, U_MISSING_RESOURCE_ERROR=2, U_INVALID_FORMAT_ERROR=3, U_FILE_ACCESS_ERROR=4, U_INTERNAL_PROGRAM_ERROR=5, U_MESSAGE_PARSE_ERROR=6, U_MEMORY_ALLOCATION_ERROR=7, U_INDEX_OUTOFBOUNDS_ERROR=8, U_PARSE_ERROR=9, U_INVALID_CHAR_FOUND=10, U_TRUNCATED_CHAR_FOUND=11, U_ILLEGAL_CHAR_FOUND=12, U_INVALID_TABLE_FORMAT=13, U_INVALID_TABLE_FILE=14, U_BUFFER_OVERFLOW_ERROR=15, U_UNSUPPORTED_ERROR=16, U_RESOURCE_TYPE_MISMATCH=17, U_ILLEGAL_ESCAPE_SEQUENCE=18, U_UNSUPPORTED_ESCAPE_SEQUENCE=19, U_NO_SPACE_AVAILABLE=20, U_CE_NOT_FOUND_ERROR=21, U_PRIMARY_TOO_LONG_ERROR=22, U_STATE_TOO_OLD_ERROR=23, U_TOO_MANY_ALIASES_ERROR=24, U_ENUM_OUT_OF_SYNC_ERROR=25, U_INVARIANT_CONVERSION_ERROR=26, U_INVALID_STATE_ERROR=27, U_COLLATOR_VERSION_MISMATCH=28, U_USELESS_COLLATOR_ERROR=29, U_NO_WRITE_PERMISSION=30, U_STANDARD_ERROR_LIMIT=31, U_BAD_VARIABLE_DEFINITION=65536, U_PARSE_ERROR_START=65536, U_MALFORMED_RULE=65537, U_MALFORMED_SET=65538, U_MALFORMED_SYMBOL_REFERENCE=65539, U_MALFORMED_UNICODE_ESCAPE=65540, U_MALFORMED_VARIABLE_DEFINITION=65541, U_MALFORMED_VARIABLE_REFERENCE=65542, U_MISMATCHED_SEGMENT_DELIMITERS=65543, U_MISPLACED_ANCHOR_START=65544, U_MISPLACED_CURSOR_OFFSET=65545, U_MISPLACED_QUANTIFIER=65546, U_MISSING_OPERATOR=65547, U_MISSING_SEGMENT_CLOSE=65548, U_MULTIPLE_ANTE_CONTEXTS=65549, U_MULTIPLE_CURSORS=65550, U_MULTIPLE_POST_CONTEXTS=65551, U_TRAILING_BACKSLASH=65552, U_UNDEFINED_SEGMENT_REFERENCE=65553, U_UNDEFINED_VARIABLE=65554, U_UNQUOTED_SPECIAL=65555, U_UNTERMINATED_QUOTE=65556, U_RULE_MASK_ERROR=65557, U_MISPLACED_COMPOUND_FILTER=65558, U_MULTIPLE_COMPOUND_FILTERS=65559, U_INVALID_RBT_SYNTAX=65560, U_INVALID_PROPERTY_PATTERN=65561, U_MALFORMED_PRAGMA=65562, U_UNCLOSED_SEGMENT=65563, U_ILLEGAL_CHAR_IN_SEGMENT=65564, U_VARIABLE_RANGE_EXHAUSTED=65565, U_VARIABLE_RANGE_OVERLAP=65566, U_ILLEGAL_CHARACTER=65567, U_INTERNAL_TRANSLITERATOR_ERROR=65568, U_INVALID_ID=65569, U_INVALID_FUNCTION=65570, U_PARSE_ERROR_LIMIT=65571, U_UNEXPECTED_TOKEN=65792, U_FMT_PARSE_ERROR_START=65792, U_MULTIPLE_DECIMAL_SEPARATORS=65793, U_MULTIPLE_DECIMAL_SEPERATORS=65793, U_MULTIPLE_EXPONENTIAL_SYMBOLS=65794, U_MALFORMED_EXPONENTIAL_PATTERN=65795, U_MULTIPLE_PERCENT_SYMBOLS=65796, U_MULTIPLE_PERMILL_SYMBOLS=65797, U_MULTIPLE_PAD_SPECIFIERS=65798, U_PATTERN_SYNTAX_ERROR=65799, U_ILLEGAL_PAD_POSITION=65800, U_UNMATCHED_BRACES=65801, U_UNSUPPORTED_PROPERTY=65802, U_UNSUPPORTED_ATTRIBUTE=65803, U_ARGUMENT_TYPE_MISMATCH=65804, U_DUPLICATE_KEYWORD=65805, U_UNDEFINED_KEYWORD=65806, U_DEFAULT_KEYWORD_MISSING=65807, U_DECIMAL_NUMBER_SYNTAX_ERROR=65808, U_FORMAT_INEXACT_ERROR=65809, U_FMT_PARSE_ERROR_LIMIT=65810, U_BRK_INTERNAL_ERROR=66048, U_BRK_ERROR_START=66048, U_BRK_HEX_DIGITS_EXPECTED=66049, U_BRK_SEMICOLON_EXPECTED=66050, U_BRK_RULE_SYNTAX=66051, U_BRK_UNCLOSED_SET=66052, U_BRK_ASSIGN_ERROR=66053, U_BRK_VARIABLE_REDFINITION=66054, U_BRK_MISMATCHED_PAREN=66055, U_BRK_NEW_LINE_IN_QUOTED_STRING=66056, U_BRK_UNDEFINED_VARIABLE=66057, U_BRK_INIT_ERROR=66058, U_BRK_RULE_EMPTY_SET=66059, U_BRK_UNRECOGNIZED_OPTION=66060, U_BRK_MALFORMED_RULE_TAG=66061, U_BRK_ERROR_LIMIT=66062, U_REGEX_INTERNAL_ERROR=66304, U_REGEX_ERROR_START=66304, U_REGEX_RULE_SYNTAX=66305, U_REGEX_INVALID_STATE=66306, U_REGEX_BAD_ESCAPE_SEQUENCE=66307, U_REGEX_PROPERTY_SYNTAX=66308, U_REGEX_UNIMPLEMENTED=66309, U_REGEX_MISMATCHED_PAREN=66310, U_REGEX_NUMBER_TOO_BIG=66311, U_REGEX_BAD_INTERVAL=66312, U_REGEX_MAX_LT_MIN=66313, U_REGEX_INVALID_BACK_REF=66314, U_REGEX_INVALID_FLAG=66315, U_REGEX_LOOK_BEHIND_LIMIT=66316, U_REGEX_SET_CONTAINS_STRING=66317, U_REGEX_OCTAL_TOO_BIG=66318, U_REGEX_MISSING_CLOSE_BRACKET=66319, U_REGEX_INVALID_RANGE=66320, U_REGEX_STACK_OVERFLOW=66321, U_REGEX_TIME_OUT=66322, U_REGEX_STOPPED_BY_CALLER=66323, U_REGEX_PATTERN_TOO_BIG=66324, U_REGEX_INVALID_CAPTURE_GROUP_NAME=66325, U_REGEX_ERROR_LIMIT=66326, U_IDNA_PROHIBITED_ERROR=66560, U_IDNA_ERROR_START=66560, U_IDNA_UNASSIGNED_ERROR=66561, U_IDNA_CHECK_BIDI_ERROR=66562, U_IDNA_STD3_ASCII_RULES_ERROR=66563, U_IDNA_ACE_PREFIX_ERROR=66564, U_IDNA_VERIFICATION_ERROR=66565, U_IDNA_LABEL_TOO_LONG_ERROR=66566, U_IDNA_ZERO_LENGTH_LABEL_ERROR=66567, U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR=66568, U_IDNA_ERROR_LIMIT=66569, U_STRINGPREP_PROHIBITED_ERROR=66560, U_STRINGPREP_UNASSIGNED_ERROR=66561, U_STRINGPREP_CHECK_BIDI_ERROR=66562, U_PLUGIN_ERROR_START=66816, U_PLUGIN_TOO_HIGH=66816, U_PLUGIN_DIDNT_SET_LEVEL=66817, U_PLUGIN_ERROR_LIMIT=66818, U_ERROR_LIMIT=66818 };
// tag-Z_AccessCtrl
// file /usr/include/yaz/z-diag1.h line 70
struct Z_AccessCtrl;
// tag-Z_AccessInfo
// file /usr/include/yaz/z-exp.h line 190
struct Z_AccessInfo;
// tag-Z_AccessRestrictions
// file /usr/include/yaz/z-exp.h line 223
struct Z_AccessRestrictions;
// tag-Z_AccessRestrictionsUnit
// file /usr/include/yaz/z-exp.h line 220
struct Z_AccessRestrictionsUnit;
// tag-Z_Admin
// file /usr/include/yaz/zes-admin.h line 22
struct Z_Admin;
// tag-Z_AdminEsRequest
// file /usr/include/yaz/zes-admin.h line 16
struct Z_AdminEsRequest;
// tag-Z_AdminTaskPackage
// file /usr/include/yaz/zes-admin.h line 19
struct Z_AdminTaskPackage;
// tag-Z_AltOidList
// file /usr/include/yaz/z-diag1.h line 67
struct Z_AltOidList;
// tag-Z_AttCombo
// file /usr/include/yaz/z-diag1.h line 37
struct Z_AttCombo;
// tag-Z_AttrListList
// file /usr/include/yaz/z-diag1.h line 46
struct Z_AttrListList;
// tag-Z_Attribute
// file /usr/include/yaz/z-diag1.h line 34
struct Z_Attribute;
// tag-Z_AttributeCombination
// file /usr/include/yaz/z-exp.h line 241
struct Z_AttributeCombination;
// tag-Z_AttributeCombinations
// file /usr/include/yaz/z-exp.h line 238
struct Z_AttributeCombinations;
// tag-Z_AttributeDescription
// file /usr/include/yaz/z-exp.h line 64
struct Z_AttributeDescription;
// tag-Z_AttributeDetails
// file /usr/include/yaz/z-exp.h line 76
struct Z_AttributeDetails;
// tag-Z_AttributeElement
// file /usr/include/yaz/z-core.h line 76
struct Z_AttributeElement;
// tag-Z_AttributeList
// file /usr/include/yaz/z-core.h line 64
struct Z_AttributeList;
// tag-Z_AttributeOccurrence
// file /usr/include/yaz/z-exp.h line 247
struct Z_AttributeOccurrence;
// tag-Z_AttributeSetDetails
// file /usr/include/yaz/z-exp.h line 79
struct Z_AttributeSetDetails;
// tag-Z_AttributeSetInfo
// file /usr/include/yaz/z-exp.h line 58
struct Z_AttributeSetInfo;
// tag-Z_AttributeType
// file /usr/include/yaz/z-exp.h line 61
struct Z_AttributeType;
// tag-Z_AttributeTypeDetails
// file /usr/include/yaz/z-exp.h line 82
struct Z_AttributeTypeDetails;
// tag-Z_AttributeValue
// file /usr/include/yaz/z-exp.h line 88
struct Z_AttributeValue;
// tag-Z_AttributeValueList
// file /usr/include/yaz/z-exp.h line 244
struct Z_AttributeValueList;
// tag-Z_AttributesPlusTerm
// file /usr/include/yaz/z-core.h line 58
struct Z_AttributesPlusTerm;
// tag-Z_BadSpec
// file /usr/include/yaz/z-diag1.h line 25
struct Z_BadSpec;
// tag-Z_BriefBib
// file /usr/include/yaz/z-sum.h line 16
struct Z_BriefBib;
// tag-Z_CategoryInfo
// file /usr/include/yaz/z-exp.h line 154
struct Z_CategoryInfo;
// tag-Z_CategoryList
// file /usr/include/yaz/z-exp.h line 151
struct Z_CategoryList;
// tag-Z_Challenge1
// file /usr/include/yaz/z-accform1.h line 22
struct Z_Challenge1;
// tag-Z_ChallengeUnit1
// file /usr/include/yaz/z-accform1.h line 19
struct Z_ChallengeUnit1;
// tag-Z_CharSetandLanguageNegotiation
// file /usr/include/yaz/z-charneg.h line 16
struct Z_CharSetandLanguageNegotiation;
// tag-Z_Charge
// file /usr/include/yaz/z-exp.h line 232
struct Z_Charge;
// tag-Z_CircRecord
// file /usr/include/yaz/z-opac.h line 28
struct Z_CircRecord;
// tag-Z_CommonInfo
// file /usr/include/yaz/z-exp.h line 157
struct Z_CommonInfo;
// tag-Z_CompSpec
// file /usr/include/yaz/z-core.h line 139
struct Z_CompSpec;
// tag-Z_Complex
// file /usr/include/yaz/z-core.h line 49
struct Z_Complex;
// tag-Z_ComplexAttribute
// file /usr/include/yaz/z-core.h line 73
struct Z_ComplexAttribute;
// tag-Z_ContactInfo
// file /usr/include/yaz/z-exp.h line 175
struct Z_ContactInfo;
// tag-Z_Costs
// file /usr/include/yaz/z-exp.h line 229
struct Z_Costs;
// tag-Z_CostsOtherCharge
// file /usr/include/yaz/z-exp.h line 226
struct Z_CostsOtherCharge;
// tag-Z_DES_RN_Object
// file /usr/include/yaz/z-accdes1.h line 15
struct Z_DES_RN_Object;
// tag-Z_DRNType
// file /usr/include/yaz/z-accdes1.h line 18
struct Z_DRNType;
// tag-Z_DatabaseInfo
// file /usr/include/yaz/z-exp.h line 22
struct Z_DatabaseInfo;
// tag-Z_DatabaseList
// file /usr/include/yaz/z-exp.h line 235
struct Z_DatabaseList;
// tag-Z_Date
// file /usr/include/yaz/z-date.h line 34
struct Z_Date;
// tag-Z_DateFlags
// file /usr/include/yaz/z-date.h line 31
struct Z_DateFlags;
// tag-Z_DateMonthAndDay
// file /usr/include/yaz/z-date.h line 19
struct Z_DateMonthAndDay;
// tag-Z_DateQuarter
// file /usr/include/yaz/z-date.h line 22
struct Z_DateQuarter;
// tag-Z_DateSeason
// file /usr/include/yaz/z-date.h line 25
struct Z_DateSeason;
// tag-Z_DateTime
// file /usr/include/yaz/z-date.h line 16
struct Z_DateTime;
// tag-Z_DbSpecific
// file /usr/include/yaz/z-core.h line 136
struct Z_DbSpecific;
// tag-Z_DbUnavail
// file /usr/include/yaz/z-diag1.h line 31
struct Z_DbUnavail;
// tag-Z_DbUnavail_0
// file /usr/include/yaz/z-diag1.h line 28
struct Z_DbUnavail_0;
// tag-Z_DefaultDiagFormat
// file /usr/include/yaz/z-core.h line 118
struct Z_DefaultDiagFormat;
// tag-Z_DiagFormat
// file /usr/include/yaz/z-diag1.h line 76
struct Z_DiagFormat;
// tag-Z_DiagRec
// file /usr/include/yaz/z-core.h line 115
struct Z_DiagRec;
// tag-Z_DiagTerm
// file /usr/include/yaz/z-diag1.h line 40
struct Z_DiagTerm;
// tag-Z_DiagnosticFormat
// file /usr/include/yaz/z-diag1.h line 19
struct Z_DiagnosticFormat;
// tag-Z_DiagnosticFormat_s
// file /usr/include/yaz/z-diag1.h line 16
struct Z_DiagnosticFormat_s;
// tag-Z_EIExportInvocation
// file /usr/include/yaz/zes-expi.h line 23
struct Z_EIExportInvocation;
// tag-Z_EIExportInvocationEsRequest
// file /usr/include/yaz/zes-expi.h line 17
struct Z_EIExportInvocationEsRequest;
// tag-Z_EIExportInvocationTaskPackage
// file /usr/include/yaz/zes-expi.h line 20
struct Z_EIExportInvocationTaskPackage;
// tag-Z_EIOriginPartNotToKeep
// file /usr/include/yaz/zes-expi.h line 35
struct Z_EIOriginPartNotToKeep;
// tag-Z_EIOriginPartNotToKeepRanges
// file /usr/include/yaz/zes-expi.h line 32
struct Z_EIOriginPartNotToKeepRanges;
// tag-Z_EIOriginPartNotToKeepRanges_s
// file /usr/include/yaz/zes-expi.h line 29
struct Z_EIOriginPartNotToKeepRanges_s;
// tag-Z_EIOriginPartToKeep
// file /usr/include/yaz/zes-expi.h line 26
struct Z_EIOriginPartToKeep;
// tag-Z_EITargetPart
// file /usr/include/yaz/zes-expi.h line 38
struct Z_EITargetPart;
// tag-Z_ESAdminOriginPartNotToKeep
// file /usr/include/yaz/zes-admin.h line 28
struct Z_ESAdminOriginPartNotToKeep;
// tag-Z_ESAdminOriginPartToKeep
// file /usr/include/yaz/zes-admin.h line 25
struct Z_ESAdminOriginPartToKeep;
// tag-Z_ESAdminTargetPart
// file /usr/include/yaz/zes-admin.h line 31
struct Z_ESAdminTargetPart;
// tag-Z_ESDestination
// file /usr/include/yaz/zes-exps.h line 31
struct Z_ESDestination;
// tag-Z_ESDestinationOther
// file /usr/include/yaz/zes-exps.h line 28
struct Z_ESDestinationOther;
// tag-Z_ESExportSpecification
// file /usr/include/yaz/zes-exps.h line 22
struct Z_ESExportSpecification;
// tag-Z_ESExportSpecificationEsRequest
// file /usr/include/yaz/zes-exps.h line 16
struct Z_ESExportSpecificationEsRequest;
// tag-Z_ESExportSpecificationTaskPackage
// file /usr/include/yaz/zes-exps.h line 19
struct Z_ESExportSpecificationTaskPackage;
// tag-Z_ESOriginPartToKeep
// file /usr/include/yaz/zes-exps.h line 25
struct Z_ESOriginPartToKeep;
// tag-Z_EScanInfo
// file /usr/include/yaz/z-exp.h line 91
struct Z_EScanInfo;
// tag-Z_ETagPath
// file /usr/include/yaz/z-espec1.h line 41
struct Z_ETagPath;
// tag-Z_ETagUnit
// file /usr/include/yaz/z-espec1.h line 38
struct Z_ETagUnit;
// tag-Z_ElementData
// file /usr/include/yaz/z-grs.h line 22
struct Z_ElementData;
// tag-Z_ElementDataType
// file /usr/include/yaz/z-exp.h line 43
struct Z_ElementDataType;
// tag-Z_ElementInfo
// file /usr/include/yaz/z-exp.h line 31
struct Z_ElementInfo;
// tag-Z_ElementInfoList
// file /usr/include/yaz/z-exp.h line 40
struct Z_ElementInfoList;
// tag-Z_ElementMetaData
// file /usr/include/yaz/z-grs.h line 25
struct Z_ElementMetaData;
// tag-Z_ElementRequest
// file /usr/include/yaz/z-espec1.h line 29
struct Z_ElementRequest;
// tag-Z_ElementRequestCompositeElement
// file /usr/include/yaz/z-espec1.h line 26
struct Z_ElementRequestCompositeElement;
// tag-Z_ElementRequestCompositeElementPrimitives
// file /usr/include/yaz/z-espec1.h line 20
struct Z_ElementRequestCompositeElementPrimitives;
// tag-Z_ElementRequestCompositeElementSpecs
// file /usr/include/yaz/z-espec1.h line 23
struct Z_ElementRequestCompositeElementSpecs;
// tag-Z_ElementSetDetails
// file /usr/include/yaz/z-exp.h line 97
struct Z_ElementSetDetails;
// tag-Z_ElementSpec
// file /usr/include/yaz/z-core.h line 142
struct Z_ElementSpec;
// tag-Z_Encryption
// file /usr/include/yaz/z-accform1.h line 37
struct Z_Encryption;
// tag-Z_Environment
// file /usr/include/yaz/z-charneg.h line 43
struct Z_Environment;
// tag-Z_Era
// file /usr/include/yaz/z-date.h line 28
struct Z_Era;
// tag-Z_Espec1
// file /usr/include/yaz/z-espec1.h line 17
struct Z_Espec1;
// tag-Z_Estimate1
// file /usr/include/yaz/z-rrf1.h line 19
struct Z_Estimate1;
// tag-Z_Estimate2
// file /usr/include/yaz/z-rrf2.h line 19
struct Z_Estimate2;
// tag-Z_ExplainRecord
// file /usr/include/yaz/z-exp.h line 16
struct Z_ExplainRecord;
// tag-Z_ExtServices
// file /usr/include/yaz/z-diag1.h line 61
struct Z_ExtServices;
// tag-Z_ExtendedServicesInfo
// file /usr/include/yaz/z-exp.h line 73
struct Z_ExtendedServicesInfo;
// tag-Z_External
// file /usr/include/yaz/z-core.h line 15
struct Z_External;
// tag-Z_FacetField
// file /usr/include/yaz/z-facet-1.h line 19
struct Z_FacetField;
// tag-Z_FacetList
// file /usr/include/yaz/z-facet-1.h line 16
struct Z_FacetList;
// tag-Z_FacetTerm
// file /usr/include/yaz/z-facet-1.h line 22
struct Z_FacetTerm;
// tag-Z_FormatSpec
// file /usr/include/yaz/z-sum.h line 19
struct Z_FormatSpec;
// tag-Z_FragmentSyntax
// file /usr/include/yaz/z-core.h line 112
struct Z_FragmentSyntax;
// tag-Z_GenericRecord
// file /usr/include/yaz/z-grs.h line 16
struct Z_GenericRecord;
// tag-Z_HitVector
// file /usr/include/yaz/z-grs.h line 40
struct Z_HitVector;
// tag-Z_HoldingsAndCircData
// file /usr/include/yaz/z-opac.h line 22
struct Z_HoldingsAndCircData;
// tag-Z_HoldingsRecord
// file /usr/include/yaz/z-opac.h line 19
struct Z_HoldingsRecord;
// tag-Z_HumanString
// file /usr/include/yaz/z-exp.h line 163
struct Z_HumanString;
// tag-Z_HumanStringUnit
// file /usr/include/yaz/z-exp.h line 160
struct Z_HumanStringUnit;
// tag-Z_IOBilling
// file /usr/include/yaz/zes-order.h line 28
struct Z_IOBilling;
// tag-Z_IOContact
// file /usr/include/yaz/zes-order.h line 25
struct Z_IOContact;
// tag-Z_IOCreditCardInfo
// file /usr/include/yaz/zes-order.h line 34
struct Z_IOCreditCardInfo;
// tag-Z_IOItemOrder
// file /usr/include/yaz/zes-order.h line 22
struct Z_IOItemOrder;
// tag-Z_IOOriginPartNotToKeep
// file /usr/include/yaz/zes-order.h line 40
struct Z_IOOriginPartNotToKeep;
// tag-Z_IOOriginPartToKeep
// file /usr/include/yaz/zes-order.h line 31
struct Z_IOOriginPartToKeep;
// tag-Z_IORequest
// file /usr/include/yaz/zes-order.h line 16
struct Z_IORequest;
// tag-Z_IOResultSetItem
// file /usr/include/yaz/zes-order.h line 37
struct Z_IOResultSetItem;
// tag-Z_IOTargetPart
// file /usr/include/yaz/zes-order.h line 43
struct Z_IOTargetPart;
// tag-Z_IOTaskPackage
// file /usr/include/yaz/zes-order.h line 19
struct Z_IOTaskPackage;
// tag-Z_IU0CorrelationInfo
// file /usr/include/yaz/zes-update0.h line 43
struct Z_IU0CorrelationInfo;
// tag-Z_IU0OriginPartToKeep
// file /usr/include/yaz/zes-update0.h line 25
struct Z_IU0OriginPartToKeep;
// tag-Z_IU0SuppliedRecords
// file /usr/include/yaz/zes-update0.h line 37
struct Z_IU0SuppliedRecords;
// tag-Z_IU0SuppliedRecordsId
// file /usr/include/yaz/zes-update0.h line 31
struct Z_IU0SuppliedRecordsId;
// tag-Z_IU0SuppliedRecords_elem
// file /usr/include/yaz/zes-update0.h line 34
struct Z_IU0SuppliedRecords_elem;
// tag-Z_IU0TargetPart
// file /usr/include/yaz/zes-update0.h line 28
struct Z_IU0TargetPart;
// tag-Z_IU0TaskPackageRecordStructure
// file /usr/include/yaz/zes-update0.h line 46
struct Z_IU0TaskPackageRecordStructure;
// tag-Z_IU0Update
// file /usr/include/yaz/zes-update0.h line 22
struct Z_IU0Update;
// tag-Z_IU0UpdateEsRequest
// file /usr/include/yaz/zes-update0.h line 16
struct Z_IU0UpdateEsRequest;
// tag-Z_IU0UpdateTaskPackage
// file /usr/include/yaz/zes-update0.h line 19
struct Z_IU0UpdateTaskPackage;
// tag-Z_IUCorrelationInfo
// file /usr/include/yaz/zes-update.h line 43
struct Z_IUCorrelationInfo;
// tag-Z_IUOriginPartToKeep
// file /usr/include/yaz/zes-update.h line 25
struct Z_IUOriginPartToKeep;
// tag-Z_IUSuppliedRecords
// file /usr/include/yaz/zes-update.h line 37
struct Z_IUSuppliedRecords;
// tag-Z_IUSuppliedRecordsId
// file /usr/include/yaz/zes-update.h line 31
struct Z_IUSuppliedRecordsId;
// tag-Z_IUSuppliedRecords_elem
// file /usr/include/yaz/zes-update.h line 34
struct Z_IUSuppliedRecords_elem;
// tag-Z_IUTargetPart
// file /usr/include/yaz/zes-update.h line 28
struct Z_IUTargetPart;
// tag-Z_IUTaskPackageRecordStructure
// file /usr/include/yaz/zes-update.h line 49
struct Z_IUTaskPackageRecordStructure;
// tag-Z_IUTaskPackageRecordStructureSurrogateDiagnostics
// file /usr/include/yaz/zes-update.h line 46
struct Z_IUTaskPackageRecordStructureSurrogateDiagnostics;
// tag-Z_IUUpdate
// file /usr/include/yaz/zes-update.h line 22
struct Z_IUUpdate;
// tag-Z_IUUpdateEsRequest
// file /usr/include/yaz/zes-update.h line 16
struct Z_IUUpdateEsRequest;
// tag-Z_IUUpdateTaskPackage
// file /usr/include/yaz/zes-update.h line 19
struct Z_IUUpdateTaskPackage;
// tag-Z_IconObject
// file /usr/include/yaz/z-exp.h line 169
struct Z_IconObject;
// tag-Z_IconObjectUnit
// file /usr/include/yaz/z-exp.h line 166
struct Z_IconObjectUnit;
// tag-Z_ImportParameters
// file /usr/include/yaz/zes-admin.h line 34
struct Z_ImportParameters;
// tag-Z_InfoCategory
// file /usr/include/yaz/z-core.h line 292
struct Z_InfoCategory;
// tag-Z_InitialSet
// file /usr/include/yaz/z-charneg.h line 46
struct Z_InitialSet;
// tag-Z_IntUnit
// file /usr/include/yaz/z-core.h line 295
struct Z_IntUnit;
// tag-Z_Iso10646
// file /usr/include/yaz/z-charneg.h line 52
struct Z_Iso10646;
// tag-Z_Iso2022
// file /usr/include/yaz/z-charneg.h line 40
struct Z_Iso2022;
// tag-Z_Iso2022OriginProposal
// file /usr/include/yaz/z-charneg.h line 34
struct Z_Iso2022OriginProposal;
// tag-Z_Iso2022TargetResponse
// file /usr/include/yaz/z-charneg.h line 37
struct Z_Iso2022TargetResponse;
// tag-Z_Iso8777Capabilities
// file /usr/include/yaz/z-exp.h line 205
struct Z_Iso8777Capabilities;
// tag-Z_KRBObject
// file /usr/include/yaz/z-acckrb1.h line 16
struct Z_KRBObject;
// tag-Z_KRBRequest
// file /usr/include/yaz/z-acckrb1.h line 19
struct Z_KRBRequest;
// tag-Z_KRBResponse
// file /usr/include/yaz/z-acckrb1.h line 22
struct Z_KRBResponse;
// tag-Z_LeftAndRight
// file /usr/include/yaz/z-charneg.h line 49
struct Z_LeftAndRight;
// tag-Z_MultipleSearchTerms_2
// file /usr/include/yaz/z-mterm2.h line 19
struct Z_MultipleSearchTerms_2;
// tag-Z_MultipleSearchTerms_2_s
// file /usr/include/yaz/z-mterm2.h line 16
struct Z_MultipleSearchTerms_2_s;
// tag-Z_NamePlusRecord
// file /usr/include/yaz/z-core.h line 109
struct Z_NamePlusRecord;
// tag-Z_NetworkAddress
// file /usr/include/yaz/z-exp.h line 187
struct Z_NetworkAddress;
// tag-Z_NetworkAddressIA
// file /usr/include/yaz/z-exp.h line 178
struct Z_NetworkAddressIA;
// tag-Z_NetworkAddressOPA
// file /usr/include/yaz/z-exp.h line 181
struct Z_NetworkAddressOPA;
// tag-Z_NetworkAddressOther
// file /usr/include/yaz/z-exp.h line 184
struct Z_NetworkAddressOther;
// tag-Z_OCLC_UserInformation
// file /usr/include/yaz/z-oclcui.h line 15
struct Z_OCLC_UserInformation;
// tag-Z_OPACRecord
// file /usr/include/yaz/z-opac.h line 16
struct Z_OPACRecord;
// tag-Z_OccurValues
// file /usr/include/yaz/z-espec1.h line 44
struct Z_OccurValues;
// tag-Z_Occurrences
// file /usr/include/yaz/z-espec1.h line 47
struct Z_Occurrences;
// tag-Z_OidList
// file /usr/include/yaz/z-diag1.h line 64
struct Z_OidList;
// tag-Z_OmittedAttributeInterpretation
// file /usr/include/yaz/z-exp.h line 85
struct Z_OmittedAttributeInterpretation;
// tag-Z_Operand
// file /usr/include/yaz/z-core.h line 55
struct Z_Operand;
// tag-Z_Operator
// file /usr/include/yaz/z-core.h line 70
struct Z_Operator;
// tag-Z_Order
// file /usr/include/yaz/z-grs.h line 34
struct Z_Order;
// tag-Z_OriginProposal
// file /usr/include/yaz/z-charneg.h line 22
struct Z_OriginProposal;
// tag-Z_OriginProposal_0
// file /usr/include/yaz/z-charneg.h line 19
struct Z_OriginProposal_0;
// tag-Z_OtherInformation
// file /usr/include/yaz/z-core.h line 289
struct Z_OtherInformation;
// tag-Z_OtherInformationUnit
// file /usr/include/yaz/z-core.h line 286
struct Z_OtherInformationUnit;
// tag-Z_PQSOriginPartNotToKeep
// file /usr/include/yaz/zes-psched.h line 29
struct Z_PQSOriginPartNotToKeep;
// tag-Z_PQSOriginPartToKeep
// file /usr/include/yaz/zes-psched.h line 26
struct Z_PQSOriginPartToKeep;
// tag-Z_PQSPeriod
// file /usr/include/yaz/zes-psched.h line 35
struct Z_PQSPeriod;
// tag-Z_PQSPeriodicQuerySchedule
// file /usr/include/yaz/zes-psched.h line 23
struct Z_PQSPeriodicQuerySchedule;
// tag-Z_PQSPeriodicQueryScheduleEsRequest
// file /usr/include/yaz/zes-psched.h line 17
struct Z_PQSPeriodicQueryScheduleEsRequest;
// tag-Z_PQSPeriodicQueryScheduleTaskPackage
// file /usr/include/yaz/zes-psched.h line 20
struct Z_PQSPeriodicQueryScheduleTaskPackage;
// tag-Z_PQSTargetPart
// file /usr/include/yaz/zes-psched.h line 32
struct Z_PQSTargetPart;
// tag-Z_PQueryOriginPartNotToKeep
// file /usr/include/yaz/zes-pquery.h line 28
struct Z_PQueryOriginPartNotToKeep;
// tag-Z_PQueryOriginPartToKeep
// file /usr/include/yaz/zes-pquery.h line 25
struct Z_PQueryOriginPartToKeep;
// tag-Z_PQueryPersistentQuery
// file /usr/include/yaz/zes-pquery.h line 22
struct Z_PQueryPersistentQuery;
// tag-Z_PQueryPersistentQueryEsRequest
// file /usr/include/yaz/zes-pquery.h line 16
struct Z_PQueryPersistentQueryEsRequest;
// tag-Z_PQueryPersistentQueryTaskPackage
// file /usr/include/yaz/zes-pquery.h line 19
struct Z_PQueryPersistentQueryTaskPackage;
// tag-Z_PROriginPartNotToKeep
// file /usr/include/yaz/zes-pset.h line 25
struct Z_PROriginPartNotToKeep;
// tag-Z_PRPersistentResultSet
// file /usr/include/yaz/zes-pset.h line 22
struct Z_PRPersistentResultSet;
// tag-Z_PRPersistentResultSetEsRequest
// file /usr/include/yaz/zes-pset.h line 16
struct Z_PRPersistentResultSetEsRequest;
// tag-Z_PRPersistentResultSetTaskPackage
// file /usr/include/yaz/zes-pset.h line 19
struct Z_PRPersistentResultSetTaskPackage;
// tag-Z_PRTargetPart
// file /usr/include/yaz/zes-pset.h line 28
struct Z_PRTargetPart;
// tag-Z_Path
// file /usr/include/yaz/z-exp.h line 37
struct Z_Path;
// tag-Z_PathUnit
// file /usr/include/yaz/z-exp.h line 34
struct Z_PathUnit;
// tag-Z_PerElementDetails
// file /usr/include/yaz/z-exp.h line 103
struct Z_PerElementDetails;
// tag-Z_Permissions
// file /usr/include/yaz/z-core.h line 253
struct Z_Permissions;
// tag-Z_Permissions_s
// file /usr/include/yaz/z-core.h line 250
struct Z_Permissions_s;
// tag-Z_PrivateCapOperator
// file /usr/include/yaz/z-exp.h line 196
struct Z_PrivateCapOperator;
// tag-Z_PrivateCapabilities
// file /usr/include/yaz/z-exp.h line 199
struct Z_PrivateCapabilities;
// tag-Z_PrivateCharacterSet
// file /usr/include/yaz/z-charneg.h line 31
struct Z_PrivateCharacterSet;
// tag-Z_PrivateCharacterSetViaOid
// file /usr/include/yaz/z-charneg.h line 28
struct Z_PrivateCharacterSetViaOid;
// tag-Z_ProcessingInformation
// file /usr/include/yaz/z-exp.h line 115
struct Z_ProcessingInformation;
// tag-Z_PromptId
// file /usr/include/yaz/z-accform1.h line 34
struct Z_PromptId;
// tag-Z_PromptIdEnumeratedPrompt
// file /usr/include/yaz/z-accform1.h line 31
struct Z_PromptIdEnumeratedPrompt;
// tag-Z_PromptObject1
// file /usr/include/yaz/z-accform1.h line 16
struct Z_PromptObject1;
// tag-Z_ProxSupportPrivate
// file /usr/include/yaz/z-exp.h line 208
struct Z_ProxSupportPrivate;
// tag-Z_ProxSupportUnit
// file /usr/include/yaz/z-exp.h line 211
struct Z_ProxSupportUnit;
// tag-Z_Proximity
// file /usr/include/yaz/z-diag1.h line 43
struct Z_Proximity;
// tag-Z_ProximityOperator
// file /usr/include/yaz/z-core.h line 79
struct Z_ProximityOperator;
// tag-Z_ProximitySupport
// file /usr/include/yaz/z-exp.h line 214
struct Z_ProximitySupport;
// tag-Z_Query
// file /usr/include/yaz/z-core.h line 43
struct Z_Query;
// tag-Z_QueryExpression
// file /usr/include/yaz/z-uifr1.h line 34
struct Z_QueryExpression;
// tag-Z_QueryExpressionTerm
// file /usr/include/yaz/z-uifr1.h line 31
struct Z_QueryExpressionTerm;
// tag-Z_QueryTypeDetails
// file /usr/include/yaz/z-exp.h line 193
struct Z_QueryTypeDetails;
// tag-Z_RPNQuery
// file /usr/include/yaz/z-core.h line 46
struct Z_RPNQuery;
// tag-Z_RPNStructure
// file /usr/include/yaz/z-core.h line 52
struct Z_RPNStructure;
// tag-Z_RecordSyntax
// file /usr/include/yaz/z-diag1.h line 73
struct Z_RecordSyntax;
// tag-Z_RecordSyntaxInfo
// file /usr/include/yaz/z-exp.h line 55
struct Z_RecordSyntaxInfo;
// tag-Z_RecordTag
// file /usr/include/yaz/z-exp.h line 106
struct Z_RecordTag;
// tag-Z_ResourceReport1
// file /usr/include/yaz/z-rrf1.h line 16
struct Z_ResourceReport1;
// tag-Z_ResourceReport2
// file /usr/include/yaz/z-rrf2.h line 16
struct Z_ResourceReport2;
// tag-Z_Response1
// file /usr/include/yaz/z-accform1.h line 28
struct Z_Response1;
// tag-Z_ResponseUnit1
// file /usr/include/yaz/z-accform1.h line 25
struct Z_ResponseUnit1;
// tag-Z_ResultSetPlusAttributes
// file /usr/include/yaz/z-core.h line 61
struct Z_ResultSetPlusAttributes;
// tag-Z_ResultsByDB
// file /usr/include/yaz/z-uifr1.h line 28
struct Z_ResultsByDB;
// tag-Z_ResultsByDB_s
// file /usr/include/yaz/z-uifr1.h line 25
struct Z_ResultsByDB_s;
// tag-Z_ResultsByDB_sList
// file /usr/include/yaz/z-uifr1.h line 22
struct Z_ResultsByDB_sList;
// tag-Z_RetrievalRecordDetails
// file /usr/include/yaz/z-exp.h line 100
struct Z_RetrievalRecordDetails;
// tag-Z_RpnCapabilities
// file /usr/include/yaz/z-exp.h line 202
struct Z_RpnCapabilities;
// tag-Z_Scan
// file /usr/include/yaz/z-diag1.h line 49
struct Z_Scan;
// tag-Z_SchemaInfo
// file /usr/include/yaz/z-exp.h line 28
struct Z_SchemaInfo;
// tag-Z_SearchInfoReport
// file /usr/include/yaz/z-uifr1.h line 19
struct Z_SearchInfoReport;
// tag-Z_SearchInfoReport_s
// file /usr/include/yaz/z-uifr1.h line 16
struct Z_SearchInfoReport_s;
// tag-Z_SearchKey
// file /usr/include/yaz/z-exp.h line 217
struct Z_SearchKey;
// tag-Z_Segment
// file /usr/include/yaz/z-core.h line 94
struct Z_Segment;
// tag-Z_Segmentation
// file /usr/include/yaz/z-diag1.h line 58
struct Z_Segmentation;
// tag-Z_SimpleElement
// file /usr/include/yaz/z-espec1.h line 32
struct Z_SimpleElement;
// tag-Z_Sort
// file /usr/include/yaz/z-diag1.h line 55
struct Z_Sort;
// tag-Z_SortAttributes
// file /usr/include/yaz/z-core.h line 238
struct Z_SortAttributes;
// tag-Z_SortDbSpecificList
// file /usr/include/yaz/z-core.h line 232
struct Z_SortDbSpecificList;
// tag-Z_SortDbSpecificList_s
// file /usr/include/yaz/z-core.h line 229
struct Z_SortDbSpecificList_s;
// tag-Z_SortDetails
// file /usr/include/yaz/z-exp.h line 109
struct Z_SortDetails;
// tag-Z_SortElement
// file /usr/include/yaz/z-core.h line 235
struct Z_SortElement;
// tag-Z_SortKey
// file /usr/include/yaz/z-core.h line 241
struct Z_SortKey;
// tag-Z_SortKeyDetails
// file /usr/include/yaz/z-exp.h line 112
struct Z_SortKeyDetails;
// tag-Z_SpecificTag
// file /usr/include/yaz/z-espec1.h line 35
struct Z_SpecificTag;
// tag-Z_Specification
// file /usr/include/yaz/z-core.h line 145
struct Z_Specification;
// tag-Z_StringList
// file /usr/include/yaz/z-diag1.h line 52
struct Z_StringList;
// tag-Z_StringOrNumeric
// file /usr/include/yaz/z-core.h line 313
struct Z_StringOrNumeric;
// tag-Z_TagPath
// file /usr/include/yaz/z-grs.h line 31
struct Z_TagPath;
// tag-Z_TagPath_s
// file /usr/include/yaz/z-grs.h line 28
struct Z_TagPath_s;
// tag-Z_TagSetElements
// file /usr/include/yaz/z-exp.h line 49
struct Z_TagSetElements;
// tag-Z_TagSetInfo
// file /usr/include/yaz/z-exp.h line 52
struct Z_TagSetInfo;
// tag-Z_TagTypeMapping
// file /usr/include/yaz/z-exp.h line 25
struct Z_TagTypeMapping;
// tag-Z_TaggedElement
// file /usr/include/yaz/z-grs.h line 19
struct Z_TaggedElement;
// tag-Z_TargetInfo
// file /usr/include/yaz/z-exp.h line 19
struct Z_TargetInfo;
// tag-Z_TargetResponse
// file /usr/include/yaz/z-charneg.h line 25
struct Z_TargetResponse;
// tag-Z_TaskPackage
// file /usr/include/yaz/z-estask.h line 16
struct Z_TaskPackage;
// tag-Z_Term
// file /usr/include/yaz/z-core.h line 67
struct Z_Term;
// tag-Z_TermListDetails
// file /usr/include/yaz/z-exp.h line 94
struct Z_TermListDetails;
// tag-Z_TermListElement
// file /usr/include/yaz/z-exp.h line 67
struct Z_TermListElement;
// tag-Z_TermListInfo
// file /usr/include/yaz/z-exp.h line 70
struct Z_TermListInfo;
// tag-Z_Time
// file /usr/include/yaz/z-date.h line 37
struct Z_Time;
// tag-Z_TooMany
// file /usr/include/yaz/z-diag1.h line 22
struct Z_TooMany;
// tag-Z_Triple
// file /usr/include/yaz/z-grs.h line 43
struct Z_Triple;
// tag-Z_Unit
// file /usr/include/yaz/z-core.h line 298
struct Z_Unit;
// tag-Z_UnitInfo
// file /usr/include/yaz/z-exp.h line 142
struct Z_UnitInfo;
// tag-Z_UnitType
// file /usr/include/yaz/z-exp.h line 145
struct Z_UnitType;
// tag-Z_Units
// file /usr/include/yaz/z-exp.h line 148
struct Z_Units;
// tag-Z_UniverseReport
// file /usr/include/yaz/z-univ.h line 22
struct Z_UniverseReport;
// tag-Z_UniverseReportDuplicate
// file /usr/include/yaz/z-univ.h line 19
struct Z_UniverseReportDuplicate;
// tag-Z_UniverseReportHits
// file /usr/include/yaz/z-univ.h line 16
struct Z_UniverseReportHits;
// tag-Z_Usage
// file /usr/include/yaz/z-grs.h line 37
struct Z_Usage;
// tag-Z_ValueDescription
// file /usr/include/yaz/z-exp.h line 139
struct Z_ValueDescription;
// tag-Z_ValueRange
// file /usr/include/yaz/z-exp.h line 136
struct Z_ValueRange;
// tag-Z_ValueSet
// file /usr/include/yaz/z-exp.h line 133
struct Z_ValueSet;
// tag-Z_ValueSetEnumerated
// file /usr/include/yaz/z-exp.h line 130
struct Z_ValueSetEnumerated;
// tag-Z_Variant
// file /usr/include/yaz/z-grs.h line 46
struct Z_Variant;
// tag-Z_VariantClass
// file /usr/include/yaz/z-exp.h line 121
struct Z_VariantClass;
// tag-Z_VariantSetInfo
// file /usr/include/yaz/z-exp.h line 118
struct Z_VariantSetInfo;
// tag-Z_VariantType
// file /usr/include/yaz/z-exp.h line 124
struct Z_VariantType;
// tag-Z_VariantValue
// file /usr/include/yaz/z-exp.h line 127
struct Z_VariantValue;
// tag-Z_Volume
// file /usr/include/yaz/z-opac.h line 25
struct Z_Volume;
// tag-_IO_FILE
// file /usr/include/stdio.h line 44
struct _IO_FILE;
// tag-_IO_marker
// file /usr/include/libio.h line 160
struct _IO_marker;
// tag-__pthread_internal_list
// file /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h line 75
struct __pthread_internal_list;
// tag-__pthread_mutex_s
// file /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h line 92
struct __pthread_mutex_s;
// tag-_xmlAttr
// file /usr/include/libxml2/libxml/tree.h line 432
struct _xmlAttr;
// tag-_xmlDict
// file /usr/include/libxml2/libxml/dict.h line 25
struct _xmlDict;
// tag-_xmlDoc
// file /usr/include/libxml2/libxml/tree.h line 262
struct _xmlDoc;
// tag-_xmlDtd
// file /usr/include/libxml2/libxml/tree.h line 259
struct _xmlDtd;
// tag-_xmlNode
// file /usr/include/libxml2/libxml/tree.h line 257
struct _xmlNode;
// tag-_xmlNs
// file /usr/include/libxml2/libxml/tree.h line 387
struct _xmlNs;
// tag-chr_t_entry
// file ../include/charmap.h line 35
struct chr_t_entry;
// tag-chrmaptab_info
// file ../include/charmap.h line 38
struct chrmaptab_info;
// tag-chrwork
// file charmap.c line 74
struct chrwork;
// tag-flock
// file /usr/include/x86_64-linux-gnu/bits/fcntl.h line 35
struct flock;
// tag-icu_chain
// file /usr/include/yaz/icu.h line 45
struct icu_chain;
// tag-iscz1_code_info
// file it_key.c line 125
struct iscz1_code_info;
// tag-it_key
// file ../include/it_key.h line 30
struct it_key;
// tag-nmem_control
// file /usr/include/yaz/nmem.h line 44
struct nmem_control;
// tag-odr_bitmask
// file /usr/include/yaz/odr.h line 111
struct odr_bitmask;
// tag-odr_oct
// file /usr/include/yaz/odr.h line 99
struct odr_oct;
// tag-passwd_db
// file ../include/passwddb.h line 27
struct passwd_db;
// tag-passwd_entry
// file passwddb.c line 41
struct passwd_entry;
// tag-pthread_attr_t
// file /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h line 63
union pthread_attr_t;
// tag-res_entry
// file res.c line 40
struct res_entry;
// tag-res_struct
// file ../include/idzebra/res.h line 27
struct res_struct;
// tag-strmap_entry
// file strmap.c line 29
struct strmap_entry;
// tag-timespec
// file /usr/include/time.h line 120
struct timespec;
// tag-timeval
// file /usr/include/x86_64-linux-gnu/bits/time.h line 30
struct timeval;
// tag-timezone
// file /usr/include/x86_64-linux-gnu/sys/time.h line 55
struct timezone;
// tag-wrbuf
// file /usr/include/yaz/wrbuf.h line 42
struct wrbuf;
// tag-xpath_location_step
// file ../include/zebra_xpath.h line 44
struct xpath_location_step;
// tag-xpath_predicate
// file ../include/zebra_xpath.h line 26
struct xpath_predicate;
// tag-yaz_iconv_struct
// file /usr/include/yaz/yaz-iconv.h line 42
struct yaz_iconv_struct;
// tag-yaz_tok_cfg
// file /usr/include/yaz/tokenizer.h line 43
struct yaz_tok_cfg;
// tag-yaz_tok_parse
// file /usr/include/yaz/tokenizer.h line 44
struct yaz_tok_parse;
// tag-zebra_lock_handle
// file ../include/idzebra/flock.h line 27
struct zebra_lock_handle;
// tag-zebra_lock_info
// file flock.c line 53
struct zebra_lock_info;
// tag-zebra_map
// file ../include/zebramap.h line 29
struct zebra_map;
// tag-zebra_maps_s
// file ../include/zebramap.h line 28
struct zebra_maps_s;
// tag-zebra_snippet_word
// file ../include/idzebra/snippet.h line 27
struct zebra_snippet_word;
// tag-zebra_snippets
// file ../include/idzebra/snippet.h line 38
struct zebra_snippets;
// tag-zebra_strmap
// file ../include/zebra_strmap.h line 27
struct zebra_strmap;
// tag-zebra_strmap_it_s
// file ../include/zebra_strmap.h line 28
struct zebra_strmap_it_s;
#include <assert.h>
#ifndef NULL
#define NULL ((void*)0)
#endif
// _IO_putc
// file /usr/include/libio.h line 435
extern signed int _IO_putc(signed int, struct _IO_FILE *);
// __assert_fail
// file /usr/include/assert.h line 69
extern void __assert_fail(const char *, const char *, unsigned int, const char *);
// __ctype_b_loc
// file /usr/include/ctype.h line 79
extern const unsigned short int ** __ctype_b_loc(void);
// abort
// file /usr/include/stdlib.h line 515
extern void abort(void);
// add_entry
// file res.c line 60
static struct res_entry * add_entry(struct res_struct *r);
// atoi
// file /usr/include/stdlib.h line 147
extern signed int atoi(const char *);
// atoi_zn
// file atoi_zn.c line 27
signed long long int atoi_zn(const char *buf, signed long long int len);
// atoll
// file /usr/include/stdlib.h line 157
extern signed long long int atoll(const char *);
// atozint
// file zint.c line 55
signed long long int atozint(const char *src);
// attr_find
// file ../include/attrfind.h line 42
signed int attr_find(struct anonymous$89 *src, const signed short int **attribute_set_id);
// attr_find_ex
// file ../include/attrfind.h line 40
signed int attr_find_ex(struct anonymous$89 *src, const signed short int **attribute_set_oid, const char **string_value);
// attr_init_APT
// file ../include/attrfind.h line 36
void attr_init_APT(struct anonymous$89 *src, struct Z_AttributesPlusTerm *zapt, signed int type);
// attr_init_AttrList
// file ../include/attrfind.h line 38
void attr_init_AttrList(struct anonymous$89 *src, struct Z_AttributeList *list, signed int type);
// check_for_linuxthreads
// file flock.c line 371
static signed int check_for_linuxthreads(void);
// chr_map_input
// file charmap.c line 194
const char ** chr_map_input(struct chrmaptab_info *maptab, const char **from, signed int len, signed int first);
// chr_map_input_x
// file charmap.c line 184
const char ** chr_map_input_x(struct chrmaptab_info *maptab, const char **from, signed int *len, signed int first);
// chr_map_output
// file charmap.c line 221
const char * chr_map_output(struct chrmaptab_info *maptab, const char **from, signed int len);
// chr_map_q_input
// file charmap.c line 207
const char ** chr_map_q_input(struct chrmaptab_info *maptab, const char **from, signed int len, signed int first);
// chrmaptab_create
// file charmap.c line 513
struct chrmaptab_info * chrmaptab_create(const char *tabpath, const char *name, const char *tabroot);
// chrmaptab_destroy
// file charmap.c line 748
void chrmaptab_destroy(struct chrmaptab_info *tab);
// close
// file /usr/include/unistd.h line 353
extern signed int close(signed int);
// confstr
// file /usr/include/unistd.h line 623
extern unsigned long int confstr(signed int, char *, unsigned long int);
// crypt
// file /usr/include/crypt.h line 32
extern char * crypt(const char *, const char *);
// dump_xp_predicate
// file xpath.c line 216
void dump_xp_predicate(struct xpath_predicate *p);
// dump_xp_steps
// file xpath.c line 235
void dump_xp_steps(struct xpath_location_step *xpath, signed int no);
// exit
// file /usr/include/stdlib.h line 543
extern void exit(signed int);
// fclose
// file /usr/include/stdio.h line 237
extern signed int fclose(struct _IO_FILE *);
// fcntl
// file /usr/include/fcntl.h line 137
extern signed int fcntl(signed int, signed int, ...);
// fgets
// file /usr/include/stdio.h line 622
extern char * fgets(char *, signed int, struct _IO_FILE *);
// find_entry_x
// file charmap.c line 141
static struct chr_t_entry * find_entry_x(struct chr_t_entry *t, const char **from, signed int *len, signed int first);
// fopen
// file /usr/include/stdio.h line 272
extern struct _IO_FILE * fopen(const char *, const char *);
// fork
// file /usr/include/unistd.h line 756
extern signed int fork(void);
// fork_tst
// file tstflock.c line 216
void fork_tst(void);
// fprintf
// file /usr/include/stdio.h line 356
extern signed int fprintf(struct _IO_FILE *, const char *, ...);
// fun_add_equivalent_string
// file charmap.c line 369
static void fun_add_equivalent_string(const char *s, void *data, signed int num);
// fun_add_map
// file charmap.c line 381
static void fun_add_map(const char *s, void *data, signed int num);
// fun_addcut
// file charmap.c line 344
static void fun_addcut(const char *s, void *data, signed int num);
// fun_addentry
// file charmap.c line 318
static void fun_addentry(const char *s, void *data, signed int num);
// fun_addspace
// file charmap.c line 333
static void fun_addspace(const char *s, void *data, signed int num);
// fun_mkstring
// file charmap.c line 354
static void fun_mkstring(const char *s, void *data, signed int num);
// get_entry
// file passwddb.c line 59
static signed int get_entry(const char **p, char *dst, signed int max);
// get_xp_part
// file xpath.c line 31
static char * get_xp_part(char **strs, struct nmem_control *mem, signed int *literal);
// get_xpath_boolean
// file xpath.c line 121
static struct xpath_predicate * get_xpath_boolean(char **pr, struct nmem_control *mem, char **look, signed int *literal);
// get_xpath_predicate
// file xpath.c line 151
static struct xpath_predicate * get_xpath_predicate(char *predicate, struct nmem_control *mem);
// get_xpath_relation
// file xpath.c line 82
static struct xpath_predicate * get_xpath_relation(char **pr, struct nmem_control *mem, char **look, signed int *literal);
// getenv
// file /usr/include/stdlib.h line 564
extern char * getenv(const char *);
// gettimeofday
// file /usr/include/x86_64-linux-gnu/sys/time.h line 71
extern signed int gettimeofday(struct timeval *, struct timezone *);
// hash
// file strmap.c line 70
static struct strmap_entry ** hash(struct zebra_strmap *st, const char *name);
// icu_chain_assign_cstr
// file /usr/include/yaz/icu.h line 66
signed int icu_chain_assign_cstr(struct icu_chain *, const char *, enum UErrorCode *);
// icu_chain_destroy
// file /usr/include/yaz/icu.h line 48
void icu_chain_destroy(struct icu_chain *);
// icu_chain_next_token
// file /usr/include/yaz/icu.h line 79
signed int icu_chain_next_token(struct icu_chain *, enum UErrorCode *);
// icu_chain_token_display
// file /usr/include/yaz/icu.h line 94
const char * icu_chain_token_display(struct icu_chain *);
// icu_chain_token_sortkey
// file /usr/include/yaz/icu.h line 110
const char * icu_chain_token_sortkey(struct icu_chain *);
// icu_chain_xml_config
// file /usr/include/yaz/icu.h line 56
struct icu_chain * icu_chain_xml_config(const struct _xmlNode *, signed int, enum UErrorCode *);
// iscz1_decode
// file it_key.c line 237
void iscz1_decode(void *vp, char **dst, const char **src);
// iscz1_decode_int
// file it_key.c line 174
static inline signed long long int iscz1_decode_int(unsigned char **src);
// iscz1_encode
// file it_key.c line 189
void iscz1_encode(void *vp, char **dst, const char **src);
// iscz1_encode_int
// file it_key.c line 160
static inline void iscz1_encode_int(signed long long int d, char **dst);
// iscz1_reset
// file it_key.c line 145
void iscz1_reset(void *vp);
// iscz1_start
// file it_key.c line 129
void * iscz1_start(void);
// iscz1_stop
// file it_key.c line 154
void iscz1_stop(void *p);
// key_SU_decode
// file su_codec.c line 64
signed int key_SU_decode(signed int *ch, const unsigned char *out);
// key_SU_encode
// file su_codec.c line 31
signed int key_SU_encode(signed int ch, char *out);
// key_compare
// file it_key.c line 73
signed int key_compare(const void *p1, const void *p2);
// key_get_segment
// file it_key.c line 103
signed long long int key_get_segment(const void *p);
// key_get_seq
// file it_key.c line 96
signed long long int key_get_seq(const void *p);
// key_init
// file it_key.c line 137
void key_init(struct it_key *key);
// key_logdump
// file it_key.c line 62
void key_logdump(signed int logmask, const void *p);
// key_logdump_txt
// file it_key.c line 37
void key_logdump_txt(signed int logmask, const void *p, const char *txt);
// key_print_it
// file it_key.c line 67
char * key_print_it(const void *p, char *buf);
// key_qsort_compare
// file it_key.c line 110
signed int key_qsort_compare(const void *p1, const void *p2);
// memcmp
// file /usr/include/string.h line 69
extern signed int memcmp(const void *, const void *, unsigned long int);
// memcpy
// file /usr/include/string.h line 46
extern void * memcpy(void *, const void *, unsigned long int);
// nmem_create
// file /usr/include/yaz/nmem.h line 190
struct nmem_control * nmem_create(void);
// nmem_destroy
// file /usr/include/yaz/nmem.h line 195
void nmem_destroy(struct nmem_control *);
// nmem_malloc
// file /usr/include/yaz/nmem.h line 202
void * nmem_malloc(struct nmem_control *, unsigned long int);
// nmem_strdup
// file /usr/include/yaz/nmem.h line 88
char * nmem_strdup(struct nmem_control *, const char *);
// open
// file /usr/include/fcntl.h line 146
extern signed int open(const char *, signed int, ...);
// parse_command
// file zebramap.c line 140
static signed int parse_command(struct zebra_maps_s *zms, signed int argc, char **argv, const char *fname, signed int lineno);
// passwd_db_auth
// file passwddb.c line 128
signed int passwd_db_auth(struct passwd_db *db, const char *user, const char *pass);
// passwd_db_close
// file passwddb.c line 106
void passwd_db_close(struct passwd_db *db);
// passwd_db_file_crypt
// file passwddb.c line 172
signed int passwd_db_file_crypt(struct passwd_db *db, const char *fname);
// passwd_db_file_int
// file passwddb.c line 75
static signed int passwd_db_file_int(struct passwd_db *db, const char *fname, signed int encrypt_flag);
// passwd_db_file_plain
// file passwddb.c line 181
signed int passwd_db_file_plain(struct passwd_db *db, const char *fname);
// passwd_db_open
// file passwddb.c line 52
struct passwd_db * passwd_db_open(void);
// passwd_db_show
// file passwddb.c line 121
void passwd_db_show(struct passwd_db *db);
// printf
// file /usr/include/stdio.h line 362
extern signed int printf(const char *, ...);
// pthread_cond_broadcast
// file /usr/include/pthread.h line 983
extern signed int pthread_cond_broadcast(union anonymous$48 *);
// pthread_cond_destroy
// file /usr/include/pthread.h line 975
extern signed int pthread_cond_destroy(union anonymous$48 *);
// pthread_cond_init
// file /usr/include/pthread.h line 970
extern signed int pthread_cond_init(union anonymous$48 *, const union anonymous$53 *);
// pthread_cond_signal
// file /usr/include/pthread.h line 979
extern signed int pthread_cond_signal(union anonymous$48 *);
// pthread_cond_timedwait
// file /usr/include/pthread.h line 1002
extern signed int pthread_cond_timedwait(union anonymous$48 *, union anonymous$47 *, struct timespec *);
// pthread_cond_wait
// file /usr/include/pthread.h line 991
extern signed int pthread_cond_wait(union anonymous$48 *, union anonymous$47 *);
// pthread_create
// file /usr/include/pthread.h line 235
extern signed int pthread_create(unsigned long int *, const union pthread_attr_t *, void * (*)(void *), void *);
// pthread_join
// file /usr/include/pthread.h line 252
extern signed int pthread_join(unsigned long int, void **);
// pthread_mutex_destroy
// file /usr/include/pthread.h line 756
extern signed int pthread_mutex_destroy(union anonymous$47 *);
// pthread_mutex_init
// file /usr/include/pthread.h line 751
extern signed int pthread_mutex_init(union anonymous$47 *, const union anonymous$53 *);
// pthread_mutex_lock
// file /usr/include/pthread.h line 764
extern signed int pthread_mutex_lock(union anonymous$47 *);
// pthread_mutex_unlock
// file /usr/include/pthread.h line 775
extern signed int pthread_mutex_unlock(union anonymous$47 *);
// rand
// file /usr/include/stdlib.h line 374
extern signed int rand(void);
// readconf_line
// file /usr/include/yaz/readconf.h line 45
signed int readconf_line(struct _IO_FILE *, signed int *, char *, signed int, char **, signed int);
// res_add
// file res.c line 445
void res_add(struct res_struct *r, const char *name, const char *value);
// res_check
// file res.c line 479
signed int res_check(struct res_struct *r_i, struct res_struct *r_v);
// res_clear
// file res.c line 246
void res_clear(struct res_struct *r);
// res_close
// file res.c line 261
void res_close(struct res_struct *r);
// res_dump
// file res.c line 457
void res_dump(struct res_struct *r, signed int level);
// res_get
// file res.c line 294
const char * res_get(struct res_struct *r, const char *name);
// res_get_def
// file res.c line 313
const char * res_get_def(struct res_struct *r, const char *name, const char *def);
// res_get_int
// file res.c line 432
signed short int res_get_int(struct res_struct *r, const char *name, signed int *val);
// res_get_match
// file res.c line 327
signed int res_get_match(struct res_struct *r, const char *name, const char *value, const char *s);
// res_get_prefix
// file res.c line 272
const char * res_get_prefix(struct res_struct *r, const char *name, const char *prefix, const char *def);
// res_incref
// file res.c line 53
static struct res_struct * res_incref(struct res_struct *r);
// res_open
// file res.c line 234
struct res_struct * res_open(struct res_struct *def_res, struct res_struct *over_res);
// res_read_file
// file res.c line 146
signed short int res_read_file(struct res_struct *r, const char *fname);
// res_set
// file res.c line 338
void res_set(struct res_struct *r, const char *name, const char *value);
// res_trav
// file res.c line 357
signed int res_trav(struct res_struct *r, const char *prefix, void *p, void (*f)(void *, const char *, const char *));
// res_trav::f$object
//
void f$object(void *, const char *, const char *);
// res_write_file
// file res.c line 384
signed short int res_write_file(struct res_struct *r, const char *fname);
// run_func
// file tstflock.c line 98
void * run_func(void *arg);
// scan_string
// file charmap.c line 421
static signed int scan_string(char *s_native, struct yaz_iconv_struct *t_unicode, struct yaz_iconv_struct *t_utf8, void (*fun)(const char *, void *, signed int), void *data, signed int *num);
// scan_string::fun$object
//
void fun$object(const char *, void *, signed int);
// scan_to_utf8
// file charmap.c line 393
static signed int scan_to_utf8(struct yaz_iconv_struct *t, unsigned int *from, unsigned long int inlen, char *outbuf, unsigned long int outbytesleft);
// set_map_string
// file charmap.c line 92
static struct chr_t_entry * set_map_string(struct chr_t_entry *root, struct nmem_control *nmem, const char *from, signed int len, char *to, const char *from_0);
// small_sleep
// file tstflock.c line 74
static void small_sleep(void);
// sprintf
// file /usr/include/stdio.h line 364
extern signed int sprintf(char *, const char *, ...);
// sscanf
// file /usr/include/stdio.h line 433
extern signed int sscanf(const char *, const char *, ...);
// strcat
// file /usr/include/string.h line 137
extern char * strcat(char *, const char *);
// strchr
// file /usr/include/string.h line 235
extern char * strchr(const char *, signed int);
// strcmp
// file /usr/include/string.h line 144
extern signed int strcmp(const char *, const char *);
// strcpy
// file /usr/include/string.h line 129
extern char * strcpy(char *, const char *);
// strlen
// file /usr/include/string.h line 398
extern unsigned long int strlen(const char *);
// strncat
// file /usr/include/string.h line 140
extern char * strncat(char *, const char *, unsigned long int);
// strncmp
// file /usr/include/string.h line 147
extern signed int strncmp(const char *, const char *, unsigned long int);
// tokenize_simple
// file zebramap.c line 628
static signed int tokenize_simple(struct zebra_map *zm, const char **result_buf, unsigned long int *result_len);
// tolower
// file /usr/include/ctype.h line 124
extern signed int tolower(signed int);
// tst
// file tstflock.c line 197
static void tst(void);
// tst_thread
// file tstflock.c line 149
static void tst_thread(signed int num, signed int write_flag);
// unixLock
// file flock.c line 232
static signed int unixLock(signed int fd, signed int type, signed int cmd);
// waitpid
// file /usr/include/x86_64-linux-gnu/sys/wait.h line 125
extern signed int waitpid(signed int, signed int *, signed int);
// wrbuf_alloc
// file /usr/include/yaz/wrbuf.h line 52
struct wrbuf * wrbuf_alloc(void);
// wrbuf_cstr
// file /usr/include/yaz/wrbuf.h line 229
const char * wrbuf_cstr(struct wrbuf *);
// wrbuf_destroy
// file /usr/include/yaz/wrbuf.h line 59
void wrbuf_destroy(struct wrbuf *);
// wrbuf_grow
// file /usr/include/yaz/wrbuf.h line 220
signed int wrbuf_grow(struct wrbuf *, unsigned long int);
// wrbuf_puts
// file /usr/include/yaz/wrbuf.h line 85
void wrbuf_puts(struct wrbuf *, const char *);
// wrbuf_puts_escaped
// file /usr/include/yaz/wrbuf.h line 121
void wrbuf_puts_escaped(struct wrbuf *, const char *);
// wrbuf_rewind
// file /usr/include/yaz/wrbuf.h line 64
void wrbuf_rewind(struct wrbuf *);
// wrbuf_write
// file /usr/include/yaz/wrbuf.h line 71
void wrbuf_write(struct wrbuf *, const char *, unsigned long int);
// wrbuf_write_escaped
// file /usr/include/yaz/wrbuf.h line 130
void wrbuf_write_escaped(struct wrbuf *, const char *, unsigned long int);
// write
// file /usr/include/unistd.h line 366
extern signed long int write(signed int, const void *, unsigned long int);
// xfree_f
// file /usr/include/yaz/xmalloc.h line 128
void xfree_f(void *, const char *, signed int);
// xmalloc_f
// file /usr/include/yaz/xmalloc.h line 82
void * xmalloc_f(unsigned long int, const char *, signed int);
// xmlDocGetRootElement
// file /usr/include/libxml2/libxml/tree.h line 920
struct _xmlNode * xmlDocGetRootElement(const struct _xmlDoc *);
// xmlFreeDoc
// file /usr/include/libxml2/libxml/tree.h line 782
void xmlFreeDoc(struct _xmlDoc *);
// xmlParseFile
// file /usr/include/libxml2/libxml/parser.h line 844
struct _xmlDoc * xmlParseFile(const char *);
// xstrdup_env
// file res.c line 77
static char * xstrdup_env(const char *src);
// xstrdup_f
// file /usr/include/yaz/xmalloc.h line 105
char * xstrdup_f(const char *, const char *, signed int);
// yaz_check_eq1
// file /usr/include/yaz/test.h line 107
void yaz_check_eq1(signed int, const char *, signed int, const char *, const char *, signed int, signed int);
// yaz_check_init1
// file /usr/include/yaz/test.h line 95
void yaz_check_init1(signed int *, char ***);
// yaz_check_init_log
// file /usr/include/yaz/test.h line 101
void yaz_check_init_log(const char *);
// yaz_check_print1
// file /usr/include/yaz/test.h line 104
void yaz_check_print1(signed int, const char *, signed int, const char *);
// yaz_check_term1
// file /usr/include/yaz/test.h line 98
void yaz_check_term1(void);
// yaz_fclose
// file /usr/include/yaz/tpath.h line 100
signed int yaz_fclose(struct _IO_FILE *);
// yaz_filepath_resolve
// file /usr/include/yaz/tpath.h line 71
char * yaz_filepath_resolve(const char *, const char *, const char *, char *);
// yaz_fopen
// file /usr/include/yaz/tpath.h line 82
struct _IO_FILE * yaz_fopen(const char *, const char *, const char *, const char *);
// yaz_iconv
// file /usr/include/yaz/yaz-iconv.h line 57
unsigned long int yaz_iconv(struct yaz_iconv_struct *, char **, unsigned long int *, char **, unsigned long int *);
// yaz_iconv_close
// file /usr/include/yaz/yaz-iconv.h line 63
signed int yaz_iconv_close(struct yaz_iconv_struct *);
// yaz_iconv_open
// file /usr/include/yaz/yaz-iconv.h line 54
struct yaz_iconv_struct * yaz_iconv_open(const char *, const char *);
// yaz_log
// file /usr/include/yaz/log.h line 140
void yaz_log(signed int, const char *, ...);
// yaz_log_init_level
// file /usr/include/yaz/log.h line 102
void yaz_log_init_level(signed int);
// yaz_log_mask_str
// file /usr/include/yaz/log.h line 156
signed int yaz_log_mask_str(const char *);
// yaz_log_module_level
// file /usr/include/yaz/log.h line 178
signed int yaz_log_module_level(const char *);
// yaz_matchstr
// file /usr/include/yaz/matchstr.h line 47
signed int yaz_matchstr(const char *, const char *);
// yaz_tok_cfg_create
// file /usr/include/yaz/tokenizer.h line 49
struct yaz_tok_cfg * yaz_tok_cfg_create(void);
// yaz_tok_cfg_destroy
// file /usr/include/yaz/tokenizer.h line 52
void yaz_tok_cfg_destroy(struct yaz_tok_cfg *);
// yaz_tok_move
// file /usr/include/yaz/tokenizer.h line 68
signed int yaz_tok_move(struct yaz_tok_parse *);
// yaz_tok_parse_buf
// file /usr/include/yaz/tokenizer.h line 58
struct yaz_tok_parse * yaz_tok_parse_buf(struct yaz_tok_cfg *, const char *);
// yaz_tok_parse_destroy
// file /usr/include/yaz/tokenizer.h line 65
void yaz_tok_parse_destroy(struct yaz_tok_parse *);
// yaz_tok_parse_string
// file /usr/include/yaz/tokenizer.h line 71
const char * yaz_tok_parse_string(struct yaz_tok_parse *);
// zebra_add_map
// file zebramap.c line 106
struct zebra_map * zebra_add_map(struct zebra_maps_s *zms, const char *index_type, signed int map_type);
// zebra_charmap_get
// file zebramap.c line 381
struct chrmaptab_info * zebra_charmap_get(struct zebra_map *zm);
// zebra_exit
// file exit.c line 26
void zebra_exit(const char *msg);
// zebra_flock_init
// file ../include/idzebra/flock.h line 46
void zebra_flock_init(void);
// zebra_get_version
// file version.c line 33
void zebra_get_version(char *version_str, char *sha1_str);
// zebra_lock_create
// file ../include/idzebra/flock.h line 30
struct zebra_lock_handle * zebra_lock_create(const char *dir, const char *name);
// zebra_lock_destroy
// file ../include/idzebra/flock.h line 33
void zebra_lock_destroy(struct zebra_lock_handle *h);
// zebra_lock_r
// file ../include/idzebra/flock.h line 43
signed int zebra_lock_r(struct zebra_lock_handle *h);
// zebra_lock_rdwr_destroy
// file zebra-lock.c line 100
signed int zebra_lock_rdwr_destroy(struct anonymous$56 *p);
// zebra_lock_rdwr_init
// file zebra-lock.c line 89
signed int zebra_lock_rdwr_init(struct anonymous$56 *p);
// zebra_lock_rdwr_rlock
// file zebra-lock.c line 111
signed int zebra_lock_rdwr_rlock(struct anonymous$56 *p);
// zebra_lock_rdwr_runlock
// file zebra-lock.c line 135
signed int zebra_lock_rdwr_runlock(struct anonymous$56 *p);
// zebra_lock_rdwr_wlock
// file zebra-lock.c line 123
signed int zebra_lock_rdwr_wlock(struct anonymous$56 *p);
// zebra_lock_rdwr_wunlock
// file zebra-lock.c line 155
signed int zebra_lock_rdwr_wunlock(struct anonymous$56 *p);
// zebra_lock_w
// file ../include/idzebra/flock.h line 41
signed int zebra_lock_w(struct zebra_lock_handle *h);
// zebra_map_get
// file zebramap.c line 354
struct zebra_map * zebra_map_get(struct zebra_maps_s *zms, const char *id);
// zebra_map_get_or_add
// file zebramap.c line 363
struct zebra_map * zebra_map_get_or_add(struct zebra_maps_s *zms, const char *id);
// zebra_map_tokenize_next
// file zebramap.c line 657
signed int zebra_map_tokenize_next(struct zebra_map *zm, const char **result_buf, unsigned long int *result_len, const char **display_buf, unsigned long int *display_len);
// zebra_map_tokenize_start
// file zebramap.c line 701
signed int zebra_map_tokenize_start(struct zebra_map *zm, const char *buf, unsigned long int len);
// zebra_maps_attr
// file zebramap.c line 514
signed int zebra_maps_attr(struct zebra_maps_s *zms, struct Z_AttributesPlusTerm *zapt, const char **index_type, char **search_type, char *rank_type, signed int *complete_flag, signed int *sort_flag);
// zebra_maps_close
// file zebramap.c line 83
void zebra_maps_close(struct zebra_maps_s *zms);
// zebra_maps_define_default_sort
// file zebramap.c line 348
void zebra_maps_define_default_sort(struct zebra_maps_s *zms);
// zebra_maps_input
// file zebramap.c line 398
const char ** zebra_maps_input(struct zebra_map *zm, const char **from, signed int len, signed int first);
// zebra_maps_is_alwaysmatches
// file zebramap.c line 484
signed int zebra_maps_is_alwaysmatches(struct zebra_map *zm);
// zebra_maps_is_complete
// file zebramap.c line 449
signed int zebra_maps_is_complete(struct zebra_map *zm);
// zebra_maps_is_first_in_field
// file zebramap.c line 491
signed int zebra_maps_is_first_in_field(struct zebra_map *zm);
// zebra_maps_is_icu
// file zebramap.c line 740
signed int zebra_maps_is_icu(struct zebra_map *zm);
// zebra_maps_is_index
// file zebramap.c line 463
signed int zebra_maps_is_index(struct zebra_map *zm);
// zebra_maps_is_positioned
// file zebramap.c line 456
signed int zebra_maps_is_positioned(struct zebra_map *zm);
// zebra_maps_is_sort
// file zebramap.c line 477
signed int zebra_maps_is_sort(struct zebra_map *zm);
// zebra_maps_is_staticrank
// file zebramap.c line 470
signed int zebra_maps_is_staticrank(struct zebra_map *zm);
// zebra_maps_open
// file zebramap.c line 323
struct zebra_maps_s * zebra_maps_open(struct res_struct *res, const char *base_path, const char *profile_path);
// zebra_maps_output
// file zebramap.c line 437
const char * zebra_maps_output(struct zebra_map *zm, const char **from);
// zebra_maps_read_file
// file zebramap.c line 294
signed short int zebra_maps_read_file(struct zebra_maps_s *zms, const char *fname);
// zebra_maps_search
// file zebramap.c line 411
const char ** zebra_maps_search(struct zebra_map *zm, const char **from, signed int len, signed int *q_map_match);
// zebra_maps_sort
// file zebramap.c line 498
signed int zebra_maps_sort(struct zebra_maps_s *zms, struct Z_SortAttributes *sortAttributes, signed int *numerical);
// zebra_mk_fname
// file flock.c line 84
char * zebra_mk_fname(const char *dir, const char *name);
// zebra_mutex_cond_destroy
// file zebra-lock.c line 183
signed int zebra_mutex_cond_destroy(struct anonymous$49 *p);
// zebra_mutex_cond_init
// file zebra-lock.c line 174
signed int zebra_mutex_cond_init(struct anonymous$49 *p);
// zebra_mutex_cond_lock
// file zebra-lock.c line 192
signed int zebra_mutex_cond_lock(struct anonymous$49 *p);
// zebra_mutex_cond_signal
// file zebra-lock.c line 219
signed int zebra_mutex_cond_signal(struct anonymous$49 *p);
// zebra_mutex_cond_unlock
// file zebra-lock.c line 201
signed int zebra_mutex_cond_unlock(struct anonymous$49 *p);
// zebra_mutex_cond_wait
// file zebra-lock.c line 210
signed int zebra_mutex_cond_wait(struct anonymous$49 *p);
// zebra_mutex_destroy
// file zebra-lock.c line 43
signed int zebra_mutex_destroy(struct anonymous$54 *p);
// zebra_mutex_init
// file zebra-lock.c line 31
signed int zebra_mutex_init(struct anonymous$54 *p);
// zebra_mutex_lock
// file zebra-lock.c line 59
signed int zebra_mutex_lock(struct anonymous$54 *p);
// zebra_mutex_unlock
// file zebra-lock.c line 74
signed int zebra_mutex_unlock(struct anonymous$54 *p);
// zebra_parse_xpath_str
// file xpath.c line 162
signed int zebra_parse_xpath_str(const char *xpath_string, struct xpath_location_step *xpath, signed int max, struct nmem_control *mem);
// zebra_prim_w
// file charmap.c line 239
unsigned int zebra_prim_w(unsigned int **s);
// zebra_replace
// file zebramap.c line 618
struct wrbuf * zebra_replace(struct zebra_map *zm, const char *ex_list, const char *input_str, signed int input_len);
// zebra_snippets_append
// file snippet.c line 51
void zebra_snippets_append(struct zebra_snippets *l, signed long long int seqno, signed int ws, signed int ord, const char *term);
// zebra_snippets_append_match
// file snippet.c line 65
void zebra_snippets_append_match(struct zebra_snippets *l, signed long long int seqno, signed int ws, signed int ord, const char *term, unsigned long int term_len, signed int match);
// zebra_snippets_appendn
// file snippet.c line 57
void zebra_snippets_appendn(struct zebra_snippets *l, signed long long int seqno, signed int ws, signed int ord, const char *term, unsigned long int term_len);
// zebra_snippets_clear
// file snippet.c line 207
static void zebra_snippets_clear(struct zebra_snippets *sn);
// zebra_snippets_constlist
// file snippet.c line 99
const struct zebra_snippet_word * zebra_snippets_constlist(const struct zebra_snippets *l);
// zebra_snippets_create
// file snippet.c line 36
struct zebra_snippets * zebra_snippets_create(void);
// zebra_snippets_destroy
// file snippet.c line 45
void zebra_snippets_destroy(struct zebra_snippets *l);
// zebra_snippets_list
// file snippet.c line 94
struct zebra_snippet_word * zebra_snippets_list(struct zebra_snippets *l);
// zebra_snippets_log
// file snippet.c line 104
void zebra_snippets_log(const struct zebra_snippets *l, signed int log_level, signed int all);
// zebra_snippets_lookup
// file snippet.c line 218
struct zebra_snippet_word * zebra_snippets_lookup(const struct zebra_snippets *doc, const struct zebra_snippets *hit);
// zebra_snippets_ring
// file snippet.c line 237
void zebra_snippets_ring(struct zebra_snippets *doc, const struct zebra_snippets *hit, signed int before, signed int after);
// zebra_snippets_window
// file snippet.c line 121
struct zebra_snippets * zebra_snippets_window(const struct zebra_snippets *doc, const struct zebra_snippets *hit, signed int window_size);
// zebra_strmap_add
// file strmap.c line 80
void zebra_strmap_add(struct zebra_strmap *st, const char *name, void *data_buf, unsigned long int data_len);
// zebra_strmap_create
// file strmap.c line 45
struct zebra_strmap * zebra_strmap_create(void);
// zebra_strmap_destroy
// file strmap.c line 61
void zebra_strmap_destroy(struct zebra_strmap *st);
// zebra_strmap_get_size
// file strmap.c line 136
signed int zebra_strmap_get_size(struct zebra_strmap *st);
// zebra_strmap_it_create
// file strmap.c line 148
struct zebra_strmap_it_s * zebra_strmap_it_create(struct zebra_strmap *st);
// zebra_strmap_it_destroy
// file strmap.c line 157
void zebra_strmap_it_destroy(struct zebra_strmap_it_s *it);
// zebra_strmap_it_next
// file strmap.c line 162
const char * zebra_strmap_it_next(struct zebra_strmap_it_s *it, void **data_buf, unsigned long int *data_len);
// zebra_strmap_lookup
// file strmap.c line 99
void * zebra_strmap_lookup(struct zebra_strmap *st, const char *name, signed int no, unsigned long int *data_len);
// zebra_strmap_remove
// file strmap.c line 118
signed int zebra_strmap_remove(struct zebra_strmap *st, const char *name);
// zebra_ucs4_strlen
// file charmap.c line 231
static signed int zebra_ucs4_strlen(unsigned int *s);
// zebra_unlock
// file ../include/idzebra/flock.h line 36
signed int zebra_unlock(struct zebra_lock_handle *h);
// zebra_zint_decode
// file zint.c line 39
void zebra_zint_decode(const char **src, signed long long int *pos);
// zebra_zint_encode
// file zint.c line 26
void zebra_zint_encode(char **dst, signed long long int pos);
struct anonymous$65
{
// name
char *name;
// op
char *op;
// value
char *value;
};
struct anonymous$35
{
// nmem
struct nmem_control *nmem;
// no_eq
signed int no_eq;
// eq
char *eq[32l];
};
struct anonymous$68
{
// op
const char *op;
// left
struct xpath_predicate *left;
// right
struct xpath_predicate *right;
};
struct anonymous$92
{
// __lock
signed int __lock;
// __futex
unsigned int __futex;
// __total_seq
unsigned long long int __total_seq;
// __wakeup_seq
unsigned long long int __wakeup_seq;
// __woken_seq
unsigned long long int __woken_seq;
// __mutex
void *__mutex;
// __nwaiters
unsigned int __nwaiters;
// __broadcast_seq
unsigned int __broadcast_seq;
};
struct anonymous$46
{
// entry_size
signed int entry_size;
};
struct __pthread_internal_list
{
// __prev
struct __pthread_internal_list *__prev;
// __next
struct __pthread_internal_list *__next;
};
struct __pthread_mutex_s
{
// __lock
signed int __lock;
// __count
unsigned int __count;
// __owner
signed int __owner;
// __nusers
unsigned int __nusers;
// __kind
signed int __kind;
// __spins
signed short int __spins;
// __elision
signed short int __elision;
// __list
struct __pthread_internal_list __list;
};
union anonymous$47
{
// __data
struct __pthread_mutex_s __data;
// __size
char __size[40l];
// __align
signed long int __align;
};
union anonymous$48
{
// __data
struct anonymous$92 __data;
// __size
char __size[48l];
// __align
signed long long int __align;
};
struct anonymous$56
{
// readers_reading
signed int readers_reading;
// writers_writing
signed int writers_writing;
// mutex
union anonymous$47 mutex;
// lock_free
union anonymous$48 lock_free;
};
struct anonymous$89
{
// type
signed int type;
// major
signed int major;
// minor
signed int minor;
// attributeList
struct Z_AttributeElement **attributeList;
// num_attributes
signed int num_attributes;
};
struct anonymous$54
{
// mutex
union anonymous$47 mutex;
// state
signed int state;
};
struct anonymous$49
{
// mutex
union anonymous$47 mutex;
// cond
union anonymous$48 cond;
};
union anonymous$62
{
// oid
signed short int *oid;
// uri
char *uri;
};
union anonymous$64
{
// actualNumber
signed long long int *actualNumber;
// approxNumber
signed long long int *approxNumber;
};
union anonymous$59
{
// integer
signed long long int *integer;
// internationalString
char *internationalString;
// octetString
struct odr_oct *octetString;
// objectIdentifier
signed short int *objectIdentifier;
// boolean
signed int *boolean;
// null
void *null;
// unit
struct Z_Unit *unit;
// valueAndUnit
struct Z_IntUnit *valueAndUnit;
};
union anonymous$74
{
// integer
signed long long int *integer;
// string
char *string;
// octets
struct odr_oct *octets;
// oid
signed short int *oid;
// unit
struct Z_Unit *unit;
// valueAndUnit
struct Z_IntUnit *valueAndUnit;
};
union anonymous$15
{
// known
signed long long int *known;
// zprivate
signed long long int *zprivate;
};
union anonymous$22
{
// known
signed long long int *known;
// zprivate
struct Z_ProxSupportPrivate *zprivate;
};
union anonymous$45
{
// number
signed long long int *number;
// string
char *string;
// opaque
struct odr_oct *opaque;
};
union anonymous$8
{
// numeric
signed long long int *numeric;
// complex
struct Z_ComplexAttribute *complex;
};
union anonymous$70
{
// primitive
signed long long int *primitive;
// structured
struct Z_ElementInfoList *structured;
};
union anonymous$2
{
// req
signed long long int *req;
// permission
signed long long int *permission;
// immediate
signed long long int *immediate;
};
union anonymous$52
{
// character
char *character;
// encrypted
struct Z_Encryption *encrypted;
};
union anonymous$4
{
// characterInfo
char *characterInfo;
// binaryInfo
struct odr_oct *binaryInfo;
// externallyDefinedInfo
struct Z_External *externallyDefinedInfo;
// oid
signed short int *oid;
};
union anonymous$67
{
// elementSetName
char *elementSetName;
// externalSpec
struct Z_External *externalSpec;
};
union anonymous$75
{
// ianaType
char *ianaType;
// z3950type
char *z3950type;
// otherType
char *otherType;
};
union anonymous$94
{
// package
char *package;
// query
struct Z_Query *query;
};
union anonymous$96
{
// packageName
char *packageName;
// exportPackage
struct Z_ESExportSpecification *exportPackage;
};
union anonymous$87
{
// packageName
char *packageName;
// packageSpec
struct Z_ESExportSpecification *packageSpec;
};
union anonymous$85
{
// phoneNumber
char *phoneNumber;
// faxNumber
char *faxNumber;
// x400address
char *x400address;
// emailAddress
char *emailAddress;
// pagerNumber
char *pagerNumber;
// ftpAddress
char *ftpAddress;
// ftamAddress
char *ftamAddress;
// printerAddress
char *printerAddress;
// other
struct Z_ESDestinationOther *other;
};
union anonymous$83
{
// sortField
char *sortField;
// elementSpec
struct Z_Specification *elementSpec;
// sortAttributes
struct Z_SortAttributes *sortAttributes;
};
union anonymous$55
{
// string
char *string;
// accept
signed int *accept;
// acknowledge
void *acknowledge;
// diagnostic
struct Z_DiagRec *diagnostic;
// encrypted
struct Z_Encryption *encrypted;
};
union anonymous$7
{
// string
char *string;
// numeric
signed long long int *numeric;
};
union anonymous$38
{
// timeStamp
char *timeStamp;
// versionNumber
char *versionNumber;
// previousVersion
struct Z_External *previousVersion;
};
union anonymous$40
{
// v2Addinfo
char *v2Addinfo;
// v3Addinfo
char *v3Addinfo;
};
union anonymous$19
{
// esRequest
struct Z_AdminEsRequest *esRequest;
// taskPackage
struct Z_AdminTaskPackage *taskPackage;
};
union anonymous$100
{
// attributesPlusTerm
struct Z_AttributesPlusTerm *attributesPlusTerm;
// resultSetId
char *resultSetId;
// resultAttr
struct Z_ResultSetPlusAttributes *resultAttr;
};
union anonymous$39
{
// challenge
struct Z_Challenge1 *challenge;
// response
struct Z_Response1 *response;
};
union anonymous$43
{
// challenge
struct Z_DRNType *challenge;
// response
struct Z_DRNType *response;
};
union anonymous$41
{
// monthAndDay
struct Z_DateMonthAndDay *monthAndDay;
// julianDay
signed long long int *julianDay;
// weekNumber
signed long long int *weekNumber;
// quarter
struct Z_DateQuarter *quarter;
// season
struct Z_DateSeason *season;
};
union anonymous$20
{
// defaultDiagRec
struct Z_DefaultDiagFormat *defaultDiagRec;
// explicitDiagnostic
struct Z_DiagFormat *explicitDiagnostic;
};
union anonymous$5
{
// defaultFormat
struct Z_DefaultDiagFormat *defaultFormat;
// externallyDefined
struct Z_External *externallyDefined;
};
union anonymous$86
{
// esRequest
struct Z_EIExportInvocationEsRequest *esRequest;
// taskPackage
struct Z_EIExportInvocationTaskPackage *taskPackage;
};
union anonymous$84
{
// esRequest
struct Z_ESExportSpecificationEsRequest *esRequest;
// taskPackage
struct Z_ESExportSpecificationTaskPackage *taskPackage;
};
union anonymous$26
{
// primitives
struct Z_ElementRequestCompositeElementPrimitives *primitives;
// specs
struct Z_ElementRequestCompositeElementSpecs *specs;
};
union anonymous$18
{
// databaseRecord
struct Z_External *databaseRecord;
// surrogateDiagnostic
struct Z_DiagRec *surrogateDiagnostic;
// startingFragment
struct Z_FragmentSyntax *startingFragment;
// intermediateFragment
struct Z_FragmentSyntax *intermediateFragment;
// finalFragment
struct Z_FragmentSyntax *finalFragment;
};
union anonymous$36
{
// externallyTagged
struct Z_External *externallyTagged;
// notExternallyTagged
struct odr_oct *notExternallyTagged;
};
union anonymous$34
{
// marcHoldingsRecord
struct Z_External *marcHoldingsRecord;
// holdingsAndCirc
struct Z_HoldingsAndCircData *holdingsAndCirc;
};
union anonymous$37
{
// record
struct Z_External *record;
// diagnostic
struct Z_DiagRec *diagnostic;
};
union anonymous$6
{
// record
struct Z_External *record;
// surrogateDiagnostics
struct Z_IUTaskPackageRecordStructureSurrogateDiagnostics *surrogateDiagnostics;
};
union anonymous$90
{
// esRequest
struct Z_IORequest *esRequest;
// taskPackage
struct Z_IOTaskPackage *taskPackage;
};
union anonymous$33
{
// esRequest
struct Z_IU0UpdateEsRequest *esRequest;
// taskPackage
struct Z_IU0UpdateTaskPackage *taskPackage;
};
union anonymous
{
// esRequest
struct Z_IUUpdateEsRequest *esRequest;
// taskPackage
struct Z_IUUpdateTaskPackage *taskPackage;
};
union anonymous$99
{
// unit
struct Z_IntUnit *unit;
// businessDaily
void *businessDaily;
// continuous
void *continuous;
// other
char *other;
};
union anonymous$69
{
// iso2022
struct Z_Iso2022 *iso2022;
// iso10646
struct Z_Iso10646 *iso10646;
// zprivate
struct Z_PrivateCharacterSet *zprivate;
};
union anonymous$72
{
// iso2022
struct Z_Iso2022 *iso2022;
// iso10646
struct Z_Iso10646 *iso10646;
// zprivate
struct Z_PrivateCharacterSet *zprivate;
// none
void *none;
};
union anonymous$81
{
// originProposal
struct Z_Iso2022OriginProposal *originProposal;
// targetResponse
struct Z_Iso2022TargetResponse *targetResponse;
};
union anonymous$44
{
// challenge
struct Z_KRBRequest *challenge;
// response
struct Z_KRBResponse *response;
};
union anonymous$57
{
// internetAddress
struct Z_NetworkAddressIA *internetAddress;
// osiPresentationAddress
struct Z_NetworkAddressOPA *osiPresentationAddress;
// other
struct Z_NetworkAddressOther *other;
};
union anonymous$27
{
// simple
struct Z_Operand *simple;
// complex
struct Z_Complex *complex;
};
union anonymous$63
{
// proposal
struct Z_OriginProposal *proposal;
// response
struct Z_TargetResponse *response;
};
union anonymous$95
{
// esRequest
struct Z_PQSPeriodicQueryScheduleEsRequest *esRequest;
// taskPackage
struct Z_PQSPeriodicQueryScheduleTaskPackage *taskPackage;
};
union anonymous$93
{
// esRequest
struct Z_PQueryPersistentQueryEsRequest *esRequest;
// taskPackage
struct Z_PQueryPersistentQueryTaskPackage *taskPackage;
};
union anonymous$0
{
// esRequest
struct Z_PRPersistentResultSetEsRequest *esRequest;
// taskPackage
struct Z_PRPersistentResultSetTaskPackage *taskPackage;
};
union anonymous$76
{
// zprivate
struct Z_PrivateCapabilities *zprivate;
// rpn
struct Z_RpnCapabilities *rpn;
// iso8777
struct Z_Iso8777Capabilities *iso8777;
// z39_58
struct Z_HumanString *z39_58;
// erpn
struct Z_RpnCapabilities *erpn;
// rankedList
struct Z_HumanString *rankedList;
};
union anonymous$77
{
// viaOid
struct Z_PrivateCharacterSetViaOid *viaOid;
// externallySpecified
struct Z_External *externallySpecified;
// previouslyAgreedUpon
void *previouslyAgreedUpon;
};
union anonymous$50
{
// enumeratedPrompt
struct Z_PromptIdEnumeratedPrompt *enumeratedPrompt;
// nonEnumeratedPrompt
char *nonEnumeratedPrompt;
};
union anonymous$98
{
// actualQuery
struct Z_Query *actualQuery;
// packageName
char *packageName;
};
union anonymous$79
{
// term
struct Z_QueryExpressionTerm *term;
// query
struct Z_Query *query;
};
union anonymous$17
{
// records
struct Z_Segment *records;
// recordsWillFollow
void *recordsWillFollow;
};
union anonymous$29
{
// simpleElement
struct Z_SimpleElement *simpleElement;
// compositeElement
struct Z_ElementRequestCompositeElement *compositeElement;
};
union anonymous$24
{
// generic
struct Z_SortKey *generic;
// databaseSpecific
struct Z_SortDbSpecificList *databaseSpecific;
};
union anonymous$32
{
// specificTag
struct Z_SpecificTag *specificTag;
// wildThing
struct Z_Occurrences *wildThing;
// wildPath
void *wildPath;
};
union anonymous$51
{
// targetInfo
struct Z_TargetInfo *targetInfo;
// databaseInfo
struct Z_DatabaseInfo *databaseInfo;
// schemaInfo
struct Z_SchemaInfo *schemaInfo;
// tagSetInfo
struct Z_TagSetInfo *tagSetInfo;
// recordSyntaxInfo
struct Z_RecordSyntaxInfo *recordSyntaxInfo;
// attributeSetInfo
struct Z_AttributeSetInfo *attributeSetInfo;
// termListInfo
struct Z_TermListInfo *termListInfo;
// extendedServicesInfo
struct Z_ExtendedServicesInfo *extendedServicesInfo;
// attributeDetails
struct Z_AttributeDetails *attributeDetails;
// termListDetails
struct Z_TermListDetails *termListDetails;
// elementSetDetails
struct Z_ElementSetDetails *elementSetDetails;
// retrievalRecordDetails
struct Z_RetrievalRecordDetails *retrievalRecordDetails;
// sortDetails
struct Z_SortDetails *sortDetails;
// processing
struct Z_ProcessingInformation *processing;
// variants
struct Z_VariantSetInfo *variants;
// units
struct Z_UnitInfo *units;
// categoryList
struct Z_CategoryList *categoryList;
};
union anonymous$14
{
// tooMany
struct Z_TooMany *tooMany;
// badSpec
struct Z_BadSpec *badSpec;
// dbUnavail
struct Z_DbUnavail *dbUnavail;
// unSupOp
signed long long int *unSupOp;
// attribute
struct Z_Attribute *attribute;
// attCombo
struct Z_AttCombo *attCombo;
// term
struct Z_DiagTerm *term;
// proximity
struct Z_Proximity *proximity;
// scan
struct Z_Scan *scan;
// sort
struct Z_Sort *sort;
// segmentation
struct Z_Segmentation *segmentation;
// extServices
struct Z_ExtServices *extServices;
// accessCtrl
struct Z_AccessCtrl *accessCtrl;
// recordSyntax
struct Z_RecordSyntax *recordSyntax;
};
union anonymous$30
{
// databaseHits
struct Z_UniverseReportHits *databaseHits;
// duplicate
struct Z_UniverseReportDuplicate *duplicate;
};
union anonymous$73
{
// range
struct Z_ValueRange *range;
// enumerated
struct Z_ValueSetEnumerated *enumerated;
};
union anonymous$1
{
// general
struct odr_oct *general;
// numeric
signed long long int *numeric;
// characterString
char *characterString;
// oid
signed short int *oid;
// dateTime
char *dateTime;
// external
struct Z_External *external;
// integerAndUnit
struct Z_IntUnit *integerAndUnit;
// null
void *null;
};
union anonymous$28
{
// octets
struct odr_oct *octets;
// numeric
signed long long int *numeric;
// date
char *date;
// ext
struct Z_External *ext;
// string
char *string;
// trueOrFalse
signed int *trueOrFalse;
// oid
signed short int *oid;
// intUnit
struct Z_IntUnit *intUnit;
// elementNotThere
void *elementNotThere;
// elementEmpty
void *elementEmpty;
// noDataRequested
void *noDataRequested;
// diagnostic
struct Z_External *diagnostic;
// subtree
struct Z_GenericRecord *subtree;
};
union anonymous$3
{
// single_ASN1_type
struct odr_oct *single_ASN1_type;
// octet_aligned
struct odr_oct *octet_aligned;
// arbitrary
struct odr_bitmask *arbitrary;
// sutrs
struct odr_oct *sutrs;
// explainRecord
struct Z_ExplainRecord *explainRecord;
// resourceReport1
struct Z_ResourceReport1 *resourceReport1;
// resourceReport2
struct Z_ResourceReport2 *resourceReport2;
// promptObject1
struct Z_PromptObject1 *promptObject1;
// grs1
struct Z_GenericRecord *grs1;
// extendedService
struct Z_TaskPackage *extendedService;
// itemOrder
struct Z_IOItemOrder *itemOrder;
// diag1
struct Z_DiagnosticFormat *diag1;
// espec1
struct Z_Espec1 *espec1;
// summary
struct Z_BriefBib *summary;
// opac
struct Z_OPACRecord *opac;
// searchResult1
struct Z_SearchInfoReport *searchResult1;
// update
struct Z_IUUpdate *update;
// dateTime
struct Z_DateTime *dateTime;
// universeReport
struct Z_UniverseReport *universeReport;
// adminService
struct Z_Admin *adminService;
// update0
struct Z_IU0Update *update0;
// userInfo1
struct Z_OtherInformation *userInfo1;
// charNeg3
struct Z_CharSetandLanguageNegotiation *charNeg3;
// acfPrompt1
struct Z_PromptObject1 *acfPrompt1;
// acfDes1
struct Z_DES_RN_Object *acfDes1;
// acfKrb1
struct Z_KRBObject *acfKrb1;
// multipleSearchTerms_2
struct Z_MultipleSearchTerms_2 *multipleSearchTerms_2;
// cql
char *cql;
// oclc
struct Z_OCLC_UserInformation *oclc;
// persistentResultSet
struct Z_PRPersistentResultSet *persistentResultSet;
// persistentQuery
struct Z_PQueryPersistentQuery *persistentQuery;
// periodicQuerySchedule
struct Z_PQSPeriodicQuerySchedule *periodicQuerySchedule;
// exportSpecification
struct Z_ESExportSpecification *exportSpecification;
// exportInvocation
struct Z_EIExportInvocation *exportInvocation;
// facetList
struct Z_FacetList *facetList;
};
union anonymous$88
{
// all
void *all;
// ranges
struct Z_EIOriginPartNotToKeepRanges *ranges;
};
union anonymous$80
{
// all
void *all;
// list
struct Z_ResultsByDB_sList *list;
};
union anonymous$31
{
// all
void *all;
// last
void *last;
// values
struct Z_OccurValues *values;
};
union anonymous$9
{
// any_or_none
void *any_or_none;
// specific
struct Z_AttributeValueList *specific;
};
union anonymous$91
{
// billInvoice
void *billInvoice;
// prepay
void *prepay;
// depositAccount
void *depositAccount;
// creditCard
struct Z_IOCreditCardInfo *creditCard;
// cardInfoPreviouslySupplied
void *cardInfoPreviouslySupplied;
// privateKnown
void *privateKnown;
// privateNotKnown
struct Z_External *privateNotKnown;
};
union anonymous$71
{
// character
void *character;
// numeric
void *numeric;
// structured
struct Z_HumanString *structured;
};
union anonymous$61
{
// decade
void *decade;
// century
void *century;
// millennium
void *millennium;
};
union anonymous$58
{
// first
void *first;
// second
void *second;
// third
void *third;
// fourth
void *fourth;
};
union anonymous$42
{
// local
void *local;
// utc
void *utc;
// utcOffset
signed long long int *utcOffset;
};
union anonymous$11
{
// noUser
void *noUser;
// refused
void *refused;
// simple
void *simple;
// oid
struct Z_OidList *oid;
// alternative
struct Z_AltOidList *alternative;
// pwdInv
void *pwdInv;
// pwdExp
void *pwdExp;
};
union anonymous$23
{
// nonZeroStepSize
void *nonZeroStepSize;
// specifiedStepSize
void *specifiedStepSize;
// termList1
void *termList1;
// termList2
struct Z_AttrListList *termList2;
// posInResponse
signed long long int *posInResponse;
// resources
void *resources;
// endOfList
void *endOfList;
};
union anonymous$12
{
// op_and
void *op_and;
// op_or
void *op_or;
// and_not
void *and_not;
// prox
struct Z_ProximityOperator *prox;
};
union anonymous$16
{
// reIndex
void *reIndex;
// truncate
void *truncate;
// drop
void *drop;
// create
void *create;
// import
struct Z_ImportParameters *import;
// refresh
void *refresh;
// commit
void *commit;
// shutdown
void *shutdown;
// start
void *start;
};
union anonymous$21
{
// resultSets
void *resultSets;
// badSet
char *badSet;
// relation
signed long long int *relation;
// unit
signed long long int *unit;
// distance
signed long long int *distance;
// attributes
struct Z_AttributeList *attributes;
// ordered
void *ordered;
// exclusion
void *exclusion;
};
union anonymous$101
{
// segmentCount
void *segmentCount;
// segmentSize
signed long long int *segmentSize;
};
union anonymous$25
{
// sequence
void *sequence;
// noRsName
void *noRsName;
// tooMany
signed long long int *tooMany;
// incompatible
void *incompatible;
// generic
void *generic;
// dbSpecific
void *dbSpecific;
// sortElement
struct Z_SortElement *sortElement;
// key
signed long long int *key;
// action
void *action;
// illegal
signed long long int *illegal;
// inputTooLarge
struct Z_StringList *inputTooLarge;
// aggregateTooLarge
void *aggregateTooLarge;
};
union anonymous$78
{
// sevenBit
void *sevenBit;
// eightBit
void *eightBit;
};
union anonymous$82
{
// type_0
void *type_0;
// type_1
struct Z_RPNQuery *type_1;
// type_2
struct odr_oct *type_2;
// type_100
struct odr_oct *type_100;
// type_101
struct Z_RPNQuery *type_101;
// type_102
struct odr_oct *type_102;
// type_104
struct Z_External *type_104;
};
union anonymous$60
{
// winter
void *winter;
// spring
void *spring;
// summer
void *summer;
// autumn
void *autumn;
};
union anonymous$53
{
// __size
char __size[4l];
// __align
signed int __align;
};
union anonymous$66
{
// relation
struct anonymous$65 relation;
// boolean
struct anonymous$68 boolean;
};
union anonymous$97
{
// sort
struct anonymous$46 sort;
};
struct Z_AccessCtrl
{
// which
signed int which;
// u
union anonymous$11 u;
};
struct Z_AccessInfo
{
// num_queryTypesSupported
signed int num_queryTypesSupported;
// queryTypesSupported
struct Z_QueryTypeDetails **queryTypesSupported;
// num_diagnosticsSets
signed int num_diagnosticsSets;
// diagnosticsSets
signed short int **diagnosticsSets;
// num_attributeSetIds
signed int num_attributeSetIds;
// attributeSetIds
signed short int **attributeSetIds;
// num_schemas
signed int num_schemas;
// schemas
signed short int **schemas;
// num_recordSyntaxes
signed int num_recordSyntaxes;
// recordSyntaxes
signed short int **recordSyntaxes;
// num_resourceChallenges
signed int num_resourceChallenges;
// resourceChallenges
signed short int **resourceChallenges;
// restrictedAccess
struct Z_AccessRestrictions *restrictedAccess;
// costInfo
struct Z_Costs *costInfo;
// num_variantSets
signed int num_variantSets;
// variantSets
signed short int **variantSets;
// num_elementSetNames
signed int num_elementSetNames;
// elementSetNames
char **elementSetNames;
// num_unitSystems
signed int num_unitSystems;
// unitSystems
char **unitSystems;
};
struct Z_AccessRestrictions
{
// num
signed int num;
// elements
struct Z_AccessRestrictionsUnit **elements;
};
struct Z_AccessRestrictionsUnit
{
// accessType
signed long long int *accessType;
// accessText
struct Z_HumanString *accessText;
// num_accessChallenges
signed int num_accessChallenges;
// accessChallenges
signed short int **accessChallenges;
};
struct Z_Admin
{
// which
signed int which;
// u
union anonymous$19 u;
};
struct Z_AdminEsRequest
{
// toKeep
struct Z_ESAdminOriginPartToKeep *toKeep;
// notToKeep
struct Z_ESAdminOriginPartNotToKeep *notToKeep;
};
struct Z_AdminTaskPackage
{
// originPart
struct Z_ESAdminOriginPartToKeep *originPart;
// targetPart
struct Z_ESAdminTargetPart *targetPart;
};
struct Z_AltOidList
{
// num
signed int num;
// elements
signed short int **elements;
};
struct Z_AttCombo
{
// unsupportedCombination
struct Z_AttributeList *unsupportedCombination;
// num_recommendedAlternatives
signed int num_recommendedAlternatives;
// recommendedAlternatives
struct Z_AttributeList **recommendedAlternatives;
};
struct Z_AttrListList
{
// num
signed int num;
// elements
struct Z_AttributeList **elements;
};
struct Z_Attribute
{
// id
signed short int *id;
// type
signed long long int *type;
// value
signed long long int *value;
// term
struct Z_Term *term;
};
struct Z_AttributeCombination
{
// num_occurrences
signed int num_occurrences;
// occurrences
struct Z_AttributeOccurrence **occurrences;
};
struct Z_AttributeCombinations
{
// defaultAttributeSet
signed short int *defaultAttributeSet;
// num_legalCombinations
signed int num_legalCombinations;
// legalCombinations
struct Z_AttributeCombination **legalCombinations;
};
struct Z_AttributeDescription
{
// name
char *name;
// description
struct Z_HumanString *description;
// attributeValue
struct Z_StringOrNumeric *attributeValue;
// num_equivalentAttributes
signed int num_equivalentAttributes;
// equivalentAttributes
struct Z_StringOrNumeric **equivalentAttributes;
};
struct Z_AttributeDetails
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// databaseName
char *databaseName;
// num_attributesBySet
signed int num_attributesBySet;
// attributesBySet
struct Z_AttributeSetDetails **attributesBySet;
// attributeCombinations
struct Z_AttributeCombinations *attributeCombinations;
};
struct Z_AttributeElement
{
// attributeSet
signed short int *attributeSet;
// attributeType
signed long long int *attributeType;
// which
signed int which;
// value
union anonymous$8 value;
};
struct Z_AttributeList
{
// num_attributes
signed int num_attributes;
// attributes
struct Z_AttributeElement **attributes;
};
struct Z_AttributeOccurrence
{
// attributeSet
signed short int *attributeSet;
// attributeType
signed long long int *attributeType;
// mustBeSupplied
void *mustBeSupplied;
// which
signed int which;
// attributeValues
union anonymous$9 attributeValues;
};
struct Z_AttributeSetDetails
{
// attributeSet
signed short int *attributeSet;
// num_attributesByType
signed int num_attributesByType;
// attributesByType
struct Z_AttributeTypeDetails **attributesByType;
};
struct Z_AttributeSetInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// attributeSet
signed short int *attributeSet;
// name
char *name;
// num_attributes
signed int num_attributes;
// attributes
struct Z_AttributeType **attributes;
// description
struct Z_HumanString *description;
};
struct Z_AttributeType
{
// name
char *name;
// description
struct Z_HumanString *description;
// attributeType
signed long long int *attributeType;
// num_attributeValues
signed int num_attributeValues;
// attributeValues
struct Z_AttributeDescription **attributeValues;
};
struct Z_AttributeTypeDetails
{
// attributeType
signed long long int *attributeType;
// defaultIfOmitted
struct Z_OmittedAttributeInterpretation *defaultIfOmitted;
// num_attributeValues
signed int num_attributeValues;
// attributeValues
struct Z_AttributeValue **attributeValues;
};
struct Z_AttributeValue
{
// value
struct Z_StringOrNumeric *value;
// description
struct Z_HumanString *description;
// num_subAttributes
signed int num_subAttributes;
// subAttributes
struct Z_StringOrNumeric **subAttributes;
// num_superAttributes
signed int num_superAttributes;
// superAttributes
struct Z_StringOrNumeric **superAttributes;
// partialSupport
void *partialSupport;
};
struct Z_AttributeValueList
{
// num_attributes
signed int num_attributes;
// attributes
struct Z_StringOrNumeric **attributes;
};
struct Z_AttributesPlusTerm
{
// attributes
struct Z_AttributeList *attributes;
// term
struct Z_Term *term;
};
struct Z_BadSpec
{
// spec
struct Z_Specification *spec;
// db
char *db;
// num_goodOnes
signed int num_goodOnes;
// goodOnes
struct Z_Specification **goodOnes;
};
struct Z_BriefBib
{
// title
char *title;
// author
char *author;
// callNumber
char *callNumber;
// recordType
char *recordType;
// bibliographicLevel
char *bibliographicLevel;
// num_format
signed int num_format;
// format
struct Z_FormatSpec **format;
// publicationPlace
char *publicationPlace;
// publicationDate
char *publicationDate;
// targetSystemKey
char *targetSystemKey;
// satisfyingElement
char *satisfyingElement;
// rank
signed long long int *rank;
// documentId
char *documentId;
// abstract
char *abstract;
// otherInfo
struct Z_OtherInformation *otherInfo;
};
struct Z_CategoryInfo
{
// category
char *category;
// originalCategory
char *originalCategory;
// description
struct Z_HumanString *description;
// asn1Module
char *asn1Module;
};
struct Z_CategoryList
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// num_categories
signed int num_categories;
// categories
struct Z_CategoryInfo **categories;
};
struct Z_Challenge1
{
// num
signed int num;
// elements
struct Z_ChallengeUnit1 **elements;
};
struct Z_ChallengeUnit1
{
// promptId
struct Z_PromptId *promptId;
// defaultResponse
char *defaultResponse;
// which
signed int which;
// u
union anonymous$52 u;
// regExpr
char *regExpr;
// responseRequired
void *responseRequired;
// num_allowedValues
signed int num_allowedValues;
// allowedValues
char **allowedValues;
// shouldSave
void *shouldSave;
// dataType
signed long long int *dataType;
// diagnostic
struct Z_External *diagnostic;
};
struct Z_CharSetandLanguageNegotiation
{
// which
signed int which;
// u
union anonymous$63 u;
};
struct Z_Charge
{
// cost
struct Z_IntUnit *cost;
// perWhat
struct Z_Unit *perWhat;
// text
struct Z_HumanString *text;
};
struct Z_CircRecord
{
// availableNow
signed int *availableNow;
// availablityDate
char *availablityDate;
// availableThru
char *availableThru;
// restrictions
char *restrictions;
// itemId
char *itemId;
// renewable
signed int *renewable;
// onHold
signed int *onHold;
// enumAndChron
char *enumAndChron;
// midspine
char *midspine;
// temporaryLocation
char *temporaryLocation;
};
struct Z_CommonInfo
{
// dateAdded
char *dateAdded;
// dateChanged
char *dateChanged;
// expiry
char *expiry;
// humanStringLanguage
char *humanStringLanguage;
// otherInfo
struct Z_OtherInformation *otherInfo;
};
struct Z_CompSpec
{
// selectAlternativeSyntax
signed int *selectAlternativeSyntax;
// generic
struct Z_Specification *generic;
// num_dbSpecific
signed int num_dbSpecific;
// dbSpecific
struct Z_DbSpecific **dbSpecific;
// num_recordSyntax
signed int num_recordSyntax;
// recordSyntax
signed short int **recordSyntax;
};
struct Z_Complex
{
// s1
struct Z_RPNStructure *s1;
// s2
struct Z_RPNStructure *s2;
// roperator
struct Z_Operator *roperator;
};
struct Z_ComplexAttribute
{
// num_list
signed int num_list;
// list
struct Z_StringOrNumeric **list;
// num_semanticAction
signed int num_semanticAction;
// semanticAction
signed long long int **semanticAction;
};
struct Z_ContactInfo
{
// name
char *name;
// description
struct Z_HumanString *description;
// address
struct Z_HumanString *address;
// email
char *email;
// phone
char *phone;
};
struct Z_Costs
{
// connectCharge
struct Z_Charge *connectCharge;
// connectTime
struct Z_Charge *connectTime;
// displayCharge
struct Z_Charge *displayCharge;
// searchCharge
struct Z_Charge *searchCharge;
// subscriptCharge
struct Z_Charge *subscriptCharge;
// num_otherCharges
signed int num_otherCharges;
// otherCharges
struct Z_CostsOtherCharge **otherCharges;
};
struct Z_CostsOtherCharge
{
// forWhat
struct Z_HumanString *forWhat;
// charge
struct Z_Charge *charge;
};
struct Z_DES_RN_Object
{
// which
signed int which;
// u
union anonymous$43 u;
};
struct Z_DRNType
{
// userId
struct odr_oct *userId;
// salt
struct odr_oct *salt;
// randomNumber
struct odr_oct *randomNumber;
};
struct Z_DatabaseInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// name
char *name;
// explainDatabase
void *explainDatabase;
// num_nicknames
signed int num_nicknames;
// nicknames
char **nicknames;
// icon
struct Z_IconObject *icon;
// userFee
signed int *userFee;
// available
signed int *available;
// titleString
struct Z_HumanString *titleString;
// num_keywords
signed int num_keywords;
// keywords
struct Z_HumanString **keywords;
// description
struct Z_HumanString *description;
// associatedDbs
struct Z_DatabaseList *associatedDbs;
// subDbs
struct Z_DatabaseList *subDbs;
// disclaimers
struct Z_HumanString *disclaimers;
// news
struct Z_HumanString *news;
// which
signed int which;
// u
union anonymous$64 u;
// defaultOrder
struct Z_HumanString *defaultOrder;
// avRecordSize
signed long long int *avRecordSize;
// maxRecordSize
signed long long int *maxRecordSize;
// hours
struct Z_HumanString *hours;
// bestTime
struct Z_HumanString *bestTime;
// lastUpdate
char *lastUpdate;
// updateInterval
struct Z_IntUnit *updateInterval;
// coverage
struct Z_HumanString *coverage;
// proprietary
signed int *proprietary;
// copyrightText
struct Z_HumanString *copyrightText;
// copyrightNotice
struct Z_HumanString *copyrightNotice;
// producerContactInfo
struct Z_ContactInfo *producerContactInfo;
// supplierContactInfo
struct Z_ContactInfo *supplierContactInfo;
// submissionContactInfo
struct Z_ContactInfo *submissionContactInfo;
// accessInfo
struct Z_AccessInfo *accessInfo;
};
struct Z_DatabaseList
{
// num_databases
signed int num_databases;
// databases
char **databases;
};
struct Z_Date
{
// year
signed long long int *year;
// which
signed int which;
// u
union anonymous$41 u;
// flags
struct Z_DateFlags *flags;
};
struct Z_DateFlags
{
// circa
void *circa;
// era
struct Z_Era *era;
};
struct Z_DateMonthAndDay
{
// month
signed long long int *month;
// day
signed long long int *day;
};
struct Z_DateQuarter
{
// which
signed int which;
// u
union anonymous$58 u;
};
struct Z_DateSeason
{
// which
signed int which;
// u
union anonymous$60 u;
};
struct Z_DateTime
{
// date
struct Z_Date *date;
// time
struct Z_Time *time;
};
struct Z_DbSpecific
{
// db
char *db;
// spec
struct Z_Specification *spec;
};
struct Z_DbUnavail
{
// db
char *db;
// why
struct Z_DbUnavail_0 *why;
};
struct Z_DbUnavail_0
{
// reasonCode
signed long long int *reasonCode;
// message
char *message;
};
struct Z_DefaultDiagFormat
{
// diagnosticSetId
signed short int *diagnosticSetId;
// condition
signed long long int *condition;
// which
signed int which;
// u
union anonymous$40 u;
};
struct Z_DiagFormat
{
// which
signed int which;
// u
union anonymous$14 u;
};
struct Z_DiagRec
{
// which
signed int which;
// u
union anonymous$5 u;
};
struct Z_DiagTerm
{
// problem
signed long long int *problem;
// term
struct Z_Term *term;
};
struct Z_DiagnosticFormat
{
// num
signed int num;
// elements
struct Z_DiagnosticFormat_s **elements;
};
struct Z_DiagnosticFormat_s
{
// which
signed int which;
// u
union anonymous$20 u;
// message
char *message;
};
struct Z_EIExportInvocation
{
// which
signed int which;
// u
union anonymous$86 u;
};
struct Z_EIExportInvocationEsRequest
{
// toKeep
struct Z_EIOriginPartToKeep *toKeep;
// notToKeep
struct Z_EIOriginPartNotToKeep *notToKeep;
};
struct Z_EIExportInvocationTaskPackage
{
// originPart
struct Z_EIOriginPartToKeep *originPart;
// targetPart
struct Z_EITargetPart *targetPart;
};
struct Z_EIOriginPartNotToKeep
{
// resultSetId
char *resultSetId;
// which
signed int which;
// u
union anonymous$88 u;
};
struct Z_EIOriginPartNotToKeepRanges
{
// num
signed int num;
// elements
struct Z_EIOriginPartNotToKeepRanges_s **elements;
};
struct Z_EIOriginPartNotToKeepRanges_s
{
// start
signed long long int *start;
// count
signed long long int *count;
};
struct Z_EIOriginPartToKeep
{
// which
signed int which;
// u
union anonymous$87 u;
// numberOfCopies
signed long long int *numberOfCopies;
};
struct Z_EITargetPart
{
// estimatedQuantity
struct Z_IntUnit *estimatedQuantity;
// quantitySoFar
struct Z_IntUnit *quantitySoFar;
// estimatedCost
struct Z_IntUnit *estimatedCost;
// costSoFar
struct Z_IntUnit *costSoFar;
};
struct Z_ESAdminOriginPartNotToKeep
{
// which
signed int which;
// u
union anonymous$17 u;
};
struct Z_ESAdminOriginPartToKeep
{
// which
signed int which;
// u
union anonymous$16 u;
// databaseName
char *databaseName;
};
struct Z_ESAdminTargetPart
{
// updateStatus
signed long long int *updateStatus;
// num_globalDiagnostics
signed int num_globalDiagnostics;
// globalDiagnostics
struct Z_DiagRec **globalDiagnostics;
};
struct Z_ESDestination
{
// which
signed int which;
// u
union anonymous$85 u;
};
struct Z_ESDestinationOther
{
// vehicle
char *vehicle;
// destination
char *destination;
};
struct Z_ESExportSpecification
{
// which
signed int which;
// u
union anonymous$84 u;
};
struct Z_ESExportSpecificationEsRequest
{
// toKeep
struct Z_ESOriginPartToKeep *toKeep;
// notToKeep
void *notToKeep;
};
struct Z_ESExportSpecificationTaskPackage
{
// originPart
struct Z_ESOriginPartToKeep *originPart;
// targetPart
void *targetPart;
};
struct Z_ESOriginPartToKeep
{
// composition
struct Z_CompSpec *composition;
// exportDestination
struct Z_ESDestination *exportDestination;
};
struct Z_EScanInfo
{
// maxStepSize
signed long long int *maxStepSize;
// collatingSequence
struct Z_HumanString *collatingSequence;
// increasing
signed int *increasing;
};
struct Z_ETagPath
{
// num_tags
signed int num_tags;
// tags
struct Z_ETagUnit **tags;
};
struct Z_ETagUnit
{
// which
signed int which;
// u
union anonymous$32 u;
};
struct Z_ElementData
{
// which
signed int which;
// u
union anonymous$28 u;
};
struct Z_ElementDataType
{
// which
signed int which;
// u
union anonymous$70 u;
};
struct Z_ElementInfo
{
// elementName
char *elementName;
// elementTagPath
struct Z_Path *elementTagPath;
// dataType
struct Z_ElementDataType *dataType;
// required
signed int *required;
// repeatable
signed int *repeatable;
// description
struct Z_HumanString *description;
};
struct Z_ElementInfoList
{
// num
signed int num;
// elements
struct Z_ElementInfo **elements;
};
struct Z_ElementMetaData
{
// seriesOrder
struct Z_Order *seriesOrder;
// usageRight
struct Z_Usage *usageRight;
// num_hits
signed int num_hits;
// hits
struct Z_HitVector **hits;
// displayName
char *displayName;
// num_supportedVariants
signed int num_supportedVariants;
// supportedVariants
struct Z_Variant **supportedVariants;
// message
char *message;
// elementDescriptor
struct odr_oct *elementDescriptor;
// surrogateFor
struct Z_TagPath *surrogateFor;
// surrogateElement
struct Z_TagPath *surrogateElement;
// other
struct Z_External *other;
};
struct Z_ElementRequest
{
// which
signed int which;
// u
union anonymous$29 u;
};
struct Z_ElementRequestCompositeElement
{
// which
signed int which;
// u
union anonymous$26 u;
// deliveryTag
struct Z_ETagPath *deliveryTag;
// variantRequest
struct Z_Variant *variantRequest;
};
struct Z_ElementRequestCompositeElementPrimitives
{
// num
signed int num;
// elements
char **elements;
};
struct Z_ElementRequestCompositeElementSpecs
{
// num
signed int num;
// elements
struct Z_SimpleElement **elements;
};
struct Z_ElementSetDetails
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// databaseName
char *databaseName;
// elementSetName
char *elementSetName;
// recordSyntax
signed short int *recordSyntax;
// schema
signed short int *schema;
// description
struct Z_HumanString *description;
// num_detailsPerElement
signed int num_detailsPerElement;
// detailsPerElement
struct Z_PerElementDetails **detailsPerElement;
};
struct Z_ElementSpec
{
// which
signed int which;
// u
union anonymous$67 u;
};
struct Z_Encryption
{
// cryptType
struct odr_oct *cryptType;
// credential
struct odr_oct *credential;
// data
struct odr_oct *data;
};
struct Z_Environment
{
// which
signed int which;
// u
union anonymous$78 u;
};
struct Z_Era
{
// which
signed int which;
// u
union anonymous$61 u;
};
struct Z_Espec1
{
// num_elementSetNames
signed int num_elementSetNames;
// elementSetNames
char **elementSetNames;
// defaultVariantSetId
signed short int *defaultVariantSetId;
// defaultVariantRequest
struct Z_Variant *defaultVariantRequest;
// defaultTagType
signed long long int *defaultTagType;
// num_elements
signed int num_elements;
// elements
struct Z_ElementRequest **elements;
};
struct Z_Estimate1
{
// type
signed long long int *type;
// value
signed long long int *value;
// currency_code
signed long long int *currency_code;
};
struct Z_Estimate2
{
// type
struct Z_StringOrNumeric *type;
// value
struct Z_IntUnit *value;
};
struct Z_ExplainRecord
{
// which
signed int which;
// u
union anonymous$51 u;
};
struct Z_ExtServices
{
// which
signed int which;
// u
union anonymous$2 u;
};
struct Z_ExtendedServicesInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// type
signed short int *type;
// name
char *name;
// privateType
signed int *privateType;
// restrictionsApply
signed int *restrictionsApply;
// feeApply
signed int *feeApply;
// available
signed int *available;
// retentionSupported
signed int *retentionSupported;
// waitAction
signed long long int *waitAction;
// description
struct Z_HumanString *description;
// specificExplain
struct Z_External *specificExplain;
// esASN
char *esASN;
};
struct Z_External
{
// direct_reference
signed short int *direct_reference;
// indirect_reference
signed long long int *indirect_reference;
// descriptor
char *descriptor;
// which
signed int which;
// u
union anonymous$3 u;
};
struct Z_FacetField
{
// attributes
struct Z_AttributeList *attributes;
// num_terms
signed int num_terms;
// terms
struct Z_FacetTerm **terms;
};
struct Z_FacetList
{
// num
signed int num;
// elements
struct Z_FacetField **elements;
};
struct Z_FacetTerm
{
// term
struct Z_Term *term;
// count
signed long long int *count;
};
struct Z_FormatSpec
{
// type
char *type;
// size
signed long long int *size;
// bestPosn
signed long long int *bestPosn;
};
struct Z_FragmentSyntax
{
// which
signed int which;
// u
union anonymous$36 u;
};
struct Z_GenericRecord
{
// num_elements
signed int num_elements;
// elements
struct Z_TaggedElement **elements;
};
struct Z_HitVector
{
// satisfier
struct Z_Term *satisfier;
// offsetIntoElement
struct Z_IntUnit *offsetIntoElement;
// length
struct Z_IntUnit *length;
// hitRank
signed long long int *hitRank;
// targetToken
struct odr_oct *targetToken;
};
struct Z_HoldingsAndCircData
{
// typeOfRecord
char *typeOfRecord;
// encodingLevel
char *encodingLevel;
// format
char *format;
// receiptAcqStatus
char *receiptAcqStatus;
// generalRetention
char *generalRetention;
// completeness
char *completeness;
// dateOfReport
char *dateOfReport;
// nucCode
char *nucCode;
// localLocation
char *localLocation;
// shelvingLocation
char *shelvingLocation;
// callNumber
char *callNumber;
// shelvingData
char *shelvingData;
// copyNumber
char *copyNumber;
// publicNote
char *publicNote;
// reproductionNote
char *reproductionNote;
// termsUseRepro
char *termsUseRepro;
// enumAndChron
char *enumAndChron;
// num_volumes
signed int num_volumes;
// volumes
struct Z_Volume **volumes;
// num_circulationData
signed int num_circulationData;
// circulationData
struct Z_CircRecord **circulationData;
};
struct Z_HoldingsRecord
{
// which
signed int which;
// u
union anonymous$34 u;
};
struct Z_HumanString
{
// num_strings
signed int num_strings;
// strings
struct Z_HumanStringUnit **strings;
};
struct Z_HumanStringUnit
{
// language
char *language;
// text
char *text;
};
struct Z_IOBilling
{
// which
signed int which;
// u
union anonymous$91 u;
// customerReference
char *customerReference;
// customerPONumber
char *customerPONumber;
};
struct Z_IOContact
{
// name
char *name;
// phone
char *phone;
// email
char *email;
};
struct Z_IOCreditCardInfo
{
// nameOnCard
char *nameOnCard;
// expirationDate
char *expirationDate;
// cardNumber
char *cardNumber;
};
struct Z_IOItemOrder
{
// which
signed int which;
// u
union anonymous$90 u;
};
struct Z_IOOriginPartNotToKeep
{
// resultSetItem
struct Z_IOResultSetItem *resultSetItem;
// itemRequest
struct Z_External *itemRequest;
};
struct Z_IOOriginPartToKeep
{
// supplDescription
struct Z_External *supplDescription;
// contact
struct Z_IOContact *contact;
// addlBilling
struct Z_IOBilling *addlBilling;
};
struct Z_IORequest
{
// toKeep
struct Z_IOOriginPartToKeep *toKeep;
// notToKeep
struct Z_IOOriginPartNotToKeep *notToKeep;
};
struct Z_IOResultSetItem
{
// resultSetId
char *resultSetId;
// item
signed long long int *item;
};
struct Z_IOTargetPart
{
// itemRequest
struct Z_External *itemRequest;
// statusOrErrorReport
struct Z_External *statusOrErrorReport;
// auxiliaryStatus
signed long long int *auxiliaryStatus;
};
struct Z_IOTaskPackage
{
// originPart
struct Z_IOOriginPartToKeep *originPart;
// targetPart
struct Z_IOTargetPart *targetPart;
};
struct Z_IU0CorrelationInfo
{
// note
char *note;
// id
signed long long int *id;
};
struct Z_IU0OriginPartToKeep
{
// action
signed long long int *action;
// databaseName
char *databaseName;
// schema
signed short int *schema;
// elementSetName
char *elementSetName;
};
struct Z_IU0SuppliedRecords
{
// num
signed int num;
// elements
struct Z_IU0SuppliedRecords_elem **elements;
};
struct Z_IU0SuppliedRecordsId
{
// which
signed int which;
// u
union anonymous$38 u;
};
struct Z_IU0SuppliedRecords_elem
{
// which
signed int which;
// u
union anonymous$45 u;
// supplementalId
struct Z_IU0SuppliedRecordsId *supplementalId;
// correlationInfo
struct Z_IU0CorrelationInfo *correlationInfo;
// record
struct Z_External *record;
};
struct Z_IU0TargetPart
{
// updateStatus
signed long long int *updateStatus;
// num_globalDiagnostics
signed int num_globalDiagnostics;
// globalDiagnostics
struct Z_DiagRec **globalDiagnostics;
// num_taskPackageRecords
signed int num_taskPackageRecords;
// taskPackageRecords
struct Z_IU0TaskPackageRecordStructure **taskPackageRecords;
};
struct Z_IU0TaskPackageRecordStructure
{
// which
signed int which;
// u
union anonymous$37 u;
// correlationInfo
struct Z_IU0CorrelationInfo *correlationInfo;
// recordStatus
signed long long int *recordStatus;
};
struct Z_IU0Update
{
// which
signed int which;
// u
union anonymous$33 u;
};
struct Z_IU0UpdateEsRequest
{
// toKeep
struct Z_IU0OriginPartToKeep *toKeep;
// notToKeep
struct Z_IU0SuppliedRecords *notToKeep;
};
struct Z_IU0UpdateTaskPackage
{
// originPart
struct Z_IU0OriginPartToKeep *originPart;
// targetPart
struct Z_IU0TargetPart *targetPart;
};
struct Z_IUCorrelationInfo
{
// note
char *note;
// id
signed long long int *id;
};
struct Z_IUOriginPartToKeep
{
// action
signed long long int *action;
// databaseName
char *databaseName;
// schema
signed short int *schema;
// elementSetName
char *elementSetName;
// actionQualifier
struct Z_External *actionQualifier;
};
struct Z_IUSuppliedRecords
{
// num
signed int num;
// elements
struct Z_IUSuppliedRecords_elem **elements;
};
struct Z_IUSuppliedRecordsId
{
// which
signed int which;
// u
union anonymous$38 u;
};
struct Z_IUSuppliedRecords_elem
{
// which
signed int which;
// u
union anonymous$45 u;
// supplementalId
struct Z_IUSuppliedRecordsId *supplementalId;
// correlationInfo
struct Z_IUCorrelationInfo *correlationInfo;
// record
struct Z_External *record;
};
struct Z_IUTargetPart
{
// updateStatus
signed long long int *updateStatus;
// num_globalDiagnostics
signed int num_globalDiagnostics;
// globalDiagnostics
struct Z_DiagRec **globalDiagnostics;
// num_taskPackageRecords
signed int num_taskPackageRecords;
// taskPackageRecords
struct Z_IUTaskPackageRecordStructure **taskPackageRecords;
};
struct Z_IUTaskPackageRecordStructure
{
// which
signed int which;
// u
union anonymous$6 u;
// correlationInfo
struct Z_IUCorrelationInfo *correlationInfo;
// recordStatus
signed long long int *recordStatus;
// num_supplementalDiagnostics
signed int num_supplementalDiagnostics;
// supplementalDiagnostics
struct Z_DiagRec **supplementalDiagnostics;
};
struct Z_IUTaskPackageRecordStructureSurrogateDiagnostics
{
// num
signed int num;
// elements
struct Z_DiagRec **elements;
};
struct Z_IUUpdate
{
// which
signed int which;
// u
union anonymous u;
};
struct Z_IUUpdateEsRequest
{
// toKeep
struct Z_IUOriginPartToKeep *toKeep;
// notToKeep
struct Z_IUSuppliedRecords *notToKeep;
};
struct Z_IUUpdateTaskPackage
{
// originPart
struct Z_IUOriginPartToKeep *originPart;
// targetPart
struct Z_IUTargetPart *targetPart;
};
struct Z_IconObject
{
// num
signed int num;
// elements
struct Z_IconObjectUnit **elements;
};
struct Z_IconObjectUnit
{
// which
signed int which;
// u
union anonymous$75 u;
// content
struct odr_oct *content;
};
struct Z_ImportParameters
{
// recordType
char *recordType;
};
struct Z_InfoCategory
{
// categoryTypeId
signed short int *categoryTypeId;
// categoryValue
signed long long int *categoryValue;
};
struct Z_InitialSet
{
// g0
signed long long int *g0;
// g1
signed long long int *g1;
// g2
signed long long int *g2;
// g3
signed long long int *g3;
// c0
signed long long int *c0;
// c1
signed long long int *c1;
};
struct Z_IntUnit
{
// value
signed long long int *value;
// unitUsed
struct Z_Unit *unitUsed;
};
struct Z_Iso10646
{
// collections
signed short int *collections;
// encodingLevel
signed short int *encodingLevel;
};
struct Z_Iso2022
{
// which
signed int which;
// u
union anonymous$81 u;
};
struct Z_Iso2022OriginProposal
{
// proposedEnvironment
struct Z_Environment *proposedEnvironment;
// num_proposedSets
signed int num_proposedSets;
// proposedSets
signed long long int **proposedSets;
// num_proposedInitialSets
signed int num_proposedInitialSets;
// proposedInitialSets
struct Z_InitialSet **proposedInitialSets;
// proposedLeftAndRight
struct Z_LeftAndRight *proposedLeftAndRight;
};
struct Z_Iso2022TargetResponse
{
// selectedEnvironment
struct Z_Environment *selectedEnvironment;
// num_selectedSets
signed int num_selectedSets;
// selectedSets
signed long long int **selectedSets;
// selectedinitialSet
struct Z_InitialSet *selectedinitialSet;
// selectedLeftAndRight
struct Z_LeftAndRight *selectedLeftAndRight;
};
struct Z_Iso8777Capabilities
{
// num_searchKeys
signed int num_searchKeys;
// searchKeys
struct Z_SearchKey **searchKeys;
// restrictions
struct Z_HumanString *restrictions;
};
struct Z_KRBObject
{
// which
signed int which;
// u
union anonymous$44 u;
};
struct Z_KRBRequest
{
// service
char *service;
// instance
char *instance;
// realm
char *realm;
};
struct Z_KRBResponse
{
// userid
char *userid;
// ticket
struct odr_oct *ticket;
};
struct Z_LeftAndRight
{
// gLeft
signed long long int *gLeft;
// gRight
signed long long int *gRight;
};
struct Z_MultipleSearchTerms_2
{
// num
signed int num;
// elements
struct Z_MultipleSearchTerms_2_s **elements;
};
struct Z_MultipleSearchTerms_2_s
{
// term
struct Z_Term *term;
// flag
signed int *flag;
};
struct Z_NamePlusRecord
{
// databaseName
char *databaseName;
// which
signed int which;
// u
union anonymous$18 u;
};
struct Z_NetworkAddress
{
// which
signed int which;
// u
union anonymous$57 u;
};
struct Z_NetworkAddressIA
{
// hostAddress
char *hostAddress;
// port
signed long long int *port;
};
struct Z_NetworkAddressOPA
{
// pSel
char *pSel;
// sSel
char *sSel;
// tSel
char *tSel;
// nSap
char *nSap;
};
struct Z_NetworkAddressOther
{
// type
char *type;
// address
char *address;
};
struct Z_OCLC_UserInformation
{
// motd
char *motd;
// num_dblist
signed int num_dblist;
// dblist
char **dblist;
// failReason
signed int *failReason;
// code
signed long long int *code;
// text
char *text;
};
struct Z_OPACRecord
{
// bibliographicRecord
struct Z_External *bibliographicRecord;
// num_holdingsData
signed int num_holdingsData;
// holdingsData
struct Z_HoldingsRecord **holdingsData;
};
struct Z_OccurValues
{
// start
signed long long int *start;
// howMany
signed long long int *howMany;
};
struct Z_Occurrences
{
// which
signed int which;
// u
union anonymous$31 u;
};
struct Z_OidList
{
// num
signed int num;
// elements
signed short int **elements;
};
struct Z_OmittedAttributeInterpretation
{
// defaultValue
struct Z_StringOrNumeric *defaultValue;
// defaultDescription
struct Z_HumanString *defaultDescription;
};
struct Z_Operand
{
// which
signed int which;
// u
union anonymous$100 u;
};
struct Z_Operator
{
// which
signed int which;
// u
union anonymous$12 u;
};
struct Z_Order
{
// ascending
signed int *ascending;
// order
signed long long int *order;
};
struct Z_OriginProposal
{
// num_proposedCharSets
signed int num_proposedCharSets;
// proposedCharSets
struct Z_OriginProposal_0 **proposedCharSets;
// num_proposedlanguages
signed int num_proposedlanguages;
// proposedlanguages
char **proposedlanguages;
// recordsInSelectedCharSets
signed int *recordsInSelectedCharSets;
};
struct Z_OriginProposal_0
{
// which
signed int which;
// u
union anonymous$69 u;
};
struct Z_OtherInformation
{
// num_elements
signed int num_elements;
// list
struct Z_OtherInformationUnit **list;
};
struct Z_OtherInformationUnit
{
// category
struct Z_InfoCategory *category;
// which
signed int which;
// information
union anonymous$4 information;
};
struct Z_PQSOriginPartNotToKeep
{
// which
signed int which;
// u
union anonymous$98 u;
// originSuggestedPeriod
struct Z_PQSPeriod *originSuggestedPeriod;
// expiration
char *expiration;
// resultSetPackage
char *resultSetPackage;
};
struct Z_PQSOriginPartToKeep
{
// activeFlag
signed int *activeFlag;
// num_databaseNames
signed int num_databaseNames;
// databaseNames
char **databaseNames;
// resultSetDisposition
signed long long int *resultSetDisposition;
// alertDestination
struct Z_ESDestination *alertDestination;
// which
signed int which;
// u
union anonymous$96 u;
};
struct Z_PQSPeriod
{
// which
signed int which;
// u
union anonymous$99 u;
};
struct Z_PQSPeriodicQuerySchedule
{
// which
signed int which;
// u
union anonymous$95 u;
};
struct Z_PQSPeriodicQueryScheduleEsRequest
{
// toKeep
struct Z_PQSOriginPartToKeep *toKeep;
// notToKeep
struct Z_PQSOriginPartNotToKeep *notToKeep;
};
struct Z_PQSPeriodicQueryScheduleTaskPackage
{
// originPart
struct Z_PQSOriginPartToKeep *originPart;
// targetPart
struct Z_PQSTargetPart *targetPart;
};
struct Z_PQSTargetPart
{
// actualQuery
struct Z_Query *actualQuery;
// targetStatedPeriod
struct Z_PQSPeriod *targetStatedPeriod;
// expiration
char *expiration;
// resultSetPackage
char *resultSetPackage;
// lastQueryTime
char *lastQueryTime;
// lastResultNumber
signed long long int *lastResultNumber;
// numberSinceModify
signed long long int *numberSinceModify;
};
struct Z_PQueryOriginPartNotToKeep
{
// which
signed int which;
// u
union anonymous$94 u;
};
struct Z_PQueryOriginPartToKeep
{
// num_dbNames
signed int num_dbNames;
// dbNames
char **dbNames;
// additionalSearchInfo
struct Z_OtherInformation *additionalSearchInfo;
};
struct Z_PQueryPersistentQuery
{
// which
signed int which;
// u
union anonymous$93 u;
};
struct Z_PQueryPersistentQueryEsRequest
{
// toKeep
struct Z_PQueryOriginPartToKeep *toKeep;
// notToKeep
struct Z_PQueryOriginPartNotToKeep *notToKeep;
};
struct Z_PQueryPersistentQueryTaskPackage
{
// originPart
struct Z_PQueryOriginPartToKeep *originPart;
// targetPart
struct Z_Query *targetPart;
};
struct Z_PROriginPartNotToKeep
{
// originSuppliedResultSet
char *originSuppliedResultSet;
// replaceOrAppend
signed long long int *replaceOrAppend;
};
struct Z_PRPersistentResultSet
{
// which
signed int which;
// u
union anonymous$0 u;
};
struct Z_PRPersistentResultSetEsRequest
{
// toKeep
void *toKeep;
// notToKeep
struct Z_PROriginPartNotToKeep *notToKeep;
};
struct Z_PRPersistentResultSetTaskPackage
{
// originPart
void *originPart;
// targetPart
struct Z_PRTargetPart *targetPart;
};
struct Z_PRTargetPart
{
// targetSuppliedResultSet
char *targetSuppliedResultSet;
// numberOfRecords
signed long long int *numberOfRecords;
};
struct Z_Path
{
// num
signed int num;
// elements
struct Z_PathUnit **elements;
};
struct Z_PathUnit
{
// tagType
signed long long int *tagType;
// tagValue
struct Z_StringOrNumeric *tagValue;
};
struct Z_PerElementDetails
{
// name
char *name;
// recordTag
struct Z_RecordTag *recordTag;
// num_schemaTags
signed int num_schemaTags;
// schemaTags
struct Z_Path **schemaTags;
// maxSize
signed long long int *maxSize;
// minSize
signed long long int *minSize;
// avgSize
signed long long int *avgSize;
// fixedSize
signed long long int *fixedSize;
// repeatable
signed int *repeatable;
// required
signed int *required;
// description
struct Z_HumanString *description;
// contents
struct Z_HumanString *contents;
// billingInfo
struct Z_HumanString *billingInfo;
// restrictions
struct Z_HumanString *restrictions;
// num_alternateNames
signed int num_alternateNames;
// alternateNames
char **alternateNames;
// num_genericNames
signed int num_genericNames;
// genericNames
char **genericNames;
// searchAccess
struct Z_AttributeCombinations *searchAccess;
};
struct Z_Permissions
{
// num
signed int num;
// elements
struct Z_Permissions_s **elements;
};
struct Z_Permissions_s
{
// userId
char *userId;
// num_allowableFunctions
signed int num_allowableFunctions;
// allowableFunctions
signed long long int **allowableFunctions;
};
struct Z_PrivateCapOperator
{
// roperator
char *roperator;
// description
struct Z_HumanString *description;
};
struct Z_PrivateCapabilities
{
// num_operators
signed int num_operators;
// operators
struct Z_PrivateCapOperator **operators;
// num_searchKeys
signed int num_searchKeys;
// searchKeys
struct Z_SearchKey **searchKeys;
// num_description
signed int num_description;
// description
struct Z_HumanString **description;
};
struct Z_PrivateCharacterSet
{
// which
signed int which;
// u
union anonymous$77 u;
};
struct Z_PrivateCharacterSetViaOid
{
// num
signed int num;
// elements
signed short int **elements;
};
struct Z_ProcessingInformation
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// databaseName
char *databaseName;
// processingContext
signed long long int *processingContext;
// name
char *name;
// oid
signed short int *oid;
// description
struct Z_HumanString *description;
// instructions
struct Z_External *instructions;
};
struct Z_PromptId
{
// which
signed int which;
// u
union anonymous$50 u;
};
struct Z_PromptIdEnumeratedPrompt
{
// type
signed long long int *type;
// suggestedString
char *suggestedString;
};
struct Z_PromptObject1
{
// which
signed int which;
// u
union anonymous$39 u;
};
struct Z_ProxSupportPrivate
{
// unit
signed long long int *unit;
// description
struct Z_HumanString *description;
};
struct Z_ProxSupportUnit
{
// which
signed int which;
// u
union anonymous$22 u;
};
struct Z_Proximity
{
// which
signed int which;
// u
union anonymous$21 u;
};
struct Z_ProximityOperator
{
// exclusion
signed int *exclusion;
// distance
signed long long int *distance;
// ordered
signed int *ordered;
// relationType
signed long long int *relationType;
// which
signed int which;
// u
union anonymous$15 u;
};
struct Z_ProximitySupport
{
// anySupport
signed int *anySupport;
// num_unitsSupported
signed int num_unitsSupported;
// unitsSupported
struct Z_ProxSupportUnit **unitsSupported;
};
struct Z_Query
{
// which
signed int which;
// u
union anonymous$82 u;
};
struct Z_QueryExpression
{
// which
signed int which;
// u
union anonymous$79 u;
};
struct Z_QueryExpressionTerm
{
// queryTerm
struct Z_Term *queryTerm;
// termComment
char *termComment;
};
struct Z_QueryTypeDetails
{
// which
signed int which;
// u
union anonymous$76 u;
};
struct Z_RPNQuery
{
// attributeSetId
signed short int *attributeSetId;
// RPNStructure
struct Z_RPNStructure *RPNStructure;
};
struct Z_RPNStructure
{
// which
signed int which;
// u
union anonymous$27 u;
};
struct Z_RecordSyntax
{
// unsupportedSyntax
signed short int *unsupportedSyntax;
// num_suggestedAlternatives
signed int num_suggestedAlternatives;
// suggestedAlternatives
signed short int **suggestedAlternatives;
};
struct Z_RecordSyntaxInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// recordSyntax
signed short int *recordSyntax;
// name
char *name;
// num_transferSyntaxes
signed int num_transferSyntaxes;
// transferSyntaxes
signed short int **transferSyntaxes;
// description
struct Z_HumanString *description;
// asn1Module
char *asn1Module;
// num_abstractStructure
signed int num_abstractStructure;
// abstractStructure
struct Z_ElementInfo **abstractStructure;
};
struct Z_RecordTag
{
// qualifier
struct Z_StringOrNumeric *qualifier;
// tagValue
struct Z_StringOrNumeric *tagValue;
};
struct Z_ResourceReport1
{
// num_estimates
signed int num_estimates;
// estimates
struct Z_Estimate1 **estimates;
// message
char *message;
};
struct Z_ResourceReport2
{
// num_estimates
signed int num_estimates;
// estimates
struct Z_Estimate2 **estimates;
// message
char *message;
};
struct Z_Response1
{
// num
signed int num;
// elements
struct Z_ResponseUnit1 **elements;
};
struct Z_ResponseUnit1
{
// promptId
struct Z_PromptId *promptId;
// which
signed int which;
// u
union anonymous$55 u;
};
struct Z_ResultSetPlusAttributes
{
// resultSet
char *resultSet;
// attributes
struct Z_AttributeList *attributes;
};
struct Z_ResultsByDB
{
// num
signed int num;
// elements
struct Z_ResultsByDB_s **elements;
};
struct Z_ResultsByDB_s
{
// which
signed int which;
// u
union anonymous$80 u;
// count
signed long long int *count;
// resultSetName
char *resultSetName;
};
struct Z_ResultsByDB_sList
{
// num
signed int num;
// elements
char **elements;
};
struct Z_RetrievalRecordDetails
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// databaseName
char *databaseName;
// schema
signed short int *schema;
// recordSyntax
signed short int *recordSyntax;
// description
struct Z_HumanString *description;
// num_detailsPerElement
signed int num_detailsPerElement;
// detailsPerElement
struct Z_PerElementDetails **detailsPerElement;
};
struct Z_RpnCapabilities
{
// num_operators
signed int num_operators;
// operators
signed long long int **operators;
// resultSetAsOperandSupported
signed int *resultSetAsOperandSupported;
// restrictionOperandSupported
signed int *restrictionOperandSupported;
// proximity
struct Z_ProximitySupport *proximity;
};
struct Z_Scan
{
// which
signed int which;
// u
union anonymous$23 u;
};
struct Z_SchemaInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// schema
signed short int *schema;
// name
char *name;
// description
struct Z_HumanString *description;
// num_tagTypeMapping
signed int num_tagTypeMapping;
// tagTypeMapping
struct Z_TagTypeMapping **tagTypeMapping;
// num_recordStructure
signed int num_recordStructure;
// recordStructure
struct Z_ElementInfo **recordStructure;
};
struct Z_SearchInfoReport
{
// num
signed int num;
// elements
struct Z_SearchInfoReport_s **elements;
};
struct Z_SearchInfoReport_s
{
// subqueryId
char *subqueryId;
// fullQuery
signed int *fullQuery;
// subqueryExpression
struct Z_QueryExpression *subqueryExpression;
// subqueryInterpretation
struct Z_QueryExpression *subqueryInterpretation;
// subqueryRecommendation
struct Z_QueryExpression *subqueryRecommendation;
// subqueryCount
signed long long int *subqueryCount;
// subqueryWeight
struct Z_IntUnit *subqueryWeight;
// resultsByDB
struct Z_ResultsByDB *resultsByDB;
};
struct Z_SearchKey
{
// searchKey
char *searchKey;
// description
struct Z_HumanString *description;
};
struct Z_Segment
{
// referenceId
struct odr_oct *referenceId;
// numberOfRecordsReturned
signed long long int *numberOfRecordsReturned;
// num_segmentRecords
signed int num_segmentRecords;
// segmentRecords
struct Z_NamePlusRecord **segmentRecords;
// otherInfo
struct Z_OtherInformation *otherInfo;
};
struct Z_Segmentation
{
// which
signed int which;
// u
union anonymous$101 u;
};
struct Z_SimpleElement
{
// path
struct Z_ETagPath *path;
// variantRequest
struct Z_Variant *variantRequest;
};
struct Z_Sort
{
// which
signed int which;
// u
union anonymous$25 u;
};
struct Z_SortAttributes
{
// id
signed short int *id;
// list
struct Z_AttributeList *list;
};
struct Z_SortDbSpecificList
{
// num
signed int num;
// elements
struct Z_SortDbSpecificList_s **elements;
};
struct Z_SortDbSpecificList_s
{
// databaseName
char *databaseName;
// dbSort
struct Z_SortKey *dbSort;
};
struct Z_SortDetails
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// databaseName
char *databaseName;
// num_sortKeys
signed int num_sortKeys;
// sortKeys
struct Z_SortKeyDetails **sortKeys;
};
struct Z_SortElement
{
// which
signed int which;
// u
union anonymous$24 u;
};
struct Z_SortKey
{
// which
signed int which;
// u
union anonymous$83 u;
};
struct Z_SortKeyDetails
{
// description
struct Z_HumanString *description;
// num_elementSpecifications
signed int num_elementSpecifications;
// elementSpecifications
struct Z_Specification **elementSpecifications;
// attributeSpecifications
struct Z_AttributeCombinations *attributeSpecifications;
// which
signed int which;
// u
union anonymous$71 u;
// caseSensitivity
signed long long int *caseSensitivity;
};
struct Z_SpecificTag
{
// tagType
signed long long int *tagType;
// tagValue
struct Z_StringOrNumeric *tagValue;
// occurrences
struct Z_Occurrences *occurrences;
};
struct Z_Specification
{
// which
signed int which;
// schema
union anonymous$62 schema;
// elementSpec
struct Z_ElementSpec *elementSpec;
};
struct Z_StringList
{
// num
signed int num;
// elements
char **elements;
};
struct Z_StringOrNumeric
{
// which
signed int which;
// u
union anonymous$7 u;
};
struct Z_TagPath
{
// num
signed int num;
// elements
struct Z_TagPath_s **elements;
};
struct Z_TagPath_s
{
// tagType
signed long long int *tagType;
// tagValue
struct Z_StringOrNumeric *tagValue;
// tagOccurrence
signed long long int *tagOccurrence;
};
struct Z_TagSetElements
{
// elementname
char *elementname;
// num_nicknames
signed int num_nicknames;
// nicknames
char **nicknames;
// elementTag
struct Z_StringOrNumeric *elementTag;
// description
struct Z_HumanString *description;
// dataType
signed long long int *dataType;
// otherTagInfo
struct Z_OtherInformation *otherTagInfo;
};
struct Z_TagSetInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// tagSet
signed short int *tagSet;
// name
char *name;
// description
struct Z_HumanString *description;
// num_elements
signed int num_elements;
// elements
struct Z_TagSetElements **elements;
};
struct Z_TagTypeMapping
{
// tagType
signed long long int *tagType;
// tagSet
signed short int *tagSet;
// defaultTagType
void *defaultTagType;
};
struct Z_TaggedElement
{
// tagType
signed long long int *tagType;
// tagValue
struct Z_StringOrNumeric *tagValue;
// tagOccurrence
signed long long int *tagOccurrence;
// content
struct Z_ElementData *content;
// metaData
struct Z_ElementMetaData *metaData;
// appliedVariant
struct Z_Variant *appliedVariant;
};
struct Z_TargetInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// name
char *name;
// recentNews
struct Z_HumanString *recentNews;
// icon
struct Z_IconObject *icon;
// namedResultSets
signed int *namedResultSets;
// multipleDBsearch
signed int *multipleDBsearch;
// maxResultSets
signed long long int *maxResultSets;
// maxResultSize
signed long long int *maxResultSize;
// maxTerms
signed long long int *maxTerms;
// timeoutInterval
struct Z_IntUnit *timeoutInterval;
// welcomeMessage
struct Z_HumanString *welcomeMessage;
// contactInfo
struct Z_ContactInfo *contactInfo;
// description
struct Z_HumanString *description;
// num_nicknames
signed int num_nicknames;
// nicknames
char **nicknames;
// usageRest
struct Z_HumanString *usageRest;
// paymentAddr
struct Z_HumanString *paymentAddr;
// hours
struct Z_HumanString *hours;
// num_dbCombinations
signed int num_dbCombinations;
// dbCombinations
struct Z_DatabaseList **dbCombinations;
// num_addresses
signed int num_addresses;
// addresses
struct Z_NetworkAddress **addresses;
// num_languages
signed int num_languages;
// languages
char **languages;
// commonAccessInfo
struct Z_AccessInfo *commonAccessInfo;
};
struct Z_TargetResponse
{
// which
signed int which;
// u
union anonymous$72 u;
// selectedLanguage
char *selectedLanguage;
// recordsInSelectedCharSets
signed int *recordsInSelectedCharSets;
};
struct Z_TaskPackage
{
// packageType
signed short int *packageType;
// packageName
char *packageName;
// userId
char *userId;
// retentionTime
struct Z_IntUnit *retentionTime;
// permissions
struct Z_Permissions *permissions;
// description
char *description;
// targetReference
struct odr_oct *targetReference;
// creationDateTime
char *creationDateTime;
// taskStatus
signed long long int *taskStatus;
// num_packageDiagnostics
signed int num_packageDiagnostics;
// packageDiagnostics
struct Z_DiagRec **packageDiagnostics;
// taskSpecificParameters
struct Z_External *taskSpecificParameters;
};
struct Z_Term
{
// which
signed int which;
// u
union anonymous$1 u;
};
struct Z_TermListDetails
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// termListName
char *termListName;
// description
struct Z_HumanString *description;
// attributes
struct Z_AttributeCombinations *attributes;
// scanInfo
struct Z_EScanInfo *scanInfo;
// estNumberTerms
signed long long int *estNumberTerms;
// num_sampleTerms
signed int num_sampleTerms;
// sampleTerms
struct Z_Term **sampleTerms;
};
struct Z_TermListElement
{
// name
char *name;
// title
struct Z_HumanString *title;
// searchCost
signed long long int *searchCost;
// scanable
signed int *scanable;
// num_broader
signed int num_broader;
// broader
char **broader;
// num_narrower
signed int num_narrower;
// narrower
char **narrower;
};
struct Z_TermListInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// databaseName
char *databaseName;
// num_termLists
signed int num_termLists;
// termLists
struct Z_TermListElement **termLists;
};
struct Z_Time
{
// hour
signed long long int *hour;
// minute
signed long long int *minute;
// second
signed long long int *second;
// partOfSecond
struct Z_IntUnit *partOfSecond;
// which
signed int which;
// u
union anonymous$42 u;
};
struct Z_TooMany
{
// tooManyWhat
signed long long int *tooManyWhat;
// max
signed long long int *max;
};
struct Z_Triple
{
// variantSetId
signed short int *variantSetId;
// zclass
signed long long int *zclass;
// type
signed long long int *type;
// which
signed int which;
// value
union anonymous$59 value;
};
struct Z_Unit
{
// unitSystem
char *unitSystem;
// unitType
struct Z_StringOrNumeric *unitType;
// unit
struct Z_StringOrNumeric *unit;
// scaleFactor
signed long long int *scaleFactor;
};
struct Z_UnitInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// unitSystem
char *unitSystem;
// description
struct Z_HumanString *description;
// num_units
signed int num_units;
// units
struct Z_UnitType **units;
};
struct Z_UnitType
{
// name
char *name;
// description
struct Z_HumanString *description;
// unitType
struct Z_StringOrNumeric *unitType;
// num_units
signed int num_units;
// units
struct Z_Units **units;
};
struct Z_Units
{
// name
char *name;
// description
struct Z_HumanString *description;
// unit
struct Z_StringOrNumeric *unit;
};
struct Z_UniverseReport
{
// totalHits
signed long long int *totalHits;
// which
signed int which;
// u
union anonymous$30 u;
};
struct Z_UniverseReportDuplicate
{
// hitno
struct Z_StringOrNumeric *hitno;
};
struct Z_UniverseReportHits
{
// database
struct Z_StringOrNumeric *database;
// hits
struct Z_StringOrNumeric *hits;
};
struct Z_Usage
{
// type
signed long long int *type;
// restriction
char *restriction;
};
struct Z_ValueDescription
{
// which
signed int which;
// u
union anonymous$74 u;
};
struct Z_ValueRange
{
// lower
struct Z_ValueDescription *lower;
// upper
struct Z_ValueDescription *upper;
};
struct Z_ValueSet
{
// which
signed int which;
// u
union anonymous$73 u;
};
struct Z_ValueSetEnumerated
{
// num
signed int num;
// elements
struct Z_ValueDescription **elements;
};
struct Z_Variant
{
// globalVariantSetId
signed short int *globalVariantSetId;
// num_triples
signed int num_triples;
// triples
struct Z_Triple **triples;
};
struct Z_VariantClass
{
// name
char *name;
// description
struct Z_HumanString *description;
// variantClass
signed long long int *variantClass;
// num_variantTypes
signed int num_variantTypes;
// variantTypes
struct Z_VariantType **variantTypes;
};
struct Z_VariantSetInfo
{
// commonInfo
struct Z_CommonInfo *commonInfo;
// variantSet
signed short int *variantSet;
// name
char *name;
// num_variants
signed int num_variants;
// variants
struct Z_VariantClass **variants;
};
struct Z_VariantType
{
// name
char *name;
// description
struct Z_HumanString *description;
// variantType
signed long long int *variantType;
// variantValue
struct Z_VariantValue *variantValue;
};
struct Z_VariantValue
{
// dataType
signed long long int *dataType;
// values
struct Z_ValueSet *values;
};
struct Z_Volume
{
// enumeration
char *enumeration;
// chronology
char *chronology;
// enumAndChron
char *enumAndChron;
};
struct _IO_FILE
{
// _flags
signed int _flags;
// _IO_read_ptr
char *_IO_read_ptr;
// _IO_read_end
char *_IO_read_end;
// _IO_read_base
char *_IO_read_base;
// _IO_write_base
char *_IO_write_base;
// _IO_write_ptr
char *_IO_write_ptr;
// _IO_write_end
char *_IO_write_end;
// _IO_buf_base
char *_IO_buf_base;
// _IO_buf_end
char *_IO_buf_end;
// _IO_save_base
char *_IO_save_base;
// _IO_backup_base
char *_IO_backup_base;
// _IO_save_end
char *_IO_save_end;
// _markers
struct _IO_marker *_markers;
// _chain
struct _IO_FILE *_chain;
// _fileno
signed int _fileno;
// _flags2
signed int _flags2;
// _old_offset
signed long int _old_offset;
// _cur_column
unsigned short int _cur_column;
// _vtable_offset
signed char _vtable_offset;
// _shortbuf
char _shortbuf[1l];
// _lock
void *_lock;
// _offset
signed long int _offset;
// __pad1
void *__pad1;
// __pad2
void *__pad2;
// __pad3
void *__pad3;
// __pad4
void *__pad4;
// __pad5
unsigned long int __pad5;
// _mode
signed int _mode;
// _unused2
char _unused2[(signed long int)(sizeof(signed int) * 5) /*20l*/ ];
};
struct _IO_marker
{
// _next
struct _IO_marker *_next;
// _sbuf
struct _IO_FILE *_sbuf;
// _pos
signed int _pos;
};
struct _xmlAttr
{
// _private
void *_private;
// type
enum anonymous$10 type;
// name
const unsigned char *name;
// children
struct _xmlNode *children;
// last
struct _xmlNode *last;
// parent
struct _xmlNode *parent;
// next
struct _xmlAttr *next;
// prev
struct _xmlAttr *prev;
// doc
struct _xmlDoc *doc;
// ns
struct _xmlNs *ns;
// atype
enum anonymous$13 atype;
// psvi
void *psvi;
};
struct _xmlDoc
{
// _private
void *_private;
// type
enum anonymous$10 type;
// name
char *name;
// children
struct _xmlNode *children;
// last
struct _xmlNode *last;
// parent
struct _xmlNode *parent;
// next
struct _xmlNode *next;
// prev
struct _xmlNode *prev;
// doc
struct _xmlDoc *doc;
// compression
signed int compression;
// standalone
signed int standalone;
// intSubset
struct _xmlDtd *intSubset;
// extSubset
struct _xmlDtd *extSubset;
// oldNs
struct _xmlNs *oldNs;
// version
const unsigned char *version;
// encoding
const unsigned char *encoding;
// ids
void *ids;
// refs
void *refs;
// URL
const unsigned char *URL;
// charset
signed int charset;
// dict
struct _xmlDict *dict;
// psvi
void *psvi;
// parseFlags
signed int parseFlags;
// properties
signed int properties;
};
struct _xmlDtd
{
// _private
void *_private;
// type
enum anonymous$10 type;
// name
const unsigned char *name;
// children
struct _xmlNode *children;
// last
struct _xmlNode *last;
// parent
struct _xmlDoc *parent;
// next
struct _xmlNode *next;
// prev
struct _xmlNode *prev;
// doc
struct _xmlDoc *doc;
// notations
void *notations;
// elements
void *elements;
// attributes
void *attributes;
// entities
void *entities;
// ExternalID
const unsigned char *ExternalID;
// SystemID
const unsigned char *SystemID;
// pentities
void *pentities;
};
struct _xmlNode
{
// _private
void *_private;
// type
enum anonymous$10 type;
// name
const unsigned char *name;
// children
struct _xmlNode *children;
// last
struct _xmlNode *last;
// parent
struct _xmlNode *parent;
// next
struct _xmlNode *next;
// prev
struct _xmlNode *prev;
// doc
struct _xmlDoc *doc;
// ns
struct _xmlNs *ns;
// content
unsigned char *content;
// properties
struct _xmlAttr *properties;
// nsDef
struct _xmlNs *nsDef;
// psvi
void *psvi;
// line
unsigned short int line;
// extra
unsigned short int extra;
};
struct _xmlNs
{
// next
struct _xmlNs *next;
// type
enum anonymous$10 type;
// href
const unsigned char *href;
// prefix
const unsigned char *prefix;
// _private
void *_private;
// context
struct _xmlDoc *context;
};
struct chr_t_entry
{
// children
struct chr_t_entry **children;
// target
unsigned char **target;
};
struct chrmaptab_info
{
// input
struct chr_t_entry *input;
// q_input
struct chr_t_entry *q_input;
// output
unsigned char *output[256l];
// base_uppercase
signed int base_uppercase;
// nmem
struct nmem_control *nmem;
};
struct chrwork
{
// map
struct chrmaptab_info *map;
// string
char string[1025l];
};
struct flock
{
// l_type
signed short int l_type;
// l_whence
signed short int l_whence;
// l_start
signed long int l_start;
// l_len
signed long int l_len;
// l_pid
signed int l_pid;
};
struct it_key
{
// len
signed int len;
// mem
signed long long int mem[5l];
};
struct iscz1_code_info
{
// key
struct it_key key;
};
struct odr_bitmask
{
// bits
unsigned char bits[256l];
// top
signed int top;
};
struct odr_oct
{
// buf
unsigned char *buf;
// len
signed int len;
// size
signed int size;
};
struct passwd_db
{
// entries
struct passwd_entry *entries;
};
struct passwd_entry
{
// encrypt_flag
signed int encrypt_flag;
// name
char *name;
// des
char *des;
// next
struct passwd_entry *next;
};
union pthread_attr_t
{
// __size
char __size[56l];
// __align
signed long int __align;
};
struct res_entry
{
// name
char *name;
// value
char *value;
// next
struct res_entry *next;
};
struct res_struct
{
// ref_count
signed int ref_count;
// first
struct res_entry *first;
// last
struct res_entry *last;
// def_res
struct res_struct *def_res;
// over_res
struct res_struct *over_res;
};
struct strmap_entry
{
// name
char *name;
// data_len
unsigned long int data_len;
// data_buf
void *data_buf;
// next
struct strmap_entry *next;
};
struct timespec
{
// tv_sec
signed long int tv_sec;
// tv_nsec
signed long int tv_nsec;
};
struct timeval
{
// tv_sec
signed long int tv_sec;
// tv_usec
signed long int tv_usec;
};
struct timezone
{
// tz_minuteswest
signed int tz_minuteswest;
// tz_dsttime
signed int tz_dsttime;
};
struct wrbuf
{
// buf
char *buf;
// pos
unsigned long int pos;
// size
unsigned long int size;
};
struct xpath_location_step
{
// part
char *part;
// predicate
struct xpath_predicate *predicate;
};
struct xpath_predicate
{
// which
signed int which;
// u
union anonymous$66 u;
};
struct zebra_lock_handle
{
// write_flag
signed int write_flag;
// p
struct zebra_lock_info *p;
};
struct zebra_lock_info
{
// fd
signed int fd;
// fname
char *fname;
// ref_count
signed int ref_count;
// no_file_write_lock
signed int no_file_write_lock;
// no_file_read_lock
signed int no_file_read_lock;
// rdwr_lock
struct anonymous$56 rdwr_lock;
// file_mutex
struct anonymous$54 file_mutex;
// next
struct zebra_lock_info *next;
};
struct zebra_map
{
// id
const char *id;
// completeness
signed int completeness;
// positioned
signed int positioned;
// alwaysmatches
signed int alwaysmatches;
// first_in_field
signed int first_in_field;
// type
signed int type;
// use_chain
signed int use_chain;
// debug
signed int debug;
// u
union anonymous$97 u;
// maptab
struct chrmaptab_info *maptab;
// maptab_name
const char *maptab_name;
// zebra_maps
struct zebra_maps_s *zebra_maps;
// doc
struct _xmlDoc *doc;
// icu_chain
struct icu_chain *icu_chain;
// input_str
struct wrbuf *input_str;
// print_str
struct wrbuf *print_str;
// simple_off
unsigned long int simple_off;
// next
struct zebra_map *next;
};
struct zebra_maps_s
{
// tabpath
char *tabpath;
// tabroot
char *tabroot;
// nmem
struct nmem_control *nmem;
// temp_map_str
char temp_map_str[2l];
// temp_map_ptr
const char *temp_map_ptr[2l];
// wrbuf_1
struct wrbuf *wrbuf_1;
// no_files_read
signed int no_files_read;
// map_list
struct zebra_map *map_list;
// last_map
struct zebra_map *last_map;
};
struct zebra_snippet_word
{
// seqno
signed long long int seqno;
// ord
signed int ord;
// term
char *term;
// match
signed int match;
// mark
signed int mark;
// ws
signed int ws;
// next
struct zebra_snippet_word *next;
// prev
struct zebra_snippet_word *prev;
};
struct zebra_snippets
{
// nmem
struct nmem_control *nmem;
// front
struct zebra_snippet_word *front;
// tail
struct zebra_snippet_word *tail;
};
struct zebra_strmap
{
// nmem_str
struct nmem_control *nmem_str;
// nmem_ent
struct nmem_control *nmem_ent;
// hsize
signed int hsize;
// size
signed int size;
// entries
struct strmap_entry **entries;
// free_entries
struct strmap_entry *free_entries;
};
struct zebra_strmap_it_s
{
// hno
signed int hno;
// ent
struct strmap_entry *ent;
// st
struct zebra_strmap *st;
};
// CHR_BASE
// file charmap.c line 51
const char *CHR_BASE = "\005";
// CHR_CUT
// file charmap.c line 50
const char *CHR_CUT = "\003";
// CHR_FIELD_BEGIN
// file charmap.c line 46
const unsigned char CHR_FIELD_BEGIN = (const unsigned char)94;
// CHR_SPACE
// file charmap.c line 49
const char *CHR_SPACE = "\002";
// CHR_UNKNOWN
// file charmap.c line 48
const char *CHR_UNKNOWN = "\001";
// initialized
// file flock.c line 44
static signed int initialized = 0;
// lock_list
// file flock.c line 53
static struct zebra_lock_info *lock_list = ((struct zebra_lock_info *)NULL);
// lock_list_mutex
// file flock.c line 50
struct anonymous$54 lock_list_mutex;
// log_level
// file flock.c line 82
static signed int log_level = 0;
// posix_locks
// file flock.c line 47
static signed int posix_locks = 1;
// seq
// file tstflock.c line 62
static char seq[1000l];
// seqp
// file tstflock.c line 63
static char *seqp = ((char *)NULL);
// sleep_cond
// file tstflock.c line 68
union anonymous$48 sleep_cond = { .__data={ .__lock=0, .__futex=(unsigned int)0, .__total_seq=(unsigned long long int)0, .__wakeup_seq=(unsigned long long int)0,
.__woken_seq=(unsigned long long int)0,
.__mutex=(void *)0,
.__nwaiters=(unsigned int)0, .__broadcast_seq=(unsigned int)0 } };
// sleep_mutex
// file tstflock.c line 69
union anonymous$47 sleep_mutex = { .__data={ .__lock=0, .__count=(unsigned int)0, .__owner=0, .__nusers=(unsigned int)0,
.__kind=0, .__spins=(signed short int)0,
.__elision=(signed short int)0, .__list={ .__prev=((struct __pthread_internal_list *)NULL), .__next=((struct __pthread_internal_list *)NULL) } } };
// stderr
// file /usr/include/stdio.h line 170
extern struct _IO_FILE *stderr;
// test_fd
// file tstflock.c line 72
signed int test_fd = 0;
// add_entry
// file res.c line 60
static struct res_entry * add_entry(struct res_struct *r)
{
struct res_entry *resp;
void *return_value_xmalloc_f$1;
if(r->first == ((struct res_entry *)NULL))
{
return_value_xmalloc_f$1=xmalloc_f(sizeof(struct res_entry) /*24ul*/ , "res.c", 66);
r->first = (struct res_entry *)return_value_xmalloc_f$1;
r->last = r->first;
resp = r->last;
}
else
{
void *return_value_xmalloc_f$2;
return_value_xmalloc_f$2=xmalloc_f(sizeof(struct res_entry) /*24ul*/ , "res.c", 69);
resp = (struct res_entry *)return_value_xmalloc_f$2;
r->last->next = resp;
r->last = resp;
}
resp->next = (struct res_entry *)(void *)0;
return resp;
}
// atoi_zn
// file atoi_zn.c line 27
signed long long int atoi_zn(const char *buf, signed long long int len)
{
signed long long int val = (signed long long int)0;
do
{
len = len - 1ll;
if(!(len >= 0l))
break;
const unsigned short int **return_value___ctype_b_loc$1;
return_value___ctype_b_loc$1=__ctype_b_loc();
if(!((2048 & (signed int)(*return_value___ctype_b_loc$1)[(signed long int)(signed int)*buf]) == 0))
val = val * (signed long int)10 + (signed long int)((signed int)*buf - 48);
buf = buf + 1l;
}
while((_Bool)1);
return val;
}
// atozint
// file zint.c line 55
signed long long int atozint(const char *src)
{
signed long long int return_value_atoll$1;
return_value_atoll$1=atoll(src);
return return_value_atoll$1;
}
// attr_find
// file ../include/attrfind.h line 42
signed int attr_find(struct anonymous$89 *src, const signed short int **attribute_set_id)
{
signed int return_value_attr_find_ex$1;
return_value_attr_find_ex$1=attr_find_ex(src, attribute_set_id, ((const char **)NULL));
return return_value_attr_find_ex$1;
}
// attr_find_ex
// file ../include/attrfind.h line 40
signed int attr_find_ex(struct anonymous$89 *src, const signed short int **attribute_set_oid, const char **string_value)
{
signed int num_attributes = src->num_attributes;
while(!(src->major >= num_attributes))
{
struct Z_AttributeElement *element = src->attributeList[(signed long int)src->major];
if((signed long int)src->type == *element->attributeType)
switch(element->which)
{
case 1:
{
src->major = src->major + 1;
if(!(element->attributeSet == ((signed short int *)NULL)))
{
if(!(attribute_set_oid == ((const signed short int **)NULL)))
*attribute_set_oid = element->attributeSet;
}
return (signed int)*element->value.numeric;
}
case 2:
{
if(src->minor >= element->value.complex->num_list)
break;
if(!(element->attributeSet == ((signed short int *)NULL)))
{
if(!(attribute_set_oid == ((const signed short int **)NULL)))
*attribute_set_oid = element->attributeSet;
}
if(element->value.complex->list[(signed long int)src->minor]->which == 2)
{
src->minor = src->minor + 1;
return (signed int)*element->value.complex->list[(signed long int)(src->minor - 1)]->u.numeric;
}
else
if(element->value.complex->list[(signed long int)src->minor]->which == 1)
{
if(string_value == ((const char **)NULL))
break;
src->minor = src->minor + 1;
*string_value = element->value.complex->list[(signed long int)(src->minor - 1)]->u.string;
return -2;
}
else
break;
}
default:
/* assertion 0 */
assert(0 != 0);
}
src->major = src->major + 1;
}
return -1;
}
// attr_init_APT
// file ../include/attrfind.h line 36
void attr_init_APT(struct anonymous$89 *src, struct Z_AttributesPlusTerm *zapt, signed int type)
{
src->attributeList = zapt->attributes->attributes;
src->num_attributes = zapt->attributes->num_attributes;
src->type = type;
src->major = 0;
src->minor = 0;
}
// attr_init_AttrList
// file ../include/attrfind.h line 38
void attr_init_AttrList(struct anonymous$89 *src, struct Z_AttributeList *list, signed int type)
{
src->attributeList = list->attributes;
src->num_attributes = list->num_attributes;
src->type = type;
src->major = 0;
src->minor = 0;
}
// check_for_linuxthreads
// file flock.c line 371
static signed int check_for_linuxthreads(void)
{
char conf_buf[512l];
unsigned long int r;
r=confstr(3, conf_buf, sizeof(char [512l]) /*512ul*/ );
if(r == 0ul)
{
yaz_log(0x00000004 | 0x00000010, "confstr failed");
return -1;
}
else
{
signed int return_value_strncmp$1;
return_value_strncmp$1=strncmp(conf_buf, "linuxthreads", (unsigned long int)12);
if(return_value_strncmp$1 == 0)
posix_locks = 0;
return 0;
}
}
// chr_map_input
// file charmap.c line 194
const char ** chr_map_input(struct chrmaptab_info *maptab, const char **from, signed int len, signed int first)
{
struct chr_t_entry *t = maptab->input;
struct chr_t_entry *res;
signed int len_tmp[2l];
len_tmp[(signed long int)0] = len;
len_tmp[(signed long int)1] = -1;
res=find_entry_x(t, from, len_tmp, first);
if(res == ((struct chr_t_entry *)NULL))
abort();
return (const char **)res->target;
}
// chr_map_input_x
// file charmap.c line 184
const char ** chr_map_input_x(struct chrmaptab_info *maptab, const char **from, signed int *len, signed int first)
{
struct chr_t_entry *t = maptab->input;
struct chr_t_entry *res;
res=find_entry_x(t, from, len, first);
if(res == ((struct chr_t_entry *)NULL))
abort();
return (const char **)res->target;
}
// chr_map_output
// file charmap.c line 221
const char * chr_map_output(struct chrmaptab_info *maptab, const char **from, signed int len)
{
unsigned char c = *(*((unsigned char **)from));
const char *out = (const char *)maptab->output[(signed long int)c];
if(!(out == ((const char *)NULL)))
*from = *from + 1l;
return out;
}
// chr_map_q_input
// file charmap.c line 207
const char ** chr_map_q_input(struct chrmaptab_info *maptab, const char **from, signed int len, signed int first)
{
struct chr_t_entry *t = maptab->q_input;
struct chr_t_entry *res;
signed int len_tmp[2l];
len_tmp[(signed long int)0] = len;
len_tmp[(signed long int)1] = -1;
res=find_entry_x(t, from, len_tmp, first);
if(res == ((struct chr_t_entry *)NULL))
return ((const char **)NULL);
else
return (const char **)res->target;
}
// chrmaptab_create
// file charmap.c line 513
struct chrmaptab_info * chrmaptab_create(const char *tabpath, const char *name, const char *tabroot)
{
struct _IO_FILE *f;
char line[512l];
char *argv[50l];
struct chrmaptab_info *res;
signed int lineno = 0;
signed int no_directives = 0;
signed int errors = 0;
signed int argc;
signed int num = (signed int)*CHR_BASE;
signed int chrmaptab_create$$1$$i;
struct nmem_control *nmem;
struct yaz_iconv_struct *t_unicode = ((struct yaz_iconv_struct *)NULL);
struct yaz_iconv_struct *t_utf8 = ((struct yaz_iconv_struct *)NULL);
unsigned int endian = (unsigned int)31;
const char *ucs4_native = "UCS-4";
yaz_log(0x00000002, "maptab %s open", name);
f=yaz_fopen(tabpath, name, "r", tabroot);
signed int return_value_yaz_matchstr$26;
signed int return_value_yaz_matchstr$25;
signed int return_value_yaz_matchstr$24;
signed int return_value_yaz_matchstr$23;
signed int return_value_yaz_matchstr$22;
unsigned long int return_value_strlen$14;
signed int tmp_post$16;
signed int tmp_post$18;
signed int return_value_yaz_matchstr$21;
if(f == ((struct _IO_FILE *)NULL))
{
yaz_log(0x00000004 | 0x00000010, "%s", name);
return ((struct chrmaptab_info *)NULL);
}
else
{
if((signed int)*((char *)&endian) == 31)
ucs4_native = "UCS-4LE";
t_utf8=yaz_iconv_open("UTF-8", ucs4_native);
nmem=nmem_create();
void *return_value_nmem_malloc$1;
return_value_nmem_malloc$1=nmem_malloc(nmem, sizeof(struct chrmaptab_info) /*2080ul*/ );
res = (struct chrmaptab_info *)return_value_nmem_malloc$1;
res->nmem = nmem;
void *return_value_nmem_malloc$2;
return_value_nmem_malloc$2=nmem_malloc(res->nmem, sizeof(struct chr_t_entry) /*16ul*/ );
res->input = (struct chr_t_entry *)return_value_nmem_malloc$2;
void *return_value_nmem_malloc$3;
return_value_nmem_malloc$3=nmem_malloc(res->nmem, sizeof(unsigned char *) /*8ul*/ * (unsigned long int)2);
res->input->target = (unsigned char **)return_value_nmem_malloc$3;
res->input->target[(signed long int)0] = (unsigned char *)CHR_UNKNOWN;
res->input->target[(signed long int)1] = ((unsigned char *)NULL);
void *return_value_nmem_malloc$4;
return_value_nmem_malloc$4=nmem_malloc(res->nmem, sizeof(struct chr_t_entry *) /*8ul*/ * (unsigned long int)256);
res->input->children = (struct chr_t_entry **)return_value_nmem_malloc$4;
chrmaptab_create$$1$$i = 0;
for( ; !(chrmaptab_create$$1$$i >= 256); chrmaptab_create$$1$$i = chrmaptab_create$$1$$i + 1)
{
void *return_value_nmem_malloc$5;
return_value_nmem_malloc$5=nmem_malloc(res->nmem, sizeof(struct chr_t_entry) /*16ul*/ );
res->input->children[(signed long int)chrmaptab_create$$1$$i] = (struct chr_t_entry *)return_value_nmem_malloc$5;
res->input->children[(signed long int)chrmaptab_create$$1$$i]->children = ((struct chr_t_entry **)NULL);
void *return_value_nmem_malloc$6;
return_value_nmem_malloc$6=nmem_malloc(res->nmem, (unsigned long int)2 * sizeof(unsigned char *) /*8ul*/ );
res->input->children[(signed long int)chrmaptab_create$$1$$i]->target = (unsigned char **)return_value_nmem_malloc$6;
res->input->children[(signed long int)chrmaptab_create$$1$$i]->target[(signed long int)1] = ((unsigned char *)NULL);
res->input->children[(signed long int)chrmaptab_create$$1$$i]->target[(signed long int)0] = (unsigned char *)CHR_UNKNOWN;
}
void *return_value_nmem_malloc$7;
return_value_nmem_malloc$7=nmem_malloc(res->nmem, sizeof(struct chr_t_entry) /*16ul*/ );
res->q_input = (struct chr_t_entry *)return_value_nmem_malloc$7;
res->q_input->target = ((unsigned char **)NULL);
res->q_input->children = ((struct chr_t_entry **)NULL);
chrmaptab_create$$1$$i = (signed int)*CHR_BASE;
for( ; !(chrmaptab_create$$1$$i >= 256); chrmaptab_create$$1$$i = chrmaptab_create$$1$$i + 1)
res->output[(signed long int)chrmaptab_create$$1$$i] = ((unsigned char *)NULL);
res->output[(signed long int)(signed int)*CHR_SPACE] = (unsigned char *)" ";
res->output[(signed long int)(signed int)*CHR_UNKNOWN] = (unsigned char *)"@";
res->base_uppercase = 0;
while(errors == 0)
{
argc=readconf_line(f, &lineno, line, 512, argv, 50);
if(argc == 0)
break;
no_directives = no_directives + 1;
signed int return_value_yaz_matchstr$27;
return_value_yaz_matchstr$27=yaz_matchstr(argv[(signed long int)0], "lowercase");
if(return_value_yaz_matchstr$27 == 0)
{
if(!(argc == 2))
{
yaz_log(0x00000001, "Syntax error in charmap");
errors = errors + 1;
}
signed int return_value_scan_string$8;
return_value_scan_string$8=scan_string(argv[(signed long int)1], t_unicode, t_utf8, fun_addentry, (void *)res, &num);
if(!(return_value_scan_string$8 >= 0))
{
yaz_log(0x00000001, "Bad value-set specification");
errors = errors + 1;
}
res->base_uppercase = num;
res->output[(signed long int)((signed int)*CHR_SPACE + num)] = (unsigned char *)" ";
res->output[(signed long int)((signed int)*CHR_UNKNOWN + num)] = (unsigned char *)"@";
num = (signed int)*CHR_BASE;
}
else
{
return_value_yaz_matchstr$26=yaz_matchstr(argv[(signed long int)0], "uppercase");
if(return_value_yaz_matchstr$26 == 0)
{
if(res->base_uppercase == 0)
{
yaz_log(0x00000001, "Uppercase directive with no lowercase set");
errors = errors + 1;
}
if(!(argc == 2))
{
yaz_log(0x00000001, "Missing arg for uppercase directive");
errors = errors + 1;
}
signed int return_value_scan_string$9;
return_value_scan_string$9=scan_string(argv[(signed long int)1], t_unicode, t_utf8, fun_addentry, (void *)res, &num);
if(!(return_value_scan_string$9 >= 0))
{
yaz_log(0x00000001, "Bad value-set specification");
errors = errors + 1;
}
}
else
{
return_value_yaz_matchstr$25=yaz_matchstr(argv[(signed long int)0], "space");
if(return_value_yaz_matchstr$25 == 0)
{
if(!(argc == 2))
{
yaz_log(0x00000001, "Syntax error in charmap for space");
errors = errors + 1;
}
signed int return_value_scan_string$10;
return_value_scan_string$10=scan_string(argv[(signed long int)1], t_unicode, t_utf8, fun_addspace, (void *)res, ((signed int *)NULL));
if(!(return_value_scan_string$10 >= 0))
{
yaz_log(0x00000001, "Bad space specification");
errors = errors + 1;
}
}
else
{
return_value_yaz_matchstr$24=yaz_matchstr(argv[(signed long int)0], "cut");
if(return_value_yaz_matchstr$24 == 0)
{
if(!(argc == 2))
{
yaz_log(0x00000001, "Syntax error in charmap for cut");
errors = errors + 1;
}
signed int return_value_scan_string$11;
return_value_scan_string$11=scan_string(argv[(signed long int)1], t_unicode, t_utf8, fun_addcut, (void *)res, ((signed int *)NULL));
if(!(return_value_scan_string$11 >= 0))
{
yaz_log(0x00000001, "Bad cut specification");
errors = errors + 1;
}
}
else
{
return_value_yaz_matchstr$23=yaz_matchstr(argv[(signed long int)0], "map");
if(return_value_yaz_matchstr$23 == 0)
{
struct chrwork buf;
if(!(argc == 3))
{
yaz_log(0x00000001, "charmap directive map requires 2 args");
errors = errors + 1;
}
buf.map = res;
buf.string[(signed long int)0] = (char)0;
signed int return_value_scan_string$12;
return_value_scan_string$12=scan_string(argv[(signed long int)2], t_unicode, t_utf8, fun_mkstring, (void *)&buf, ((signed int *)NULL));
if(!(return_value_scan_string$12 >= 0))
{
yaz_log(0x00000001, "Bad map target");
errors = errors + 1;
}
signed int return_value_scan_string$13;
return_value_scan_string$13=scan_string(argv[(signed long int)1], t_unicode, t_utf8, fun_add_map, (void *)&buf, ((signed int *)NULL));
if(!(return_value_scan_string$13 >= 0))
{
yaz_log(0x00000001, "Bad map source");
errors = errors + 1;
}
}
else
{
return_value_yaz_matchstr$22=yaz_matchstr(argv[(signed long int)0], "equivalent");
if(return_value_yaz_matchstr$22 == 0)
{
struct anonymous$35 w;
if(!(argc == 2))
{
yaz_log(0x00000001, "equivalent requires 1 argument");
errors = errors + 1;
}
w.nmem = res->nmem;
w.no_eq = 0;
signed int return_value_scan_string$20;
return_value_scan_string$20=scan_string(argv[(signed long int)1], t_unicode, t_utf8, fun_add_equivalent_string, (void *)&w, ((signed int *)NULL));
if(!(return_value_scan_string$20 >= 0))
{
yaz_log(0x00000001, "equivalent: invalid string");
errors = errors + 1;
}
else
if(w.no_eq == 0)
{
yaz_log(0x00000001, "equivalent: no strings");
errors = errors + 1;
}
else
{
char *result_str;
signed int i;
signed int slen = 5;
i = 0;
for( ; !(i >= w.no_eq); i = i + 1)
{
return_value_strlen$14=strlen(w.eq[(signed long int)i]);
slen = slen + (signed int)(return_value_strlen$14 + (unsigned long int)1);
}
void *return_value_nmem_malloc$15;
return_value_nmem_malloc$15=nmem_malloc(res->nmem, (unsigned long int)(slen + 5));
result_str = (char *)return_value_nmem_malloc$15;
*result_str = (char)0;
slen = 0;
i = 0;
for( ; !(i >= w.no_eq); i = i + 1)
{
tmp_post$16 = slen;
slen = slen + 1;
result_str[(signed long int)tmp_post$16] = (char)(i != 0 ? 124 : 40);
strcpy(result_str + (signed long int)slen, w.eq[(signed long int)i]);
unsigned long int return_value_strlen$17;
return_value_strlen$17=strlen(w.eq[(signed long int)i]);
slen = slen + (signed int)return_value_strlen$17;
}
tmp_post$18 = slen;
slen = slen + 1;
result_str[(signed long int)tmp_post$18] = (char)41;
result_str[(signed long int)slen] = (char)0;
i = 0;
for( ; !(i >= w.no_eq); i = i + 1)
{
unsigned long int return_value_strlen$19;
return_value_strlen$19=strlen(w.eq[(signed long int)i]);
set_map_string(res->q_input, res->nmem, w.eq[(signed long int)i], (signed int)return_value_strlen$19, result_str, ((const char *)NULL));
}
}
}
else
{
return_value_yaz_matchstr$21=yaz_matchstr(argv[(signed long int)0], "encoding");
if(return_value_yaz_matchstr$21 == 0)
{
if(!(t_unicode == ((struct yaz_iconv_struct *)NULL)))
yaz_iconv_close(t_unicode);
t_unicode=yaz_iconv_open(ucs4_native, argv[(signed long int)1]);
}
else
{
yaz_log(0x00000004, "Syntax error at '%s' in %s", (const void *)line, name);
errors = errors + 1;
}
}
}
}
}
}
}
}
yaz_fclose(f);
if(no_directives == 0)
{
yaz_log(0x00000004, "No directives in '%s'", name);
errors = errors + 1;
}
if(!(errors == 0))
{
chrmaptab_destroy(res);
res = ((struct chrmaptab_info *)NULL);
}
yaz_log(0x00000002, "maptab %s num=%d close %d errors", name, num, errors);
if(!(t_utf8 == ((struct yaz_iconv_struct *)NULL)))
yaz_iconv_close(t_utf8);
if(!(t_unicode == ((struct yaz_iconv_struct *)NULL)))
yaz_iconv_close(t_unicode);
return res;
}
}
// chrmaptab_destroy
// file charmap.c line 748
void chrmaptab_destroy(struct chrmaptab_info *tab)
{
if(!(tab == ((struct chrmaptab_info *)NULL)))
nmem_destroy(tab->nmem);
}
// dump_xp_predicate
// file xpath.c line 216
void dump_xp_predicate(struct xpath_predicate *p)
{
_Bool tmp_if_expr$1;
if(!(p == ((struct xpath_predicate *)NULL)))
{
if(p->which == 1)
tmp_if_expr$1 = p->u.relation.name[(signed long int)0] != 0 ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$1 = (_Bool)0;
if(tmp_if_expr$1)
fprintf(stderr, "%s,%s,%s", p->u.relation.name, p->u.relation.op, p->u.relation.value);
else
{
fprintf(stderr, "(");
dump_xp_predicate(p->u.boolean.left);
fprintf(stderr, ") %s (", p->u.boolean.op);
dump_xp_predicate(p->u.boolean.right);
fprintf(stderr, ")");
}
}
}
// dump_xp_steps
// file xpath.c line 235
void dump_xp_steps(struct xpath_location_step *xpath, signed int no)
{
signed int i = 0;
for( ; !(i >= no); i = i + 1)
{
fprintf(stderr, "Step %d: %s ", i, (xpath + (signed long int)i)->part);
dump_xp_predicate((xpath + (signed long int)i)->predicate);
fprintf(stderr, "\n");
}
}
// find_entry_x
// file charmap.c line 141
static struct chr_t_entry * find_entry_x(struct chr_t_entry *t, const char **from, signed int *len, signed int first)
{
struct chr_t_entry *res;
for( ; !(*len >= 1); len = len + 1l)
{
if(!(*len >= 0))
break;
from = from + 1l;
}
_Bool tmp_if_expr$1;
if(*len >= 1)
{
if(!(t->children == ((struct chr_t_entry **)NULL)))
{
const char *old_from = *from;
signed int old_len = *len;
res = ((struct chr_t_entry *)NULL);
if(!(first == 0))
{
if(!(t->children[(signed long int)CHR_FIELD_BEGIN] == ((struct chr_t_entry *)NULL)))
{
res=find_entry_x(t->children[(signed long int)CHR_FIELD_BEGIN], from, len, 0);
if(!(res == ((struct chr_t_entry *)NULL)))
tmp_if_expr$1 = res != t->children[(signed long int)CHR_FIELD_BEGIN] ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$1 = (_Bool)0;
if(tmp_if_expr$1)
return res;
else
res = ((struct chr_t_entry *)NULL);
}
}
if(res == ((struct chr_t_entry *)NULL))
{
if(!(t->children[(signed long int)(unsigned char)*(*from)] == ((struct chr_t_entry *)NULL)))
{
*len = *len - 1;
*from = *from + 1l;
res=find_entry_x(t->children[(signed long int)(unsigned char)*old_from], from, len, 0);
if(!(res == ((struct chr_t_entry *)NULL)))
return res;
*len = old_len;
*from = old_from;
}
}
}
}
return t->target != ((unsigned char **)NULL) ? t : ((struct chr_t_entry *)NULL);
}
// fork_tst
// file tstflock.c line 216
void fork_tst(void)
{
signed int pid[2l];
signed int i = 0;
for( ; !(i >= 2); i = i + 1)
{
pid[(signed long int)i]=fork();
if(pid[(signed long int)i] == 0)
{
tst();
exit(0);
}
}
i = 0;
for( ; !(i >= 2); i = i + 1)
{
signed int status;
waitpid(pid[(signed long int)i], &status, 0);
if(status == 0)
yaz_check_print1(1, "tstflock.c", 235, "status == 0");
else
yaz_check_print1(2, "tstflock.c", 235, "status == 0");
}
}
// fun_add_equivalent_string
// file charmap.c line 369
static void fun_add_equivalent_string(const char *s, void *data, signed int num)
{
struct anonymous$35 *arg = (struct anonymous$35 *)data;
signed int tmp_post$1;
if(!(arg->no_eq == 32))
{
tmp_post$1 = arg->no_eq;
arg->no_eq = arg->no_eq + 1;
arg->eq[(signed long int)tmp_post$1]=nmem_strdup(arg->nmem, s);
}
}
// fun_add_map
// file charmap.c line 381
static void fun_add_map(const char *s, void *data, signed int num)
{
struct chrwork *arg = (struct chrwork *)data;
/* assertion arg->map->input */
assert(arg->map->input != ((struct chr_t_entry *)NULL));
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(s);
yaz_log(0x00000002, "set map %.*s", (signed int)return_value_strlen$1, s);
unsigned long int return_value_strlen$2;
return_value_strlen$2=strlen(s);
set_map_string(arg->map->input, arg->map->nmem, s, (signed int)return_value_strlen$2, arg->string, ((const char *)NULL));
s = arg->string;
for( ; !(*s == 0); s = s + 1l)
yaz_log(0x00000002, " %3d", (unsigned char)*s);
}
// fun_addcut
// file charmap.c line 344
static void fun_addcut(const char *s, void *data, signed int num)
{
struct chrmaptab_info *tab = (struct chrmaptab_info *)data;
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(s);
tab->input=set_map_string(tab->input, tab->nmem, s, (signed int)return_value_strlen$1, (char *)CHR_CUT, ((const char *)NULL));
}
// fun_addentry
// file charmap.c line 318
static void fun_addentry(const char *s, void *data, signed int num)
{
struct chrmaptab_info *tab = (struct chrmaptab_info *)data;
char tmp[2l];
tmp[(signed long int)0] = (char)num;
tmp[(signed long int)1] = (char)0;
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(s);
tab->input=set_map_string(tab->input, tab->nmem, s, (signed int)return_value_strlen$1, tmp, ((const char *)NULL));
char *return_value_nmem_strdup$2;
return_value_nmem_strdup$2=nmem_strdup(tab->nmem, s);
tab->output[(signed long int)(num + tab->base_uppercase)] = (unsigned char *)return_value_nmem_strdup$2;
}
// fun_addspace
// file charmap.c line 333
static void fun_addspace(const char *s, void *data, signed int num)
{
struct chrmaptab_info *tab = (struct chrmaptab_info *)data;
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(s);
tab->input=set_map_string(tab->input, tab->nmem, s, (signed int)return_value_strlen$1, (char *)CHR_SPACE, ((const char *)NULL));
}
// fun_mkstring
// file charmap.c line 354
static void fun_mkstring(const char *s, void *data, signed int num)
{
struct chrwork *arg = (struct chrwork *)data;
const char **res;
const char *p = s;
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(s);
res=chr_map_input(arg->map, &s, (signed int)return_value_strlen$1, 0);
if(*res == CHR_UNKNOWN)
yaz_log(0x00000004, "Map: '%s' has no mapping", p);
unsigned long int return_value_strlen$2;
return_value_strlen$2=strlen(arg->string);
strncat(arg->string, *res, (unsigned long int)1024 - return_value_strlen$2);
arg->string[(signed long int)1024] = (char)0;
}
// get_entry
// file passwddb.c line 59
static signed int get_entry(const char **p, char *dst, signed int max)
{
signed int i = 0;
for( ; !((signed int)(*p)[(signed long int)i] == 58); i = i + 1)
if((*p)[(signed long int)i] == 0)
break;
if(i >= max)
i = max - 1;
if(!(i == 0))
memcpy((void *)dst, (const void *)*p, (unsigned long int)i);
dst[(signed long int)i] = (char)0;
*p = *p + (signed long int)i;
if(!(*p == ((const char *)NULL)))
*p = *p + 1l;
return i;
}
// get_xp_part
// file xpath.c line 31
static char * get_xp_part(char **strs, struct nmem_control *mem, signed int *literal)
{
char *cp = *strs;
char *str = ((char *)NULL);
char *res = ((char *)NULL);
*literal = 0;
for( ; (signed int)*cp == 32; cp = cp + 1l)
;
str = cp;
char *return_value_strchr$6;
return_value_strchr$6=strchr("()", (signed int)*cp);
char *return_value_strchr$5;
char *return_value_strchr$1;
_Bool tmp_if_expr$4;
char *return_value_strchr$3;
if(!(return_value_strchr$6 == ((char *)NULL)))
cp = cp + 1l;
else
{
return_value_strchr$5=strchr("><=", (signed int)*cp);
if(!(return_value_strchr$5 == ((char *)NULL)))
do
{
return_value_strchr$1=strchr("><=", (signed int)*cp);
if(return_value_strchr$1 == ((char *)NULL))
break;
cp = cp + 1l;
}
while((_Bool)1);
else
{
if((signed int)*cp == 34)
tmp_if_expr$4 = (_Bool)1;
else
tmp_if_expr$4 = (signed int)*cp == 39 ? (_Bool)1 : (_Bool)0;
if(tmp_if_expr$4)
{
signed int sep = (signed int)*cp;
str = str + 1l;
cp = cp + 1l;
for( ; !(*cp == 0); cp = cp + 1l)
if((signed int)*cp == sep)
break;
void *return_value_nmem_malloc$2;
return_value_nmem_malloc$2=nmem_malloc(mem, (unsigned long int)((cp - str) + (signed long int)1));
res = (char *)return_value_nmem_malloc$2;
if(!(cp - str == 0l))
memcpy((void *)res, (const void *)str, (unsigned long int)(cp - str));
res[cp - str] = (char)0;
if(!(*cp == 0))
cp = cp + 1l;
*literal = 1;
}
else
for( ; !(*cp == 0); cp = cp + 1l)
{
return_value_strchr$3=strchr("><=()]\" ", (signed int)*cp);
if(!(return_value_strchr$3 == ((char *)NULL)))
break;
}
}
}
if(res == ((char *)NULL))
{
void *return_value_nmem_malloc$7;
return_value_nmem_malloc$7=nmem_malloc(mem, (unsigned long int)((cp - str) + (signed long int)1));
res = (char *)return_value_nmem_malloc$7;
if(!(cp - str == 0l))
memcpy((void *)res, (const void *)str, (unsigned long int)(cp - str));
res[cp - str] = (char)0;
}
*strs = cp;
return res;
}
// get_xpath_boolean
// file xpath.c line 121
static struct xpath_predicate * get_xpath_boolean(char **pr, struct nmem_control *mem, char **look, signed int *literal)
{
struct xpath_predicate *left = ((struct xpath_predicate *)NULL);
left=get_xpath_relation(pr, mem, look, literal);
signed int return_value_strcmp$1;
signed int return_value_strcmp$2;
signed int return_value_strcmp$3;
if(left == ((struct xpath_predicate *)NULL))
return ((struct xpath_predicate *)NULL);
else
{
while(!(*look == ((char *)NULL)))
{
if(!(*literal == 0))
break;
return_value_strcmp$1=strcmp(*look, "and");
if(!(return_value_strcmp$1 == 0))
{
return_value_strcmp$2=strcmp(*look, "or");
if(!(return_value_strcmp$2 == 0))
{
return_value_strcmp$3=strcmp(*look, "not");
if(!(return_value_strcmp$3 == 0))
break;
}
}
struct xpath_predicate *res;
struct xpath_predicate *right;
void *return_value_nmem_malloc$4;
return_value_nmem_malloc$4=nmem_malloc(mem, sizeof(struct xpath_predicate) /*32ul*/ );
res = (struct xpath_predicate *)return_value_nmem_malloc$4;
res->which = 2;
res->u.boolean.op = *look;
res->u.boolean.left = left;
*look=get_xp_part(pr, mem, literal);
right=get_xpath_relation(pr, mem, look, literal);
res->u.boolean.right = right;
left = res;
}
return left;
}
}
// get_xpath_predicate
// file xpath.c line 151
static struct xpath_predicate * get_xpath_predicate(char *predicate, struct nmem_control *mem)
{
signed int literal;
char **pr = &predicate;
char *look;
look=get_xp_part(pr, mem, &literal);
if(look == ((char *)NULL))
return ((struct xpath_predicate *)NULL);
else
{
struct xpath_predicate *return_value_get_xpath_boolean$1;
return_value_get_xpath_boolean$1=get_xpath_boolean(pr, mem, &look, &literal);
return return_value_get_xpath_boolean$1;
}
}
// get_xpath_relation
// file xpath.c line 82
static struct xpath_predicate * get_xpath_relation(char **pr, struct nmem_control *mem, char **look, signed int *literal)
{
struct xpath_predicate *res = ((struct xpath_predicate *)NULL);
_Bool tmp_if_expr$7;
signed int return_value_strcmp$6;
if(*literal == 0)
{
return_value_strcmp$6=strcmp(*look, "(");
tmp_if_expr$7 = !(return_value_strcmp$6 != 0) ? (_Bool)1 : (_Bool)0;
}
else
tmp_if_expr$7 = (_Bool)0;
_Bool tmp_if_expr$3;
_Bool tmp_if_expr$5;
char *return_value_strchr$4;
if(tmp_if_expr$7)
{
*look=get_xp_part(pr, mem, literal);
res=get_xpath_boolean(pr, mem, look, literal);
signed int return_value_strcmp$1;
return_value_strcmp$1=strcmp(*look, ")");
if(return_value_strcmp$1 == 0)
*look=get_xp_part(pr, mem, literal);
else
res = ((struct xpath_predicate *)NULL);
}
else
{
void *return_value_nmem_malloc$2;
return_value_nmem_malloc$2=nmem_malloc(mem, sizeof(struct xpath_predicate) /*32ul*/ );
res = (struct xpath_predicate *)return_value_nmem_malloc$2;
res->which = 1;
res->u.relation.name = *look;
*look=get_xp_part(pr, mem, literal);
if(!(*look == ((char *)NULL)))
tmp_if_expr$3 = !(*literal != 0) ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$3 = (_Bool)0;
if(tmp_if_expr$3)
{
return_value_strchr$4=strchr("><=", (signed int)*(*look));
tmp_if_expr$5 = return_value_strchr$4 != ((char *)NULL) ? (_Bool)1 : (_Bool)0;
}
else
tmp_if_expr$5 = (_Bool)0;
if(tmp_if_expr$5)
{
res->u.relation.op = *look;
*look=get_xp_part(pr, mem, literal);
if(*look == ((char *)NULL))
return ((struct xpath_predicate *)NULL);
res->u.relation.value = *look;
*look=get_xp_part(pr, mem, literal);
}
else
{
res->u.relation.op = "";
res->u.relation.value = "";
}
}
return res;
}
// hash
// file strmap.c line 70
static struct strmap_entry ** hash(struct zebra_strmap *st, const char *name)
{
unsigned int hash$$1$$hash = (unsigned int)0;
signed int i = 0;
for( ; !(name[(signed long int)i] == 0); i = i + 1)
hash$$1$$hash = hash$$1$$hash + hash$$1$$hash * (unsigned int)65519 + (unsigned int)name[(signed long int)i];
hash$$1$$hash = hash$$1$$hash % (unsigned int)st->hsize;
return st->entries + (signed long int)hash$$1$$hash;
}
// iscz1_decode
// file it_key.c line 237
void iscz1_decode(void *vp, char **dst, const char **src)
{
struct iscz1_code_info *p = (struct iscz1_code_info *)vp;
signed int i;
signed int leader;
signed long long int return_value_iscz1_decode_int$1;
return_value_iscz1_decode_int$1=iscz1_decode_int((unsigned char **)src);
leader = (signed int)return_value_iscz1_decode_int$1;
i = leader & 7;
signed long long int return_value_iscz1_decode_int$2;
if(!((64 & leader) == 0))
{
return_value_iscz1_decode_int$2=iscz1_decode_int((unsigned char **)src);
p->key.mem[(signed long int)i] = p->key.mem[(signed long int)i] + return_value_iscz1_decode_int$2;
}
else
p->key.mem[(signed long int)i]=iscz1_decode_int((unsigned char **)src);
p->key.len = leader >> 3 & 7;
do
{
i = i + 1;
if(i >= p->key.len)
break;
p->key.mem[(signed long int)i]=iscz1_decode_int((unsigned char **)src);
}
while((_Bool)1);
memcpy((void *)*dst, (const void *)&p->key, sizeof(struct it_key) /*48ul*/ );
*dst = *dst + (signed long int)sizeof(struct it_key) /*48ul*/ ;
}
// iscz1_decode_int
// file it_key.c line 174
static inline signed long long int iscz1_decode_int(unsigned char **src)
{
signed long long int d = (signed long long int)0;
unsigned char c;
unsigned int r = (unsigned int)0;
unsigned char *tmp_post$1;
do
{
tmp_post$1 = *src;
*src = *src + 1l;
c = *tmp_post$1;
if((128 & (signed int)c) == 0)
break;
d = d + ((signed long long int)((signed int)c & 127) << r);
r = r + (unsigned int)7;
}
while((_Bool)1);
d = d + ((signed long long int)c << r);
return d;
}
// iscz1_encode
// file it_key.c line 189
void iscz1_encode(void *vp, char **dst, const char **src)
{
struct iscz1_code_info *p = (struct iscz1_code_info *)vp;
struct it_key tkey;
signed long long int d;
signed int i;
memcpy((void *)&tkey, (const void *)*src, sizeof(struct it_key) /*48ul*/ );
d = (signed long long int)0;
/* assertion tkey.len > 0 && tkey.len <= 5 */
assert(tkey.len > 0 && tkey.len <= 5);
i = 0;
for( ; !(i >= tkey.len); i = i + 1)
{
d = tkey.mem[(signed long int)i] - p->key.mem[(signed long int)i];
if(i == tkey.len + -1 || !(d == 0ll))
{
p->key.mem[(signed long int)i] = tkey.mem[(signed long int)i];
if(d >= 1l)
{
iscz1_encode_int((signed long long int)(i + (tkey.len << 3) + 64), dst);
i = i + 1;
iscz1_encode_int(d, dst);
}
else
iscz1_encode_int((signed long long int)(i + (tkey.len << 3)), dst);
break;
}
}
for( ; !(i >= tkey.len); i = i + 1)
{
iscz1_encode_int(tkey.mem[(signed long int)i], dst);
p->key.mem[(signed long int)i] = tkey.mem[(signed long int)i];
}
*src = *src + (signed long int)sizeof(struct it_key) /*48ul*/ ;
}
// iscz1_encode_int
// file it_key.c line 160
static inline void iscz1_encode_int(signed long long int d, char **dst)
{
unsigned char *bp = (unsigned char *)*dst;
unsigned char *tmp_post$1;
for( ; d >= 128l; d = d >> 7)
{
tmp_post$1 = bp;
bp = bp + 1l;
*tmp_post$1 = (unsigned char)(unsigned int)((signed long int)128 | d & (signed long int)127);
}
unsigned char *tmp_post$2 = bp;
bp = bp + 1l;
*tmp_post$2 = (unsigned char)(unsigned int)d;
*dst = (char *)bp;
}
// iscz1_reset
// file it_key.c line 145
void iscz1_reset(void *vp)
{
struct iscz1_code_info *p = (struct iscz1_code_info *)vp;
signed int i;
p->key.len = 0;
i = 0;
for( ; !(i >= 5); i = i + 1)
p->key.mem[(signed long int)i] = (signed long long int)0;
}
// iscz1_start
// file it_key.c line 129
void * iscz1_start(void)
{
struct iscz1_code_info *p;
void *return_value_xmalloc_f$1;
return_value_xmalloc_f$1=xmalloc_f(sizeof(struct iscz1_code_info) /*48ul*/ , "it_key.c", 132);
p = (struct iscz1_code_info *)return_value_xmalloc_f$1;
iscz1_reset((void *)p);
return (void *)p;
}
// iscz1_stop
// file it_key.c line 154
void iscz1_stop(void *p)
{
xfree_f(p, "it_key.c", 156);
}
// key_SU_decode
// file su_codec.c line 64
signed int key_SU_decode(signed int *ch, const unsigned char *out)
{
signed int len = 1;
signed int fact = 1;
*ch = 0;
len = 1;
for( ; (signed int)*out >= 65; out = out + 1l)
{
*ch = *ch + ((signed int)*out - 65) * fact;
fact = fact << 6;
len = len + 1;
}
*ch = *ch + ((signed int)*out - 1) * fact;
return len;
}
// key_SU_encode
// file su_codec.c line 31
signed int key_SU_encode(signed int ch, char *out)
{
signed int i;
if(ch == -1)
{
out[(signed long int)0] = (char)129;
return 1;
}
else
{
i = 0;
for( ; !(ch == 0); i = i + 1)
{
if(ch >= 64)
out[(signed long int)i] = (char)(65 + (ch & 63));
else
out[(signed long int)i] = (char)(1 + ch);
ch = ch >> 6;
}
return i;
}
}
// key_compare
// file it_key.c line 73
signed int key_compare(const void *p1, const void *p2)
{
struct it_key i1;
struct it_key i2;
signed int i;
signed int l;
memcpy((void *)&i1, p1, sizeof(struct it_key) /*48ul*/ );
memcpy((void *)&i2, p2, sizeof(struct it_key) /*48ul*/ );
l = i1.len;
if(!(l >= i2.len))
l = i2.len;
/* assertion l <= 5 && l > 0 */
assert(l <= 5 && l > 0);
i = 0;
for( ; !(i >= l); i = i + 1)
if(!(i1.mem[(signed long int)i] == i2.mem[(signed long int)i]))
{
if(!(i2.mem[(signed long int)i] >= i1.mem[(signed long int)i]))
return l - i;
else
return i - l;
}
return 0;
}
// key_get_segment
// file it_key.c line 103
signed long long int key_get_segment(const void *p)
{
struct it_key k;
memcpy((void *)&k, p, sizeof(struct it_key) /*48ul*/ );
return k.mem[(signed long int)(k.len - 2)];
}
// key_get_seq
// file it_key.c line 96
signed long long int key_get_seq(const void *p)
{
struct it_key k;
memcpy((void *)&k, p, sizeof(struct it_key) /*48ul*/ );
return k.mem[(signed long int)(k.len - 1)];
}
// key_init
// file it_key.c line 137
void key_init(struct it_key *key)
{
signed int i;
key->len = 0;
i = 0;
for( ; !(i >= 5); i = i + 1)
key->mem[(signed long int)i] = (signed long long int)0;
}
// key_logdump
// file it_key.c line 62
void key_logdump(signed int logmask, const void *p)
{
key_logdump_txt(logmask, p, "");
}
// key_logdump_txt
// file it_key.c line 37
void key_logdump_txt(signed int logmask, const void *p, const char *txt)
{
struct it_key key;
if(txt == ((const char *)NULL))
txt = "(none)";
if(!(p == NULL))
{
char formstr[128l];
signed int i;
memcpy((void *)&key, p, sizeof(struct it_key) /*48ul*/ );
/* assertion key.len > 0 && key.len <= 5 */
assert(key.len > 0 && key.len <= 5);
formstr[0l] = (char)0;
i = 0;
for( ; !(i >= key.len); i = i + 1)
{
if(!(i == 0))
strcat(formstr, ".");
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(formstr);
sprintf(formstr + (signed long int)return_value_strlen$1, "%lld", key.mem[(signed long int)i]);
}
yaz_log(logmask, "%s %s", (const void *)formstr, txt);
}
else
yaz_log(logmask, " (no key) %s", txt);
}
// key_print_it
// file it_key.c line 67
char * key_print_it(const void *p, char *buf)
{
strcpy(buf, "");
return buf;
}
// key_qsort_compare
// file it_key.c line 110
signed int key_qsort_compare(const void *p1, const void *p2)
{
signed int r;
unsigned long int l;
char *cp1 = *((char **)p1);
char *cp2 = *((char **)p2);
r=strcmp(cp1, cp2);
if(!(r == 0))
return r;
else
{
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(cp1);
l = return_value_strlen$1 + (unsigned long int)1;
r=key_compare((const void *)(cp1 + (signed long int)l + (signed long int)1), (const void *)(cp2 + (signed long int)l + (signed long int)1));
if(!(r == 0))
return r;
else
return (signed int)cp1[(signed long int)l] - (signed int)cp2[(signed long int)l];
}
}
// main
// file tstflock.c line 242
signed int main(signed int argc, char **argv)
{
yaz_check_init1(&argc, &argv);
yaz_check_init_log(argv[(signed long int)0]);
signed int return_value_yaz_log_mask_str$1;
return_value_yaz_log_mask_str$1=yaz_log_mask_str("flock");
yaz_log_init_level(return_value_yaz_log_mask_str$1);
zebra_flock_init();
test_fd=open("tstflock.out", 0 | 0100 | 02, 0666);
if(!(test_fd == -1))
yaz_check_print1(1, "tstflock.c", 253, "test_fd != -1");
else
yaz_check_print1(2, "tstflock.c", 253, "test_fd != -1");
if(!(test_fd == -1))
fork_tst();
yaz_check_term1();
return 0;
}
// parse_command
// file zebramap.c line 140
static signed int parse_command(struct zebra_maps_s *zms, signed int argc, char **argv, const char *fname, signed int lineno)
{
struct zebra_map *zm = zms->last_map;
signed int return_value_yaz_matchstr$12;
signed int return_value_yaz_matchstr$11;
signed int return_value_yaz_matchstr$10;
signed int return_value_yaz_matchstr$9;
signed int return_value_yaz_matchstr$8;
signed int return_value_yaz_matchstr$7;
signed int return_value_yaz_matchstr$6;
signed int return_value_yaz_matchstr$5;
signed int return_value_yaz_matchstr$4;
signed int return_value_yaz_matchstr$3;
signed int return_value_yaz_matchstr$2;
if(argc == 1)
{
yaz_log(0x00000004, "%s:%d: Missing arguments for '%s'", fname, lineno, argv[(signed long int)0]);
return -1;
}
else
if(argc >= 3)
{
yaz_log(0x00000004, "%s:%d: Too many arguments for '%s'", fname, lineno, argv[(signed long int)0]);
return -1;
}
else
{
signed int return_value_yaz_matchstr$13;
return_value_yaz_matchstr$13=yaz_matchstr(argv[(signed long int)0], "index");
if(return_value_yaz_matchstr$13 == 0)
{
zm=zebra_add_map(zms, argv[(signed long int)1], 2);
zm->positioned = 1;
}
else
{
return_value_yaz_matchstr$12=yaz_matchstr(argv[(signed long int)0], "sort");
if(return_value_yaz_matchstr$12 == 0)
{
zm=zebra_add_map(zms, argv[(signed long int)1], 1);
zm->u.sort.entry_size = 80;
}
else
{
return_value_yaz_matchstr$11=yaz_matchstr(argv[(signed long int)0], "staticrank");
if(return_value_yaz_matchstr$11 == 0)
{
zm=zebra_add_map(zms, argv[(signed long int)1], 3);
zm->completeness = 1;
}
else
if(zm == ((struct zebra_map *)NULL))
{
yaz_log(0x00000004, "%s:%d: Missing sort/index before '%s'", fname, lineno, argv[(signed long int)0]);
return -1;
}
else
{
return_value_yaz_matchstr$10=yaz_matchstr(argv[(signed long int)0], "charmap");
if(return_value_yaz_matchstr$10 == 0 && argc == 2)
{
if(!(zm->type == 3))
zm->maptab_name=nmem_strdup(zms->nmem, argv[(signed long int)1]);
else
{
yaz_log(0x00000004 | 0x00000001, "%s:%d: charmap for staticrank is invalid", fname, lineno);
yaz_log(0x00000008, "Type is %d", zm->type);
return -1;
}
}
else
{
return_value_yaz_matchstr$9=yaz_matchstr(argv[(signed long int)0], "completeness");
if(return_value_yaz_matchstr$9 == 0 && argc == 2)
zm->completeness=atoi(argv[(signed long int)1]);
else
{
return_value_yaz_matchstr$8=yaz_matchstr(argv[(signed long int)0], "position");
if(return_value_yaz_matchstr$8 == 0 && argc == 2)
zm->positioned=atoi(argv[(signed long int)1]);
else
{
return_value_yaz_matchstr$7=yaz_matchstr(argv[(signed long int)0], "alwaysmatches");
if(return_value_yaz_matchstr$7 == 0 && argc == 2)
{
if(!(zm->type == 3))
zm->alwaysmatches=atoi(argv[(signed long int)1]);
else
{
yaz_log(0x00000004 | 0x00000001, "%s:%d: alwaysmatches for staticrank is invalid", fname, lineno);
return -1;
}
}
else
{
return_value_yaz_matchstr$6=yaz_matchstr(argv[(signed long int)0], "firstinfield");
if(return_value_yaz_matchstr$6 == 0 && argc == 2)
zm->first_in_field=atoi(argv[(signed long int)1]);
else
{
return_value_yaz_matchstr$5=yaz_matchstr(argv[(signed long int)0], "entrysize");
if(return_value_yaz_matchstr$5 == 0 && argc == 2)
{
if(zm->type == 1)
zm->u.sort.entry_size=atoi(argv[(signed long int)1]);
else
{
yaz_log(0x00000004, "%s:%d: entrysize only valid in sort section", fname, lineno);
return -1;
}
}
else
{
return_value_yaz_matchstr$4=yaz_matchstr(argv[(signed long int)0], "simplechain");
if(return_value_yaz_matchstr$4 == 0)
{
zm->use_chain = 1;
zm->icu_chain = ((struct icu_chain *)NULL);
}
else
{
return_value_yaz_matchstr$3=yaz_matchstr(argv[(signed long int)0], "icuchain");
if(return_value_yaz_matchstr$3 == 0)
{
char full_path[1024l];
char *return_value_yaz_filepath_resolve$1;
return_value_yaz_filepath_resolve$1=yaz_filepath_resolve(argv[(signed long int)1], zms->tabpath, zms->tabroot, full_path);
if(return_value_yaz_filepath_resolve$1 == ((char *)NULL))
{
yaz_log(0x00000004, "%s:%d: Could not locate icuchain config '%s'", fname, lineno, argv[(signed long int)1]);
return -1;
}
zm->doc=xmlParseFile(full_path);
if(zm->doc == ((struct _xmlDoc *)NULL))
{
yaz_log(0x00000004, "%s:%d: Could not load icuchain config '%s'", fname, lineno, argv[(signed long int)1]);
return -1;
}
else
{
enum UErrorCode status;
struct _xmlNode *xml_node;
xml_node=xmlDocGetRootElement(zm->doc);
zm->icu_chain=icu_chain_xml_config(xml_node, 1, &status);
if(zm->icu_chain == ((struct icu_chain *)NULL))
yaz_log(0x00000004, "%s:%d: Failed to load ICU chain %s", fname, lineno, argv[(signed long int)1]);
zm->use_chain = 1;
}
}
else
{
return_value_yaz_matchstr$2=yaz_matchstr(argv[(signed long int)0], "debug");
if(return_value_yaz_matchstr$2 == 0 && argc == 2)
zm->debug=atoi(argv[(signed long int)1]);
else
{
yaz_log(0x00000004, "%s:%d: Unrecognized directive '%s'", fname, lineno, argv[(signed long int)0]);
return -1;
}
}
}
}
}
}
}
}
}
}
}
}
return 0;
}
}
// passwd_db_auth
// file passwddb.c line 128
signed int passwd_db_auth(struct passwd_db *db, const char *user, const char *pass)
{
struct passwd_entry *pe;
/* assertion db */
assert(db != ((struct passwd_db *)NULL));
pe = db->entries;
signed int return_value_strcmp$1;
for( ; !(pe == ((struct passwd_entry *)NULL)); pe = pe->next)
if(!(user == ((const char *)NULL)))
{
return_value_strcmp$1=strcmp(user, pe->name);
if(return_value_strcmp$1 == 0)
break;
}
if(pe == ((struct passwd_entry *)NULL))
return -1;
else
if(pass == ((const char *)NULL))
return -2;
else
{
if(!(pe->encrypt_flag == 0))
{
const char *des_try;
/* assertion pe->des */
assert(pe->des != ((char *)NULL));
unsigned long int return_value_strlen$2;
return_value_strlen$2=strlen(pe->des);
if(!(return_value_strlen$2 >= 3ul))
return -3;
if(!((signed int)*pe->des == 36))
{
unsigned long int return_value_strlen$3;
return_value_strlen$3=strlen(pass);
if(return_value_strlen$3 >= 9ul)
return -2;
}
des_try=crypt(pass, pe->des);
/* assertion des_try */
assert(des_try != ((const char *)NULL));
signed int return_value_strcmp$4;
return_value_strcmp$4=strcmp(des_try, pe->des);
if(!(return_value_strcmp$4 == 0))
return -2;
}
else
{
/* assertion pass */
assert(pass != ((const char *)NULL));
/* assertion pe->des */
assert(pe->des != ((char *)NULL));
signed int return_value_strcmp$5;
return_value_strcmp$5=strcmp(pe->des, pass);
if(!(return_value_strcmp$5 == 0))
return -2;
}
return 0;
}
}
// passwd_db_close
// file passwddb.c line 106
void passwd_db_close(struct passwd_db *db)
{
struct passwd_entry *pe = db->entries;
while(!(pe == ((struct passwd_entry *)NULL)))
{
struct passwd_entry *pe_next = pe->next;
xfree_f((void *)pe->name, "passwddb.c", 113);
xfree_f((void *)pe->des, "passwddb.c", 114);
xfree_f((void *)pe, "passwddb.c", 115);
pe = pe_next;
}
xfree_f((void *)db, "passwddb.c", 118);
}
// passwd_db_file_crypt
// file passwddb.c line 172
signed int passwd_db_file_crypt(struct passwd_db *db, const char *fname)
{
signed int return_value_passwd_db_file_int$1;
return_value_passwd_db_file_int$1=passwd_db_file_int(db, fname, 1);
return return_value_passwd_db_file_int$1;
}
// passwd_db_file_int
// file passwddb.c line 75
static signed int passwd_db_file_int(struct passwd_db *db, const char *fname, signed int encrypt_flag)
{
struct _IO_FILE *f;
char buf[1024l];
f=fopen(fname, "r");
char *return_value_fgets$1;
if(f == ((struct _IO_FILE *)NULL))
return -1;
else
{
do
{
return_value_fgets$1=fgets(buf, (signed int)(sizeof(char [1024l]) /*1024ul*/ - (unsigned long int)1), f);
if(return_value_fgets$1 == ((char *)NULL))
break;
struct passwd_entry *pe;
char name[128l];
char des[128l];
char *p;
const char *cp = buf;
p=strchr(buf, 10);
if(!(p == ((char *)NULL)))
*p = (char)0;
get_entry(&cp, name, 128);
get_entry(&cp, des, 128);
void *return_value_xmalloc_f$2;
return_value_xmalloc_f$2=xmalloc_f(sizeof(struct passwd_entry) /*32ul*/ , "passwddb.c", 95);
pe = (struct passwd_entry *)return_value_xmalloc_f$2;
pe->name=xstrdup_f(name, "passwddb.c", 96);
pe->des=xstrdup_f(des, "passwddb.c", 97);
pe->encrypt_flag = encrypt_flag;
pe->next = db->entries;
db->entries = pe;
}
while((_Bool)1);
fclose(f);
return 0;
}
}
// passwd_db_file_plain
// file passwddb.c line 181
signed int passwd_db_file_plain(struct passwd_db *db, const char *fname)
{
signed int return_value_passwd_db_file_int$1;
return_value_passwd_db_file_int$1=passwd_db_file_int(db, fname, 0);
return return_value_passwd_db_file_int$1;
}
// passwd_db_open
// file passwddb.c line 52
struct passwd_db * passwd_db_open(void)
{
struct passwd_db *p;
void *return_value_xmalloc_f$1;
return_value_xmalloc_f$1=xmalloc_f(sizeof(struct passwd_db) /*8ul*/ , "passwddb.c", 54);
p = (struct passwd_db *)return_value_xmalloc_f$1;
p->entries = ((struct passwd_entry *)NULL);
return p;
}
// passwd_db_show
// file passwddb.c line 121
void passwd_db_show(struct passwd_db *db)
{
struct passwd_entry *pe = db->entries;
for( ; !(pe == ((struct passwd_entry *)NULL)); pe = pe->next)
yaz_log(0x00000008, "%s:%s", pe->name, pe->des);
}
// res_add
// file res.c line 445
void res_add(struct res_struct *r, const char *name, const char *value)
{
struct res_entry *re;
/* assertion r */
assert(r != ((struct res_struct *)NULL));
/* assertion name */
assert(name != ((const char *)NULL));
/* assertion value */
assert(value != ((const char *)NULL));
yaz_log(0, "res_add res=%p, name=%s, value=%s", r, name, value);
re=add_entry(r);
re->name=xstrdup_f(name, "res.c", 453);
re->value=xstrdup_env(value);
}
// res_check
// file res.c line 479
signed int res_check(struct res_struct *r_i, struct res_struct *r_v)
{
struct res_entry *e_i;
signed int errors = 0;
e_i = r_i->first;
for( ; !(e_i == ((struct res_entry *)NULL)); e_i = e_i->next)
{
struct res_entry *e_v = r_v->first;
for( ; !(e_v == ((struct res_entry *)NULL)); e_v = e_v->next)
{
signed int prefix_allowed = 0;
signed int suffix_allowed = 0;
const char *name = e_i->name;
unsigned long int name_len;
name_len=strlen(e_i->name);
char namez[32l];
const char *first_dot = ((const char *)NULL);
const char *second_dot = ((const char *)NULL);
char *return_value_strchr$1;
return_value_strchr$1=strchr(e_v->value, 112);
if(!(return_value_strchr$1 == ((char *)NULL)))
prefix_allowed = 1;
char *return_value_strchr$2;
return_value_strchr$2=strchr(e_v->value, 115);
if(!(return_value_strchr$2 == ((char *)NULL)))
suffix_allowed = 1;
first_dot=strchr(name, 46);
if(!(first_dot == ((const char *)NULL)) && !(prefix_allowed == 0))
{
name = first_dot + (signed long int)1;
name_len=strlen(name);
}
second_dot=strchr(name, 46);
if(!(second_dot == ((const char *)NULL)) && !(suffix_allowed == 0))
name_len = (unsigned long int)(second_dot - name);
if(!(name_len >= 31ul))
{
memcpy((void *)namez, (const void *)name, name_len);
namez[(signed long int)name_len] = (char)0;
signed int return_value_yaz_matchstr$3;
return_value_yaz_matchstr$3=yaz_matchstr(namez, e_v->name);
if(return_value_yaz_matchstr$3 == 0)
break;
}
if(second_dot == ((const char *)NULL) && !(first_dot == ((const char *)NULL)) && !(prefix_allowed == 0) && !(suffix_allowed == 0))
{
name = e_i->name;
name_len = (unsigned long int)(first_dot - name);
if(!(name_len >= 31ul))
{
memcpy((void *)namez, (const void *)name, name_len);
namez[(signed long int)name_len] = (char)0;
signed int return_value_yaz_matchstr$4;
return_value_yaz_matchstr$4=yaz_matchstr(namez, e_v->name);
if(return_value_yaz_matchstr$4 == 0)
break;
}
}
}
if(e_v == ((struct res_entry *)NULL))
{
yaz_log(0x00000004, "The following setting is unrecognized: %s", e_i->name);
errors = errors + 1;
}
}
return errors;
}
// res_clear
// file res.c line 246
void res_clear(struct res_struct *r)
{
struct res_entry *re;
struct res_entry *re1;
re = r->first;
for( ; !(re == ((struct res_entry *)NULL)); re = re1)
{
if(!(re->name == ((char *)NULL)))
xfree_f((void *)re->name, "res.c", 252);
if(!(re->value == ((char *)NULL)))
xfree_f((void *)re->value, "res.c", 254);
re1 = re->next;
xfree_f((void *)re, "res.c", 256);
}
r->last = (struct res_entry *)(void *)0;
r->first = r->last;
}
// res_close
// file res.c line 261
void res_close(struct res_struct *r)
{
if(!(r == ((struct res_struct *)NULL)))
{
r->ref_count = r->ref_count - 1;
if(r->ref_count == 0)
{
res_clear(r);
res_close(r->def_res);
res_close(r->over_res);
xfree_f((void *)r, "res.c", 268);
}
}
}
// res_dump
// file res.c line 457
void res_dump(struct res_struct *r, signed int level)
{
struct res_entry *re;
if(!(r == ((struct res_struct *)NULL)))
{
re = r->first;
for( ; !(re == ((struct res_entry *)NULL)); re = re->next)
printf("%*s - %s:='%s'\n", level * 4, (const void *)"", re->name, re->value);
if(!(r->def_res == ((struct res_struct *)NULL)))
{
printf("%*s DEF ", level * 4, (const void *)"");
res_dump(r->def_res, level + 1);
}
if(!(r->over_res == ((struct res_struct *)NULL)))
{
printf("%*s OVER ", level * 4, (const void *)"");
res_dump(r->over_res, level + 1);
}
}
}
// res_get
// file res.c line 294
const char * res_get(struct res_struct *r, const char *name)
{
struct res_entry *re;
const char *v;
signed int return_value_yaz_matchstr$1;
if(r == ((struct res_struct *)NULL))
return ((const char *)NULL);
else
{
v=res_get(r->over_res, name);
if(!(v == ((const char *)NULL)))
return v;
else
{
re = r->first;
for( ; !(re == ((struct res_entry *)NULL)); re = re->next)
if(!(re->value == ((char *)NULL)))
{
return_value_yaz_matchstr$1=yaz_matchstr(re->name, name);
if(return_value_yaz_matchstr$1 == 0)
return re->value;
}
const char *return_value_res_get$2;
return_value_res_get$2=res_get(r->def_res, name);
return return_value_res_get$2;
}
}
}
// res_get_def
// file res.c line 313
const char * res_get_def(struct res_struct *r, const char *name, const char *def)
{
const char *t;
t=res_get(r, name);
if(t == ((const char *)NULL))
{
if(!(def == ((const char *)NULL)))
yaz_log(0x00000002, "Using default resource %s:%s", name, def);
return def;
}
else
return t;
}
// res_get_int
// file res.c line 432
signed short int res_get_int(struct res_struct *r, const char *name, signed int *val)
{
const char *cp;
cp=res_get(r, name);
if(!(cp == ((const char *)NULL)))
{
signed int return_value_sscanf$1;
return_value_sscanf$1=sscanf(cp, "%d", val);
if(return_value_sscanf$1 == 1)
return (signed short int)0;
yaz_log(0x00000004, "Expected integer for resource %s", name);
}
return (signed short int)-1;
}
// res_get_match
// file res.c line 327
signed int res_get_match(struct res_struct *r, const char *name, const char *value, const char *s)
{
const char *cn;
cn=res_get(r, name);
if(cn == ((const char *)NULL))
cn = s;
signed int return_value_yaz_matchstr$1;
if(!(cn == ((const char *)NULL)))
{
return_value_yaz_matchstr$1=yaz_matchstr(cn, value);
if(!(return_value_yaz_matchstr$1 == 0))
goto __CPROVER_DUMP_L2;
return 1;
}
else
{
__CPROVER_DUMP_L2:
;
return 0;
}
}
// res_get_prefix
// file res.c line 272
const char * res_get_prefix(struct res_struct *r, const char *name, const char *prefix, const char *def)
{
const char *v = ((const char *)NULL);
if(!(prefix == ((const char *)NULL)))
{
char rname[128l];
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(name);
unsigned long int return_value_strlen$2;
return_value_strlen$2=strlen(prefix);
if(return_value_strlen$1 + return_value_strlen$2 >= 126ul)
return ((const char *)NULL);
strcpy(rname, prefix);
strcat(rname, ".");
strcat(rname, name);
v=res_get(r, rname);
}
if(v == ((const char *)NULL))
v=res_get(r, name);
if(v == ((const char *)NULL))
v = def;
return v;
}
// res_incref
// file res.c line 53
static struct res_struct * res_incref(struct res_struct *r)
{
if(!(r == ((struct res_struct *)NULL)))
r->ref_count = r->ref_count + 1;
return r;
}
// res_open
// file res.c line 234
struct res_struct * res_open(struct res_struct *def_res, struct res_struct *over_res)
{
struct res_struct *r;
void *return_value_xmalloc_f$1;
return_value_xmalloc_f$1=xmalloc_f(sizeof(struct res_struct) /*40ul*/ , "res.c", 237);
r = (struct res_struct *)return_value_xmalloc_f$1;
r->ref_count = 1;
r->last = (struct res_entry *)(void *)0;
r->first = r->last;
r->def_res=res_incref(def_res);
r->over_res=res_incref(over_res);
return r;
}
// res_read_file
// file res.c line 146
signed short int res_read_file(struct res_struct *r, const char *fname)
{
struct _IO_FILE *fr;
signed int errors = 0;
/* assertion r */
assert(r != ((struct res_struct *)NULL));
fr=fopen(fname, "r");
unsigned long int tmp_post$3;
if(fr == ((struct _IO_FILE *)NULL))
{
yaz_log(0x00000004 | 0x00000010, "Cannot open `%s'", fname);
errors = errors + 1;
}
else
{
char fr_buf[1024l];
char *line;
signed int lineno = 1;
struct wrbuf *wrbuf_val;
wrbuf_val=wrbuf_alloc();
struct yaz_tok_cfg *yt;
yt=yaz_tok_cfg_create();
do
{
line=fgets(fr_buf, (signed int)(sizeof(char [1024l]) /*1024ul*/ - (unsigned long int)1), fr);
if(line == ((char *)NULL))
break;
struct yaz_tok_parse *tp;
tp=yaz_tok_parse_buf(yt, line);
signed int t;
t=yaz_tok_move(tp);
if(t == -2)
{
unsigned long int sz;
struct res_entry *resp;
const char *cp;
cp=yaz_tok_parse_string(tp);
const char *cp1;
cp1=strchr(cp, 58);
if(cp1 == ((const char *)NULL))
{
yaz_log(0x00000001, "%s:%d missing colon after '%s'", fname, lineno, cp);
errors = errors + 1;
break;
}
resp=add_entry(r);
sz = (unsigned long int)(cp1 - cp);
void *return_value_xmalloc_f$1;
return_value_xmalloc_f$1=xmalloc_f(sz + (unsigned long int)1, "res.c", 188);
resp->name = (char *)return_value_xmalloc_f$1;
memcpy((void *)resp->name, (const void *)cp, sz);
resp->name[(signed long int)sz] = (char)0;
wrbuf_rewind(wrbuf_val);
if(!(cp1[1l] == 0))
wrbuf_puts(wrbuf_val, cp1 + (signed long int)1);
else
{
t=yaz_tok_move(tp);
if(!(t == -2))
{
resp->value=xstrdup_f("", "res.c", 206);
yaz_log(0x00000001, "%s:%d missing value after '%s'", fname, lineno, resp->name);
errors = errors + 1;
break;
}
const char *return_value_yaz_tok_parse_string$2;
return_value_yaz_tok_parse_string$2=yaz_tok_parse_string(tp);
wrbuf_puts(wrbuf_val, return_value_yaz_tok_parse_string$2);
}
do
{
t=yaz_tok_move(tp);
if(!(t == -2))
break;
if(wrbuf_val->pos >= wrbuf_val->size)
wrbuf_grow(wrbuf_val, (unsigned long int)1);
else
0;
tmp_post$3 = wrbuf_val->pos;
wrbuf_val->pos = wrbuf_val->pos + 1ul;
wrbuf_val->buf[(signed long int)tmp_post$3] = (char)32;
0;
const char *return_value_yaz_tok_parse_string$4;
return_value_yaz_tok_parse_string$4=yaz_tok_parse_string(tp);
wrbuf_puts(wrbuf_val, return_value_yaz_tok_parse_string$4);
}
while((_Bool)1);
const char *return_value_wrbuf_cstr$5;
return_value_wrbuf_cstr$5=wrbuf_cstr(wrbuf_val);
resp->value=xstrdup_env(return_value_wrbuf_cstr$5);
}
lineno = lineno + 1;
yaz_tok_parse_destroy(tp);
}
while((_Bool)1);
fclose(fr);
yaz_tok_cfg_destroy(yt);
wrbuf_destroy(wrbuf_val);
}
if(!(errors == 0))
return (signed short int)-1;
else
return (signed short int)0;
}
// res_set
// file res.c line 338
void res_set(struct res_struct *r, const char *name, const char *value)
{
struct res_entry *re;
/* assertion r */
assert(r != ((struct res_struct *)NULL));
signed int return_value_yaz_matchstr$1;
if(!(value == ((const char *)NULL)))
{
re = r->first;
for( ; !(re == ((struct res_entry *)NULL)); re = re->next)
if(!(re->value == ((char *)NULL)))
{
return_value_yaz_matchstr$1=yaz_matchstr(re->name, name);
if(return_value_yaz_matchstr$1 == 0)
{
xfree_f((void *)re->value, "res.c", 348);
re->value=xstrdup_env(value);
goto __CPROVER_DUMP_L5;
}
}
re=add_entry(r);
re->name=xstrdup_f(name, "res.c", 353);
re->value=xstrdup_env(value);
}
__CPROVER_DUMP_L5:
;
}
// res_trav
// file res.c line 357
signed int res_trav(struct res_struct *r, const char *prefix, void *p, void (*f)(void *, const char *, const char *))
{
struct res_entry *re;
signed int l = 0;
signed int no = 0;
unsigned long int return_value_strlen$1;
_Bool tmp_if_expr$3;
signed int return_value_memcmp$2;
signed int return_value_res_trav$4;
if(r == ((struct res_struct *)NULL))
return 0;
else
{
no=res_trav(r->over_res, prefix, p, f);
if(!(no == 0))
return no;
else
{
if(!(prefix == ((const char *)NULL)))
{
return_value_strlen$1=strlen(prefix);
l = (signed int)return_value_strlen$1;
}
re = r->first;
for( ; !(re == ((struct res_entry *)NULL)); re = re->next)
if(!(re->value == ((char *)NULL)))
{
if(l == 0)
tmp_if_expr$3 = (_Bool)1;
else
{
return_value_memcmp$2=memcmp((const void *)re->name, (const void *)prefix, (unsigned long int)l);
tmp_if_expr$3 = !(return_value_memcmp$2 != 0) ? (_Bool)1 : (_Bool)0;
}
if(tmp_if_expr$3)
{
f(p, re->name, re->value);
no = no + 1;
}
}
if(no == 0)
{
return_value_res_trav$4=res_trav(r->def_res, prefix, p, f);
return return_value_res_trav$4;
}
else
return no;
}
}
}
// res_write_file
// file res.c line 384
signed short int res_write_file(struct res_struct *r, const char *fname)
{
struct res_entry *re;
struct _IO_FILE *fr;
/* assertion r */
assert(r != ((struct res_struct *)NULL));
fr=fopen(fname, "w");
unsigned long int return_value_strlen$2;
if(fr == ((struct _IO_FILE *)NULL))
{
yaz_log(0x00000001 | 0x00000010, "Cannot create `%s'", fname);
return (signed short int)-1;
}
else
{
re = r->first;
for( ; !(re == ((struct res_entry *)NULL)); re = re->next)
{
signed int no = 0;
signed int lefts;
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(re->name);
lefts = (signed int)(return_value_strlen$1 + (unsigned long int)2);
if(re->value == ((char *)NULL))
fprintf(fr, "%s\n", re->name);
else
{
fprintf(fr, "%s: ", re->name);
do
{
return_value_strlen$2=strlen(re->value + (signed long int)no);
if(!(return_value_strlen$2 + (unsigned long int)lefts >= 79ul))
break;
signed int i = 20;
signed int ind = (no + 78) - lefts;
do
{
i = i - 1;
if(!(i >= 0))
break;
if((signed int)re->value[(signed long int)ind] == 32)
break;
ind = ind - 1;
}
while((_Bool)1);
if(!(i >= 0))
ind = (no + 78) - lefts;
i = no;
for( ; !(i == ind); i = i + 1)
_IO_putc((signed int)re->value[(signed long int)i], fr);
fprintf(fr, "\\\n");
no = ind;
lefts = 0;
}
while((_Bool)1);
fprintf(fr, "%s\n", re->value + (signed long int)no);
}
}
fclose(fr);
return (signed short int)0;
}
}
// run_func
// file tstflock.c line 98
void * run_func(void *arg)
{
signed int i;
signed int *pdata = (signed int *)arg;
signed int use_write_lock = *pdata;
struct zebra_lock_handle *lh;
lh=zebra_lock_create(((const char *)NULL), "my.LCK");
i = 0;
signed int return_value_rand$1;
char *tmp_post$2;
char *tmp_post$3;
char *tmp_post$4;
char *tmp_post$5;
for( ; !(i >= 2); i = i + 1)
{
signed int write_lock = use_write_lock;
if(use_write_lock == 2)
{
return_value_rand$1=rand();
write_lock = (return_value_rand$1 & 3) == 3 ? 1 : 0;
}
if(!(write_lock == 0))
{
zebra_lock_w(lh);
write(test_fd, (const void *)"L", (unsigned long int)1);
tmp_post$2 = seqp;
seqp = seqp + 1l;
*tmp_post$2 = (char)76;
small_sleep();
tmp_post$3 = seqp;
seqp = seqp + 1l;
*tmp_post$3 = (char)85;
write(test_fd, (const void *)"U", (unsigned long int)1);
zebra_unlock(lh);
}
else
{
zebra_lock_r(lh);
write(test_fd, (const void *)"l", (unsigned long int)1);
tmp_post$4 = seqp;
seqp = seqp + 1l;
*tmp_post$4 = (char)108;
small_sleep();
tmp_post$5 = seqp;
seqp = seqp + 1l;
*tmp_post$5 = (char)117;
write(test_fd, (const void *)"u", (unsigned long int)1);
zebra_unlock(lh);
}
}
zebra_lock_destroy(lh);
*pdata = 123;
return NULL;
}
// scan_string
// file charmap.c line 421
static signed int scan_string(char *s_native, struct yaz_iconv_struct *t_unicode, struct yaz_iconv_struct *t_utf8, void (*fun)(const char *, void *, signed int), void *data, signed int *num)
{
char str[1024l];
unsigned int arg[512l];
unsigned int arg_prim[512l];
unsigned int *s = arg;
unsigned int c;
unsigned int begin;
unsigned int end;
unsigned long int i;
if(!(t_unicode == ((struct yaz_iconv_struct *)NULL)))
{
char *outbuf = (char *)arg;
char *inbuf = s_native;
unsigned long int outbytesleft = sizeof(unsigned int [512l]) /*2048ul*/ - (unsigned long int)4;
unsigned long int inbytesleft;
inbytesleft=strlen(s_native);
unsigned long int ret;
ret=yaz_iconv(t_unicode, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
if(!(ret == 18446744073709551615ul))
ret=yaz_iconv(t_unicode, ((char **)NULL), ((unsigned long int *)NULL), &outbuf, &outbytesleft);
if(ret == 18446744073709551615ul)
return -1;
i = (unsigned long int)(outbuf - (char *)arg) / sizeof(unsigned int) /*4ul*/ ;
}
else
{
i = (unsigned long int)0;
for( ; !(s_native[(signed long int)i] == 0); i = i + 1ul)
arg[(signed long int)i] = (unsigned int)((signed int)s_native[(signed long int)i] & 255);
}
arg[(signed long int)i] = (unsigned int)0;
_Bool tmp_if_expr$1;
if(*s == 65279u)
tmp_if_expr$1 = (_Bool)1;
else
tmp_if_expr$1 = s[(signed long int)0] == (unsigned int)0xfeff ? (_Bool)1 : (_Bool)0;
if(tmp_if_expr$1)
s = s + 1l;
signed int tmp_if_expr$4;
signed int tmp_post$3;
unsigned long int tmp_post$5;
signed int return_value_zebra_ucs4_strlen$6;
signed int return_value_scan_to_utf8$7;
signed int tmp_if_expr$9;
signed int tmp_post$8;
signed int return_value_scan_to_utf8$10;
signed int tmp_if_expr$12;
signed int tmp_post$11;
while(!(*s == 0u))
switch(*s)
{
case (unsigned int)123:
{
s = s + 1l;
begin=zebra_prim_w(&s);
if(!(*s == 45u))
{
yaz_log(0x00000001, "Bad range in char-map");
return -1;
}
s = s + 1l;
end=zebra_prim_w(&s);
if(begin >= end)
{
yaz_log(0x00000001, "Bad range in char-map");
return -1;
}
s = s + 1l;
c = begin;
if(end >= c)
{
signed int return_value_scan_to_utf8$2;
return_value_scan_to_utf8$2=scan_to_utf8(t_utf8, &c, (unsigned long int)1, str, sizeof(char [1024l]) /*1024ul*/ - (unsigned long int)1);
if(!(return_value_scan_to_utf8$2 == 0))
return -1;
if(!(num == ((signed int *)NULL)))
{
tmp_post$3 = *num;
*num = *num + 1;
tmp_if_expr$4 = tmp_post$3;
}
else
tmp_if_expr$4 = 0;
fun(str, data, tmp_if_expr$4);
c = c + 1u;
}
break;
}
case (unsigned int)40:
{
s = s + 1l;
i = (unsigned long int)0;
while((_Bool)1)
{
if(*s == 41u)
{
if(!(s[-1l] == 92u))
goto __CPROVER_DUMP_L21;
}
if(*s == 0u)
{
yaz_log(0x00000001, "Missing ) in charmap");
return -1;
}
tmp_post$5 = i;
i = i + 1ul;
arg_prim[(signed long int)tmp_post$5]=zebra_prim_w(&s);
}
__CPROVER_DUMP_L21:
;
arg_prim[(signed long int)i] = (unsigned int)0;
return_value_zebra_ucs4_strlen$6=zebra_ucs4_strlen(arg_prim);
return_value_scan_to_utf8$7=scan_to_utf8(t_utf8, arg_prim, (unsigned long int)return_value_zebra_ucs4_strlen$6, str, sizeof(char [1024l]) /*1024ul*/ - (unsigned long int)1);
if(!(return_value_scan_to_utf8$7 == 0))
return -1;
if(!(num == ((signed int *)NULL)))
{
tmp_post$8 = *num;
*num = *num + 1;
tmp_if_expr$9 = tmp_post$8;
}
else
tmp_if_expr$9 = 0;
fun(str, data, tmp_if_expr$9);
}
default:
{
c=zebra_prim_w(&s);
return_value_scan_to_utf8$10=scan_to_utf8(t_utf8, &c, (unsigned long int)1, str, sizeof(char [1024l]) /*1024ul*/ - (unsigned long int)1);
if(!(return_value_scan_to_utf8$10 == 0))
return -1;
if(!(num == ((signed int *)NULL)))
{
tmp_post$11 = *num;
*num = *num + 1;
tmp_if_expr$12 = tmp_post$11;
}
else
tmp_if_expr$12 = 0;
fun(str, data, tmp_if_expr$12);
}
}
return 0;
}
// scan_to_utf8
// file charmap.c line 393
static signed int scan_to_utf8(struct yaz_iconv_struct *t, unsigned int *from, unsigned long int inlen, char *outbuf, unsigned long int outbytesleft)
{
unsigned long int inbytesleft = inlen * sizeof(unsigned int) /*4ul*/ ;
char *inbuf = (char *)from;
unsigned long int ret;
char *tmp_post$1;
if(t == ((struct yaz_iconv_struct *)NULL))
{
tmp_post$1 = outbuf;
outbuf = outbuf + 1l;
*tmp_post$1 = (char)*from;
}
else
{
ret=yaz_iconv(t, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
if(!(ret == 18446744073709551615ul))
ret=yaz_iconv(t, ((char **)NULL), ((unsigned long int *)NULL), &outbuf, &outbytesleft);
if(ret == 18446744073709551615ul)
{
yaz_log(0x00000008, "from: %2X %2X %2X %2X", from[(signed long int)0], from[(signed long int)1], from[(signed long int)2], from[(signed long int)3]);
yaz_log(0x00000004 | 0x00000010, "bad unicode sequence");
return -1;
}
}
*outbuf = (char)0;
return 0;
}
// set_map_string
// file charmap.c line 92
static struct chr_t_entry * set_map_string(struct chr_t_entry *root, struct nmem_control *nmem, const char *from, signed int len, char *to, const char *from_0)
{
if(from_0 == ((const char *)NULL))
from_0 = from;
if(root == ((struct chr_t_entry *)NULL))
{
void *return_value_nmem_malloc$1;
return_value_nmem_malloc$1=nmem_malloc(nmem, sizeof(struct chr_t_entry) /*16ul*/ );
root = (struct chr_t_entry *)return_value_nmem_malloc$1;
root->children = ((struct chr_t_entry **)NULL);
root->target = ((unsigned char **)NULL);
}
_Bool tmp_if_expr$5;
_Bool tmp_if_expr$7;
signed int return_value_strcmp$6;
signed int return_value_strcmp$2;
if(len == 0)
{
if(root->target == ((unsigned char **)NULL))
tmp_if_expr$5 = (_Bool)1;
else
tmp_if_expr$5 = !(root->target[(signed long int)0] != ((unsigned char *)NULL)) ? (_Bool)1 : (_Bool)0;
if(tmp_if_expr$5)
tmp_if_expr$7 = (_Bool)1;
else
{
return_value_strcmp$6=strcmp((const char *)root->target[(signed long int)0], to);
tmp_if_expr$7 = return_value_strcmp$6 != 0 ? (_Bool)1 : (_Bool)0;
}
if(tmp_if_expr$7)
{
if(!(from_0 == ((const char *)NULL)))
{
if(!(root->target == ((unsigned char **)NULL)))
{
if(!(*root->target == ((unsigned char *)NULL)))
{
if(!(*(*root->target) == 0))
{
return_value_strcmp$2=strcmp((const char *)root->target[(signed long int)0], CHR_UNKNOWN);
if(!(return_value_strcmp$2 == 0))
yaz_log(0x00000004, "duplicate entry for charmap from '%s'", from_0);
}
}
}
}
void *return_value_nmem_malloc$3;
return_value_nmem_malloc$3=nmem_malloc(nmem, sizeof(unsigned char *) /*8ul*/ * (unsigned long int)2);
root->target = (unsigned char **)return_value_nmem_malloc$3;
char *return_value_nmem_strdup$4;
return_value_nmem_strdup$4=nmem_strdup(nmem, to);
root->target[(signed long int)0] = (unsigned char *)return_value_nmem_strdup$4;
root->target[(signed long int)1] = ((unsigned char *)NULL);
}
}
else
{
if(root->children == ((struct chr_t_entry **)NULL))
{
signed int i;
void *return_value_nmem_malloc$8;
return_value_nmem_malloc$8=nmem_malloc(nmem, sizeof(struct chr_t_entry *) /*8ul*/ * (unsigned long int)256);
root->children = (struct chr_t_entry **)return_value_nmem_malloc$8;
i = 0;
for( ; !(i >= 256); i = i + 1)
root->children[(signed long int)i] = ((struct chr_t_entry *)NULL);
}
root->children[(signed long int)(unsigned char)*from]=set_map_string(root->children[(signed long int)(unsigned char)*from], nmem, from + (signed long int)1, len - 1, to, from_0);
if(root->children[(signed long int)(unsigned char)*from] == ((struct chr_t_entry *)NULL))
return ((struct chr_t_entry *)NULL);
}
return root;
}
// small_sleep
// file tstflock.c line 74
static void small_sleep(void)
{
struct timespec abstime;
struct timeval now;
gettimeofday(&now, ((struct timezone *)NULL));
abstime.tv_sec = now.tv_sec;
abstime.tv_nsec = (signed long int)1000000 + now.tv_usec * (signed long int)1000;
if(abstime.tv_nsec >= 1000000001l)
{
abstime.tv_nsec = abstime.tv_nsec - (signed long int)1000000000;
abstime.tv_sec = abstime.tv_sec + 1l;
}
pthread_mutex_lock(&sleep_mutex);
pthread_cond_timedwait(&sleep_cond, &sleep_mutex, &abstime);
pthread_mutex_unlock(&sleep_mutex);
}
// tokenize_simple
// file zebramap.c line 628
static signed int tokenize_simple(struct zebra_map *zm, const char **result_buf, unsigned long int *result_len)
{
char *buf = zm->input_str->buf;
unsigned long int len = zm->input_str->pos;
unsigned long int i = zm->simple_off;
unsigned long int start;
char *return_value_strchr$1;
for( ; !(i >= len); i = i + 1ul)
{
return_value_strchr$1=strchr(";,.()-/?<> \r\n\t", (signed int)buf[(signed long int)i]);
if(return_value_strchr$1 == ((char *)NULL))
break;
}
start = i;
char *return_value_strchr$2;
signed int return_value_tolower$3;
while(!(i >= len))
{
return_value_strchr$2=strchr(";,.()-/?<> \r\n\t", (signed int)buf[(signed long int)i]);
if(!(return_value_strchr$2 == ((char *)NULL)))
break;
if((signed int)buf[(signed long int)i] >= 33)
{
if(!((signed int)buf[(signed long int)i] >= 127))
{
return_value_tolower$3=tolower((signed int)buf[(signed long int)i]);
buf[(signed long int)i] = (char)return_value_tolower$3;
}
}
i = i + 1ul;
}
zm->simple_off = i;
if(!(start == i))
{
*result_buf = buf + (signed long int)start;
*result_len = i - start;
return 1;
}
else
return 0;
}
// tst
// file tstflock.c line 197
static void tst(void)
{
tst_thread(4, 1);
{
signed int i = 0;
for( ; !(seq[(signed long int)i] == 0); i = i + 2)
{
signed int tst$$1$$1$$1$$1$$lval = (signed int)seq[(signed long int)i];
signed int rval = 76;
if(tst$$1$$1$$1$$1$$lval == rval)
yaz_check_eq1(1, "tstflock.c", 205, "seq[i]", "'L'", tst$$1$$1$$1$$1$$lval, rval);
else
yaz_check_eq1(2, "tstflock.c", 205, "seq[i]", "'L'", tst$$1$$1$$1$$1$$lval, rval);
signed int lval = (signed int)seq[(signed long int)(i + 1)];
signed int tst$$1$$1$$1$$2$$rval = 85;
if(lval == tst$$1$$1$$1$$2$$rval)
yaz_check_eq1(1, "tstflock.c", 206, "seq[i+1]", "'U'", lval, tst$$1$$1$$1$$2$$rval);
else
yaz_check_eq1(2, "tstflock.c", 206, "seq[i+1]", "'U'", lval, tst$$1$$1$$1$$2$$rval);
}
}
tst_thread(6, 0);
tst_thread(20, 2);
}
// tst_thread
// file tstflock.c line 149
static void tst_thread(signed int num, signed int write_flag)
{
unsigned long int child_thread[100l];
signed int i;
signed int id[100l];
seqp = seq;
/* assertion num <= 100 */
assert(num <= 100);
i = 0;
for( ; !(i >= num); i = i + 1)
{
id[(signed long int)i] = write_flag;
pthread_create(&child_thread[(signed long int)i], ((const union pthread_attr_t *)NULL), run_func, (void *)&id[(signed long int)i]);
}
i = 0;
for( ; !(i >= num); i = i + 1)
pthread_join(child_thread[(signed long int)i], ((void **)NULL));
i = 0;
for( ; !(i >= num); i = i + 1)
if(id[(signed long int)i] == 123)
yaz_check_print1(1, "tstflock.c", 191, "id[i] == 123");
else
yaz_check_print1(2, "tstflock.c", 191, "id[i] == 123");
char *tmp_post$1 = seqp;
seqp = seqp + 1l;
*tmp_post$1 = (char)0;
yaz_log(0x00000008, "tst_thread(%d,%d) returns seq=%s", num, write_flag, (const void *)seq);
}
// unixLock
// file flock.c line 232
static signed int unixLock(signed int fd, signed int type, signed int cmd)
{
struct flock area;
signed int r;
area.l_type = (signed short int)type;
area.l_whence = (signed short int)0;
area.l_start = 0L;
area.l_len = area.l_start;
yaz_log(log_level, "fcntl begin type=%d fd=%d", type, fd);
r=fcntl(fd, cmd, &area);
if(r == -1)
yaz_log(0x00000004 | 0x00000010, "fcntl FAIL type=%d fd=%d", type, fd);
else
yaz_log(log_level, "fcntl type=%d OK fd=%d", type, fd);
return r;
}
// xstrdup_env
// file res.c line 77
static char * xstrdup_env(const char *src)
{
signed int i = 0;
signed int j = 0;
char *dst;
signed int env_strlen = 0;
_Bool tmp_if_expr$6;
char *return_value_strchr$1;
signed int tmp_post$2;
signed int tmp_post$3;
unsigned long int return_value_strlen$4;
char *return_value_strchr$5;
while(!(src[(signed long int)i] == 0))
{
if((signed int)src[(signed long int)i] == 36)
tmp_if_expr$6 = (signed int)src[(signed long int)(i + 1)] == 123 ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$6 = (_Bool)0;
if(tmp_if_expr$6)
{
char envname[128l];
char *env_val;
signed int k = 0;
i = i + 2;
for( ; !(k >= 127); envname[(signed long int)tmp_post$2] = src[(signed long int)tmp_post$3])
{
if(src[(signed long int)i] == 0)
break;
return_value_strchr$1=strchr(":}\n\r\f", (signed int)src[(signed long int)i]);
if(!(return_value_strchr$1 == ((char *)NULL)))
break;
tmp_post$2 = k;
k = k + 1;
tmp_post$3 = i;
i = i + 1;
}
envname[(signed long int)k] = (char)0;
env_val=getenv(envname);
if(!(env_val == ((char *)NULL)))
{
return_value_strlen$4=strlen(env_val);
env_strlen = env_strlen + (signed int)((unsigned long int)1 + return_value_strlen$4);
}
else
env_strlen = env_strlen + 1;
for( ; !(src[(signed long int)i] == 0); i = i + 1)
{
return_value_strchr$5=strchr("}\n\r\f", (signed int)src[(signed long int)i]);
if(!(return_value_strchr$5 == ((char *)NULL)))
break;
}
if((signed int)src[(signed long int)i] == 125)
i = i + 1;
}
else
i = i + 1;
}
void *return_value_xmalloc_f$7;
return_value_xmalloc_f$7=xmalloc_f((unsigned long int)(1 + env_strlen + i), "res.c", 109);
dst = (char *)return_value_xmalloc_f$7;
i = 0;
_Bool tmp_if_expr$18;
char *return_value_strchr$8;
signed int tmp_post$9;
signed int tmp_post$10;
char *return_value_strchr$12;
signed int tmp_post$13;
signed int tmp_post$14;
char *return_value_strchr$15;
signed int tmp_post$16;
signed int tmp_post$17;
while(!(src[(signed long int)i] == 0))
{
if((signed int)src[(signed long int)i] == 36)
tmp_if_expr$18 = (signed int)src[(signed long int)(i + 1)] == 123 ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$18 = (_Bool)0;
if(tmp_if_expr$18)
{
char xstrdup_env$$1$$2$$1$$envname[128l];
char *xstrdup_env$$1$$2$$1$$env_val;
signed int xstrdup_env$$1$$2$$1$$k = 0;
i = i + 2;
for( ; !(xstrdup_env$$1$$2$$1$$k >= 127); xstrdup_env$$1$$2$$1$$envname[(signed long int)tmp_post$9] = src[(signed long int)tmp_post$10])
{
if(src[(signed long int)i] == 0)
break;
return_value_strchr$8=strchr(":}\n\r\f", (signed int)src[(signed long int)i]);
if(!(return_value_strchr$8 == ((char *)NULL)))
break;
tmp_post$9 = xstrdup_env$$1$$2$$1$$k;
xstrdup_env$$1$$2$$1$$k = xstrdup_env$$1$$2$$1$$k + 1;
tmp_post$10 = i;
i = i + 1;
}
xstrdup_env$$1$$2$$1$$envname[(signed long int)xstrdup_env$$1$$2$$1$$k] = (char)0;
xstrdup_env$$1$$2$$1$$env_val=getenv(xstrdup_env$$1$$2$$1$$envname);
if(!(xstrdup_env$$1$$2$$1$$env_val == ((char *)NULL)))
{
strcpy(dst + (signed long int)j, xstrdup_env$$1$$2$$1$$env_val);
unsigned long int return_value_strlen$11;
return_value_strlen$11=strlen(xstrdup_env$$1$$2$$1$$env_val);
j = j + (signed int)return_value_strlen$11;
}
else
if((signed int)src[(signed long int)i] == 58)
{
if((signed int)src[(signed long int)(1 + i)] == 45)
{
i = i + 2;
for( ; !(src[(signed long int)i] == 0); dst[(signed long int)tmp_post$13] = src[(signed long int)tmp_post$14])
{
return_value_strchr$12=strchr("}\n\r\f", (signed int)src[(signed long int)i]);
if(!(return_value_strchr$12 == ((char *)NULL)))
break;
tmp_post$13 = j;
j = j + 1;
tmp_post$14 = i;
i = i + 1;
}
}
}
for( ; !(src[(signed long int)i] == 0); i = i + 1)
{
return_value_strchr$15=strchr("}\n\r\f", (signed int)src[(signed long int)i]);
if(!(return_value_strchr$15 == ((char *)NULL)))
break;
}
if((signed int)src[(signed long int)i] == 125)
i = i + 1;
}
else
{
tmp_post$16 = j;
j = j + 1;
tmp_post$17 = i;
i = i + 1;
dst[(signed long int)tmp_post$16] = src[(signed long int)tmp_post$17];
}
}
dst[(signed long int)j] = (char)0;
return dst;
}
// zebra_add_map
// file zebramap.c line 106
struct zebra_map * zebra_add_map(struct zebra_maps_s *zms, const char *index_type, signed int map_type)
{
struct zebra_map *zm;
void *return_value_nmem_malloc$1;
return_value_nmem_malloc$1=nmem_malloc(zms->nmem, sizeof(struct zebra_map) /*112ul*/ );
zm = (struct zebra_map *)return_value_nmem_malloc$1;
zm->zebra_maps = zms;
zm->id=nmem_strdup(zms->nmem, index_type);
zm->maptab_name = ((const char *)NULL);
zm->use_chain = 0;
zm->debug = 0;
zm->maptab = ((struct chrmaptab_info *)NULL);
zm->type = map_type;
zm->completeness = 0;
zm->positioned = 0;
zm->alwaysmatches = 0;
zm->first_in_field = 0;
if(!(zms->last_map == ((struct zebra_map *)NULL)))
zms->last_map->next = zm;
else
zms->map_list = zm;
zms->last_map = zm;
zm->next = ((struct zebra_map *)NULL);
zm->icu_chain = ((struct icu_chain *)NULL);
zm->doc = ((struct _xmlDoc *)NULL);
zm->input_str=wrbuf_alloc();
zm->print_str=wrbuf_alloc();
return zm;
}
// zebra_charmap_get
// file zebramap.c line 381
struct chrmaptab_info * zebra_charmap_get(struct zebra_map *zm)
{
_Bool tmp_if_expr$2;
signed int return_value_yaz_matchstr$1;
if(zm->maptab == ((struct chrmaptab_info *)NULL))
{
if(zm->maptab_name == ((const char *)NULL))
tmp_if_expr$2 = (_Bool)1;
else
{
return_value_yaz_matchstr$1=yaz_matchstr(zm->maptab_name, "@");
tmp_if_expr$2 = !(return_value_yaz_matchstr$1 != 0) ? (_Bool)1 : (_Bool)0;
}
if(tmp_if_expr$2)
return (struct chrmaptab_info *)(void *)0;
zm->maptab=chrmaptab_create(zm->zebra_maps->tabpath, zm->maptab_name, zm->zebra_maps->tabroot);
if(zm->maptab == ((struct chrmaptab_info *)NULL))
yaz_log(0x00000004, "Failed to read character table %s", zm->maptab_name);
else
yaz_log(0x00000002, "Read character table %s", zm->maptab_name);
}
return zm->maptab;
}
// zebra_exit
// file exit.c line 26
void zebra_exit(const char *msg)
{
yaz_log(0x00000008, "%s: exit", msg);
exit(1);
}
// zebra_flock_init
// file ../include/idzebra/flock.h line 46
void zebra_flock_init(void)
{
if(initialized == 0)
{
initialized = 1;
log_level=yaz_log_module_level("flock");
yaz_log(log_level, "zebra_flock_init");
check_for_linuxthreads();
zebra_mutex_init(&lock_list_mutex);
yaz_log(log_level, "posix_locks: %d", posix_locks);
}
}
// zebra_get_version
// file version.c line 33
void zebra_get_version(char *version_str, char *sha1_str)
{
if(!(version_str == ((char *)NULL)))
strcpy(version_str, "2.0.59");
if(!(sha1_str == ((char *)NULL)))
strcpy(sha1_str, "c00bfddbf0f3608340d61298acc61dafb167f9b2");
}
// zebra_lock_create
// file ../include/idzebra/flock.h line 30
struct zebra_lock_handle * zebra_lock_create(const char *dir, const char *name)
{
char *fname;
fname=zebra_mk_fname(dir, name);
struct zebra_lock_info *p = ((struct zebra_lock_info *)NULL);
struct zebra_lock_handle *h = ((struct zebra_lock_handle *)NULL);
/* assertion initialized */
assert(initialized != 0);
zebra_mutex_lock(&lock_list_mutex);
signed int return_value_strcmp$1;
if(!(posix_locks == 0))
{
p = lock_list;
for( ; !(p == ((struct zebra_lock_info *)NULL)); p = p->next)
{
return_value_strcmp$1=strcmp(p->fname, fname);
if(return_value_strcmp$1 == 0)
break;
}
}
if(p == ((struct zebra_lock_info *)NULL))
{
void *return_value_xmalloc_f$2;
return_value_xmalloc_f$2=xmalloc_f(sizeof(struct zebra_lock_info) /*184ul*/ , "flock.c", 137);
p = (struct zebra_lock_info *)return_value_xmalloc_f$2;
p->ref_count = 0;
p->fd=open(fname, 0 | 0100 | 02, 0666);
if(p->fd == -1)
{
xfree_f((void *)p, "flock.c", 149);
yaz_log(0x00000004 | 0x00000010, "zebra_lock_create fail fname=%s", fname);
p = ((struct zebra_lock_info *)NULL);
}
else
{
p->fname = fname;
fname = ((char *)NULL);
if(!(posix_locks == 0))
zebra_lock_rdwr_init(&p->rdwr_lock);
zebra_mutex_init(&p->file_mutex);
p->no_file_write_lock = 0;
p->no_file_read_lock = 0;
p->next = lock_list;
lock_list = p;
}
}
if(!(p == ((struct zebra_lock_info *)NULL)))
{
p->ref_count = p->ref_count + 1;
void *return_value_xmalloc_f$3;
return_value_xmalloc_f$3=xmalloc_f(sizeof(struct zebra_lock_handle) /*16ul*/ , "flock.c", 174);
h = (struct zebra_lock_handle *)return_value_xmalloc_f$3;
h->p = p;
h->write_flag = 0;
yaz_log(log_level, "zebra_lock_create fd=%d p=%p fname=%s", h->p->fd, h, p->fname);
}
zebra_mutex_unlock(&lock_list_mutex);
xfree_f((void *)fname, "flock.c", 183);
return h;
}
// zebra_lock_destroy
// file ../include/idzebra/flock.h line 33
void zebra_lock_destroy(struct zebra_lock_handle *h)
{
if(!(h == ((struct zebra_lock_handle *)NULL)))
{
yaz_log(log_level, "zebra_lock_destroy fd=%d p=%p fname=%s", h->p->fd, h, h->p->fname);
zebra_mutex_lock(&lock_list_mutex);
yaz_log(log_level, "zebra_lock_destroy fd=%d p=%p fname=%s refcount=%d", h->p->fd, h, h->p->fname, h->p->ref_count);
/* assertion h->p->ref_count > 0 */
assert(h->p->ref_count > 0);
h->p->ref_count = h->p->ref_count - 1;
if(h->p->ref_count == 0)
{
struct zebra_lock_info **hp = &lock_list;
while(!(*hp == ((struct zebra_lock_info *)NULL)))
if(*hp == h->p)
{
*hp = h->p->next;
break;
}
else
hp = &(*hp)->next;
yaz_log(log_level, "zebra_lock_destroy fd=%d p=%p fname=%s remove", h->p->fd, h, h->p->fname);
if(!(posix_locks == 0))
zebra_lock_rdwr_destroy(&h->p->rdwr_lock);
zebra_mutex_destroy(&h->p->file_mutex);
if(!(h->p->fd == -1))
close(h->p->fd);
xfree_f((void *)h->p->fname, "flock.c", 224);
xfree_f((void *)h->p, "flock.c", 225);
}
xfree_f((void *)h, "flock.c", 227);
zebra_mutex_unlock(&lock_list_mutex);
}
}
// zebra_lock_r
// file ../include/idzebra/flock.h line 43
signed int zebra_lock_r(struct zebra_lock_handle *h)
{
signed int r = 0;
signed int do_lock = 0;
yaz_log(log_level, "zebra_lock_r fd=%d p=%p fname=%s begin", h->p->fd, h, h->p->fname);
if(!(posix_locks == 0))
zebra_lock_rdwr_rlock(&h->p->rdwr_lock);
zebra_mutex_lock(&h->p->file_mutex);
if(h->p->no_file_read_lock == 0)
{
if(h->p->no_file_write_lock == 0)
do_lock = 1;
}
h->p->no_file_read_lock = h->p->no_file_read_lock + 1;
if(!(do_lock == 0))
r=unixLock(h->p->fd, 0, 7);
else
/* assertion posix_locks */
assert(posix_locks != 0);
zebra_mutex_unlock(&h->p->file_mutex);
h->write_flag = 0;
yaz_log(log_level, "zebra_lock_r fd=%d p=%p fname=%s end", h->p->fd, h, h->p->fname);
return r;
}
// zebra_lock_rdwr_destroy
// file zebra-lock.c line 100
signed int zebra_lock_rdwr_destroy(struct anonymous$56 *p)
{
/* assertion p->readers_reading == 0 */
assert(p->readers_reading == 0);
/* assertion p->writers_writing == 0 */
assert(p->writers_writing == 0);
pthread_mutex_destroy(&p->mutex);
pthread_cond_destroy(&p->lock_free);
return 0;
}
// zebra_lock_rdwr_init
// file zebra-lock.c line 89
signed int zebra_lock_rdwr_init(struct anonymous$56 *p)
{
p->readers_reading = 0;
p->writers_writing = 0;
pthread_mutex_init(&p->mutex, ((const union anonymous$53 *)NULL));
pthread_cond_init(&p->lock_free, ((const union anonymous$53 *)NULL));
return 0;
}
// zebra_lock_rdwr_rlock
// file zebra-lock.c line 111
signed int zebra_lock_rdwr_rlock(struct anonymous$56 *p)
{
pthread_mutex_lock(&p->mutex);
while(!(p->writers_writing == 0))
pthread_cond_wait(&p->lock_free, &p->mutex);
p->readers_reading = p->readers_reading + 1;
pthread_mutex_unlock(&p->mutex);
return 0;
}
// zebra_lock_rdwr_runlock
// file zebra-lock.c line 135
signed int zebra_lock_rdwr_runlock(struct anonymous$56 *p)
{
pthread_mutex_lock(&p->mutex);
if(p->readers_reading == 0)
{
pthread_mutex_unlock(&p->mutex);
return -1;
}
else
{
p->readers_reading = p->readers_reading - 1;
if(p->readers_reading == 0)
pthread_cond_signal(&p->lock_free);
pthread_mutex_unlock(&p->mutex);
}
return 0;
}
// zebra_lock_rdwr_wlock
// file zebra-lock.c line 123
signed int zebra_lock_rdwr_wlock(struct anonymous$56 *p)
{
pthread_mutex_lock(&p->mutex);
while((_Bool)1)
{
if(p->writers_writing == 0)
{
if(p->readers_reading == 0)
goto __CPROVER_DUMP_L3;
}
pthread_cond_wait(&p->lock_free, &p->mutex);
}
__CPROVER_DUMP_L3:
;
p->writers_writing = p->writers_writing + 1;
pthread_mutex_unlock(&p->mutex);
return 0;
}
// zebra_lock_rdwr_wunlock
// file zebra-lock.c line 155
signed int zebra_lock_rdwr_wunlock(struct anonymous$56 *p)
{
pthread_mutex_lock(&p->mutex);
if(p->writers_writing == 0)
{
pthread_mutex_unlock(&p->mutex);
return -1;
}
else
{
p->writers_writing = p->writers_writing - 1;
pthread_cond_broadcast(&p->lock_free);
pthread_mutex_unlock(&p->mutex);
}
return 0;
}
// zebra_lock_w
// file ../include/idzebra/flock.h line 41
signed int zebra_lock_w(struct zebra_lock_handle *h)
{
signed int r = 0;
signed int do_lock = 0;
yaz_log(log_level, "zebra_lock_w fd=%d p=%p fname=%s begin", h->p->fd, h, h->p->fname);
if(!(posix_locks == 0))
zebra_lock_rdwr_wlock(&h->p->rdwr_lock);
zebra_mutex_lock(&h->p->file_mutex);
if(h->p->no_file_write_lock == 0)
do_lock = 1;
h->p->no_file_write_lock = h->p->no_file_write_lock + 1;
if(!(do_lock == 0))
r=unixLock(h->p->fd, 1, 7);
else
/* assertion posix_locks */
assert(posix_locks != 0);
zebra_mutex_unlock(&h->p->file_mutex);
h->write_flag = 1;
yaz_log(log_level, "zebra_lock_w fd=%d p=%p fname=%s end", h->p->fd, h, h->p->fname);
return r;
}
// zebra_map_get
// file zebramap.c line 354
struct zebra_map * zebra_map_get(struct zebra_maps_s *zms, const char *id)
{
struct zebra_map *zm = zms->map_list;
signed int return_value_strcmp$1;
for( ; !(zm == ((struct zebra_map *)NULL)); zm = zm->next)
{
return_value_strcmp$1=strcmp(zm->id, id);
if(return_value_strcmp$1 == 0)
break;
}
return zm;
}
// zebra_map_get_or_add
// file zebramap.c line 363
struct zebra_map * zebra_map_get_or_add(struct zebra_maps_s *zms, const char *id)
{
struct zebra_map *zm;
zm=zebra_map_get(zms, id);
if(zm == ((struct zebra_map *)NULL))
{
zm=zebra_add_map(zms, id, 2);
if(!(zms->no_files_read == 0))
yaz_log(0x00000004, "Unknown register type: %s", id);
zm->maptab_name=nmem_strdup(zms->nmem, "@");
zm->completeness = 0;
zm->positioned = 1;
}
return zm;
}
// zebra_map_tokenize_next
// file zebramap.c line 657
signed int zebra_map_tokenize_next(struct zebra_map *zm, const char **result_buf, unsigned long int *result_len, const char **display_buf, unsigned long int *display_len)
{
/* assertion zm->use_chain */
assert(zm->use_chain != 0);
signed int return_value_tokenize_simple$1;
signed int return_value_icu_chain_next_token$2;
if(zm->icu_chain == ((struct icu_chain *)NULL))
{
return_value_tokenize_simple$1=tokenize_simple(zm, result_buf, result_len);
return return_value_tokenize_simple$1;
}
else
{
enum UErrorCode status;
do
{
return_value_icu_chain_next_token$2=icu_chain_next_token(zm->icu_chain, &status);
if(return_value_icu_chain_next_token$2 == 0)
break;
if((signed int)status >= 1)
return 0;
*result_buf=icu_chain_token_sortkey(zm->icu_chain);
/* assertion *result_buf */
assert(*result_buf != ((const char *)NULL));
*result_len=strlen(*result_buf);
if(!(display_buf == ((const char **)NULL)))
{
*display_buf=icu_chain_token_display(zm->icu_chain);
if(!(display_len == ((unsigned long int *)NULL)))
*display_len=strlen(*display_buf);
}
if(!(zm->debug == 0))
{
wrbuf_rewind(zm->print_str);
wrbuf_write_escaped(zm->print_str, *result_buf, *result_len);
const char *return_value_wrbuf_cstr$3;
return_value_wrbuf_cstr$3=wrbuf_cstr(zm->print_str);
yaz_log(0x00000008, "output %s", return_value_wrbuf_cstr$3);
}
if(!((signed int)*(*result_buf) == 0))
return 1;
}
while((_Bool)1);
}
return 0;
}
// zebra_map_tokenize_start
// file zebramap.c line 701
signed int zebra_map_tokenize_start(struct zebra_map *zm, const char *buf, unsigned long int len)
{
signed int ret;
/* assertion zm->use_chain */
assert(zm->use_chain != 0);
wrbuf_rewind(zm->input_str);
wrbuf_write(zm->input_str, buf, len);
zm->simple_off = (unsigned long int)0;
if(!(zm->icu_chain == ((struct icu_chain *)NULL)))
{
enum UErrorCode status;
if(!(zm->debug == 0))
{
wrbuf_rewind(zm->print_str);
wrbuf_write_escaped(zm->print_str, zm->input_str->buf, zm->input_str->pos);
const char *return_value_wrbuf_cstr$1;
return_value_wrbuf_cstr$1=wrbuf_cstr(zm->print_str);
yaz_log(0x00000008, "input %s", return_value_wrbuf_cstr$1);
}
const char *return_value_wrbuf_cstr$2;
return_value_wrbuf_cstr$2=wrbuf_cstr(zm->input_str);
ret=icu_chain_assign_cstr(zm->icu_chain, return_value_wrbuf_cstr$2, &status);
if(ret == 0 && (signed int)status >= 1)
{
if(!(zm->debug == 0))
yaz_log(0x00000004, "bad encoding for input");
return -1;
}
}
return 0;
}
// zebra_maps_attr
// file zebramap.c line 514
signed int zebra_maps_attr(struct zebra_maps_s *zms, struct Z_AttributesPlusTerm *zapt, const char **index_type, char **search_type, char *rank_type, signed int *complete_flag, signed int *sort_flag)
{
struct anonymous$89 completeness;
struct anonymous$89 structure;
struct anonymous$89 relation;
struct anonymous$89 sort_relation;
struct anonymous$89 weight;
struct anonymous$89 use;
signed int completeness_value;
signed int structure_value;
const char *structure_str = ((const char *)NULL);
signed int relation_value;
signed int sort_relation_value;
signed int weight_value;
signed int use_value;
attr_init_APT(&structure, zapt, 4);
attr_init_APT(&completeness, zapt, 6);
attr_init_APT(&relation, zapt, 2);
attr_init_APT(&sort_relation, zapt, 7);
attr_init_APT(&weight, zapt, 9);
attr_init_APT(&use, zapt, 1);
completeness_value=attr_find(&completeness, (const signed short int **)(void *)0);
structure_value=attr_find_ex(&structure, (const signed short int **)(void *)0, &structure_str);
relation_value=attr_find(&relation, (const signed short int **)(void *)0);
sort_relation_value=attr_find(&sort_relation, (const signed short int **)(void *)0);
weight_value=attr_find(&weight, (const signed short int **)(void *)0);
use_value=attr_find(&use, (const signed short int **)(void *)0);
if(completeness_value == 2 || completeness_value == 3)
*complete_flag = 1;
else
*complete_flag = 0;
*index_type = ((const char *)NULL);
*sort_flag = sort_relation_value > 0 ? 1 : 0;
*search_type = "phrase";
strcpy(rank_type, "void");
if(relation_value == 102)
{
if(weight_value == -1)
weight_value = 34;
sprintf(rank_type, "rank,w=%d,u=%d", weight_value, use_value);
}
if(!(*complete_flag == 0))
*index_type = "p";
else
*index_type = "w";
_Bool tmp_if_expr$1;
if(!(structure_value == 6))
{
if(structure_value == 105)
goto __CPROVER_DUMP_L8;
if(structure_value == 106)
goto __CPROVER_DUMP_L9;
if(structure_value == 1 || structure_value == 2 || structure_value == 108 || structure_value == -1)
goto __CPROVER_DUMP_L10;
if(structure_value == 107)
goto __CPROVER_DUMP_L11;
if(structure_value == 109)
goto __CPROVER_DUMP_L12;
if(structure_value == 104)
goto __CPROVER_DUMP_L13;
if(structure_value == 3)
goto __CPROVER_DUMP_L14;
if(structure_value == 4)
goto __CPROVER_DUMP_L15;
if(structure_value == 5)
goto __CPROVER_DUMP_L16;
if(structure_value == -2)
goto __CPROVER_DUMP_L17;
}
else
{
*search_type = "and-list";
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L8:
;
*search_type = "or-list";
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L9:
;
*search_type = "or-list";
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L10:
;
*search_type = "phrase";
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L11:
;
*search_type = "local";
*index_type = ((const char *)NULL);
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L12:
;
*index_type = "n";
*search_type = "numeric";
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L13:
;
*index_type = "u";
*search_type = "phrase";
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L14:
;
*index_type = "0";
*search_type = "phrase";
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L15:
;
*index_type = "y";
*search_type = "phrase";
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L16:
;
*index_type = "d";
*search_type = "phrase";
goto __CPROVER_DUMP_L23;
__CPROVER_DUMP_L17:
;
if(!(structure_str == ((const char *)NULL)))
tmp_if_expr$1 = *structure_str != 0 ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$1 = (_Bool)0;
if(tmp_if_expr$1)
*index_type = structure_str;
else
return -1;
goto __CPROVER_DUMP_L23;
}
return -1;
__CPROVER_DUMP_L23:
;
return 0;
}
// zebra_maps_close
// file zebramap.c line 83
void zebra_maps_close(struct zebra_maps_s *zms)
{
struct zebra_map *zm = zms->map_list;
for( ; !(zm == ((struct zebra_map *)NULL)); zm = zm->next)
{
if(!(zm->maptab == ((struct chrmaptab_info *)NULL)))
chrmaptab_destroy(zm->maptab);
if(!(zm->icu_chain == ((struct icu_chain *)NULL)))
icu_chain_destroy(zm->icu_chain);
xmlFreeDoc(zm->doc);
wrbuf_destroy(zm->input_str);
wrbuf_destroy(zm->print_str);
}
wrbuf_destroy(zms->wrbuf_1);
nmem_destroy(zms->nmem);
xfree_f((void *)zms, "zebramap.c", 103);
}
// zebra_maps_define_default_sort
// file zebramap.c line 348
void zebra_maps_define_default_sort(struct zebra_maps_s *zms)
{
struct zebra_map *zm;
zm=zebra_add_map(zms, "s", 1);
zm->u.sort.entry_size = 80;
}
// zebra_maps_input
// file zebramap.c line 398
const char ** zebra_maps_input(struct zebra_map *zm, const char **from, signed int len, signed int first)
{
struct chrmaptab_info *maptab;
maptab=zebra_charmap_get(zm);
const char **return_value_chr_map_input$1;
if(!(maptab == ((struct chrmaptab_info *)NULL)))
{
return_value_chr_map_input$1=chr_map_input(maptab, from, len, first);
return return_value_chr_map_input$1;
}
else
{
zm->zebra_maps->temp_map_str[(signed long int)0] = *(*from);
*from = *from + 1l;
return zm->zebra_maps->temp_map_ptr;
}
}
// zebra_maps_is_alwaysmatches
// file zebramap.c line 484
signed int zebra_maps_is_alwaysmatches(struct zebra_map *zm)
{
if(!(zm == ((struct zebra_map *)NULL)))
return zm->alwaysmatches;
else
return 0;
}
// zebra_maps_is_complete
// file zebramap.c line 449
signed int zebra_maps_is_complete(struct zebra_map *zm)
{
if(!(zm == ((struct zebra_map *)NULL)))
return zm->completeness;
else
return 0;
}
// zebra_maps_is_first_in_field
// file zebramap.c line 491
signed int zebra_maps_is_first_in_field(struct zebra_map *zm)
{
if(!(zm == ((struct zebra_map *)NULL)))
return zm->first_in_field;
else
return 0;
}
// zebra_maps_is_icu
// file zebramap.c line 740
signed int zebra_maps_is_icu(struct zebra_map *zm)
{
/* assertion zm */
assert(zm != ((struct zebra_map *)NULL));
return zm->use_chain;
}
// zebra_maps_is_index
// file zebramap.c line 463
signed int zebra_maps_is_index(struct zebra_map *zm)
{
if(!(zm == ((struct zebra_map *)NULL)))
return (signed int)(zm->type == 2);
else
return 0;
}
// zebra_maps_is_positioned
// file zebramap.c line 456
signed int zebra_maps_is_positioned(struct zebra_map *zm)
{
if(!(zm == ((struct zebra_map *)NULL)))
return zm->positioned;
else
return 0;
}
// zebra_maps_is_sort
// file zebramap.c line 477
signed int zebra_maps_is_sort(struct zebra_map *zm)
{
if(!(zm == ((struct zebra_map *)NULL)))
return (signed int)(zm->type == 1);
else
return 0;
}
// zebra_maps_is_staticrank
// file zebramap.c line 470
signed int zebra_maps_is_staticrank(struct zebra_map *zm)
{
if(!(zm == ((struct zebra_map *)NULL)))
return (signed int)(zm->type == 3);
else
return 0;
}
// zebra_maps_open
// file zebramap.c line 323
struct zebra_maps_s * zebra_maps_open(struct res_struct *res, const char *base_path, const char *profile_path)
{
struct zebra_maps_s *zms;
void *return_value_xmalloc_f$1;
return_value_xmalloc_f$1=xmalloc_f(sizeof(struct zebra_maps_s) /*80ul*/ , "zebramap.c", 326);
zms = (struct zebra_maps_s *)return_value_xmalloc_f$1;
zms->nmem=nmem_create();
char *tmp_if_expr$3;
char *return_value_nmem_strdup$2;
if(!(profile_path == ((const char *)NULL)))
{
return_value_nmem_strdup$2=nmem_strdup(zms->nmem, profile_path);
tmp_if_expr$3 = return_value_nmem_strdup$2;
}
else
tmp_if_expr$3 = ((char *)NULL);
zms->tabpath = tmp_if_expr$3;
zms->tabroot = ((char *)NULL);
if(!(base_path == ((const char *)NULL)))
zms->tabroot=nmem_strdup(zms->nmem, base_path);
zms->map_list = ((struct zebra_map *)NULL);
zms->last_map = ((struct zebra_map *)NULL);
zms->temp_map_str[(signed long int)0] = (char)0;
zms->temp_map_str[(signed long int)1] = (char)0;
zms->temp_map_ptr[(signed long int)0] = zms->temp_map_str;
zms->temp_map_ptr[(signed long int)1] = (const char *)(void *)0;
zms->wrbuf_1=wrbuf_alloc();
zms->no_files_read = 0;
return zms;
}
// zebra_maps_output
// file zebramap.c line 437
const char * zebra_maps_output(struct zebra_map *zm, const char **from)
{
struct chrmaptab_info *maptab;
maptab=zebra_charmap_get(zm);
if(maptab == ((struct chrmaptab_info *)NULL))
return ((const char *)NULL);
else
{
const char *return_value_chr_map_output$1;
return_value_chr_map_output$1=chr_map_output(maptab, from, 1);
return return_value_chr_map_output$1;
}
}
// zebra_maps_read_file
// file zebramap.c line 294
signed short int zebra_maps_read_file(struct zebra_maps_s *zms, const char *fname)
{
struct _IO_FILE *f;
char line[512l];
char *argv[10l];
signed int argc;
signed int lineno = 0;
signed int failures = 0;
f=yaz_fopen(zms->tabpath, fname, "r", zms->tabroot);
if(f == ((struct _IO_FILE *)NULL))
{
yaz_log(0x00000010 | 0x00000001, "%s", fname);
return (signed short int)-1;
}
else
{
do
{
argc=readconf_line(f, &lineno, line, 512, argv, 10);
if(argc == 0)
break;
signed int r;
r=parse_command(zms, argc, argv, fname, lineno);
if(!(r == 0))
failures = failures + 1;
}
while((_Bool)1);
yaz_fclose(f);
if(!(failures == 0))
return (signed short int)-1;
else
{
zms->no_files_read = zms->no_files_read + 1;
return (signed short int)0;
}
}
}
// zebra_maps_search
// file zebramap.c line 411
const char ** zebra_maps_search(struct zebra_map *zm, const char **from, signed int len, signed int *q_map_match)
{
struct chrmaptab_info *maptab;
*q_map_match = 0;
maptab=zebra_charmap_get(zm);
if(!(maptab == ((struct chrmaptab_info *)NULL)))
{
const char **map;
map=chr_map_q_input(maptab, from, len, 0);
if(!(map == ((const char **)NULL)))
{
if(!(*map == ((const char *)NULL)))
{
*q_map_match = 1;
return map;
}
}
map=chr_map_input(maptab, from, len, 0);
if(!(map == ((const char **)NULL)))
return map;
}
zm->zebra_maps->temp_map_str[(signed long int)0] = *(*from);
*from = *from + 1l;
return zm->zebra_maps->temp_map_ptr;
}
// zebra_maps_sort
// file zebramap.c line 498
signed int zebra_maps_sort(struct zebra_maps_s *zms, struct Z_SortAttributes *sortAttributes, signed int *numerical)
{
struct anonymous$89 use;
struct anonymous$89 structure;
signed int structure_value;
attr_init_AttrList(&use, sortAttributes->list, 1);
attr_init_AttrList(&structure, sortAttributes->list, 4);
*numerical = 0;
structure_value=attr_find(&structure, ((const signed short int **)NULL));
if(structure_value == 109)
*numerical = 1;
signed int return_value_attr_find$1;
return_value_attr_find$1=attr_find(&use, (const signed short int **)(void *)0);
return return_value_attr_find$1;
}
// zebra_mk_fname
// file flock.c line 84
char * zebra_mk_fname(const char *dir, const char *name)
{
signed int dlen;
unsigned long int tmp_if_expr$2;
unsigned long int return_value_strlen$1;
if(!(dir == ((const char *)NULL)))
{
return_value_strlen$1=strlen(dir);
tmp_if_expr$2 = return_value_strlen$1;
}
else
tmp_if_expr$2 = (unsigned long int)0;
dlen = (signed int)tmp_if_expr$2;
char *fname;
unsigned long int return_value_strlen$3;
return_value_strlen$3=strlen(name);
void *return_value_xmalloc_f$4;
return_value_xmalloc_f$4=xmalloc_f((unsigned long int)dlen + return_value_strlen$3 + (unsigned long int)3, "flock.c", 87);
fname = (char *)return_value_xmalloc_f$4;
if(!(dlen == 0))
{
signed int last_one = (signed int)dir[(signed long int)(dlen - 1)];
char *return_value_strchr$5;
return_value_strchr$5=strchr("/", last_one);
if(return_value_strchr$5 == ((char *)NULL))
sprintf(fname, "%s/%s", dir, name);
else
sprintf(fname, "%s%s", dir, name);
}
else
sprintf(fname, "%s", name);
return fname;
}
// zebra_mutex_cond_destroy
// file zebra-lock.c line 183
signed int zebra_mutex_cond_destroy(struct anonymous$49 *p)
{
pthread_cond_destroy(&p->cond);
pthread_mutex_destroy(&p->mutex);
return 0;
}
// zebra_mutex_cond_init
// file zebra-lock.c line 174
signed int zebra_mutex_cond_init(struct anonymous$49 *p)
{
pthread_cond_init(&p->cond, ((const union anonymous$53 *)NULL));
pthread_mutex_init(&p->mutex, ((const union anonymous$53 *)NULL));
return 0;
}
// zebra_mutex_cond_lock
// file zebra-lock.c line 192
signed int zebra_mutex_cond_lock(struct anonymous$49 *p)
{
signed int return_value_pthread_mutex_lock$1;
return_value_pthread_mutex_lock$1=pthread_mutex_lock(&p->mutex);
return return_value_pthread_mutex_lock$1;
}
// zebra_mutex_cond_signal
// file zebra-lock.c line 219
signed int zebra_mutex_cond_signal(struct anonymous$49 *p)
{
signed int return_value_pthread_cond_signal$1;
return_value_pthread_cond_signal$1=pthread_cond_signal(&p->cond);
return return_value_pthread_cond_signal$1;
}
// zebra_mutex_cond_unlock
// file zebra-lock.c line 201
signed int zebra_mutex_cond_unlock(struct anonymous$49 *p)
{
signed int return_value_pthread_mutex_unlock$1;
return_value_pthread_mutex_unlock$1=pthread_mutex_unlock(&p->mutex);
return return_value_pthread_mutex_unlock$1;
}
// zebra_mutex_cond_wait
// file zebra-lock.c line 210
signed int zebra_mutex_cond_wait(struct anonymous$49 *p)
{
signed int return_value_pthread_cond_wait$1;
return_value_pthread_cond_wait$1=pthread_cond_wait(&p->cond, &p->mutex);
return return_value_pthread_cond_wait$1;
}
// zebra_mutex_destroy
// file zebra-lock.c line 43
signed int zebra_mutex_destroy(struct anonymous$54 *p)
{
p->state = p->state - 1;
if(!(p->state == 0))
fprintf(stderr, "zebra_mutex_destroy. state = %d\n", p->state);
pthread_mutex_destroy(&p->mutex);
return 0;
}
// zebra_mutex_init
// file zebra-lock.c line 31
signed int zebra_mutex_init(struct anonymous$54 *p)
{
p->state = 1;
pthread_mutex_init(&p->mutex, ((const union anonymous$53 *)NULL));
return 0;
}
// zebra_mutex_lock
// file zebra-lock.c line 59
signed int zebra_mutex_lock(struct anonymous$54 *p)
{
if(!(p->state == 1))
fprintf(stderr, "zebra_mutex_lock. state = %d\n", p->state);
pthread_mutex_lock(&p->mutex);
return 0;
}
// zebra_mutex_unlock
// file zebra-lock.c line 74
signed int zebra_mutex_unlock(struct anonymous$54 *p)
{
if(!(p->state == 1))
fprintf(stderr, "zebra_mutex_unlock. state = %d\n", p->state);
pthread_mutex_unlock(&p->mutex);
return 0;
}
// zebra_parse_xpath_str
// file xpath.c line 162
signed int zebra_parse_xpath_str(const char *xpath_string, struct xpath_location_step *xpath, signed int max, struct nmem_control *mem)
{
const char *cp;
char *a;
signed int no = 0;
_Bool tmp_if_expr$1;
if(xpath_string == ((const char *)NULL))
tmp_if_expr$1 = (_Bool)1;
else
tmp_if_expr$1 = (signed int)*xpath_string != 47 ? (_Bool)1 : (_Bool)0;
char *return_value_strchr$2;
if(tmp_if_expr$1)
return -1;
else
{
cp = xpath_string;
while(!(*cp == 0))
{
if(no >= max)
break;
signed int i = 0;
for( ; !(*cp == 0); cp = cp + 1l)
{
return_value_strchr$2=strchr("/[", (signed int)*cp);
if(!(return_value_strchr$2 == ((char *)NULL)))
break;
i = i + 1;
}
(xpath + (signed long int)no)->predicate = ((struct xpath_predicate *)NULL);
void *return_value_nmem_malloc$3;
return_value_nmem_malloc$3=nmem_malloc(mem, (unsigned long int)(i + 1));
(xpath + (signed long int)no)->part = (char *)return_value_nmem_malloc$3;
if(!(i == 0))
memcpy((void *)(xpath + (signed long int)no)->part, (const void *)(cp - (signed long int)i), (unsigned long int)i);
(xpath + (signed long int)no)->part[(signed long int)i] = (char)0;
if((signed int)*cp == 91)
{
cp = cp + 1l;
for( ; (signed int)*cp == 32; cp = cp + 1l)
;
a = (char *)cp;
(xpath + (signed long int)no)->predicate=get_xpath_predicate(a, mem);
for( ; !(*cp == 0); cp = cp + 1l)
if((signed int)*cp == 93)
break;
if((signed int)*cp == 93)
cp = cp + 1l;
}
no = no + 1;
if(!((signed int)*cp == 47))
break;
cp = cp + 1l;
}
return no;
}
}
// zebra_prim_w
// file charmap.c line 239
unsigned int zebra_prim_w(unsigned int **s)
{
unsigned int c;
unsigned int i = (unsigned int)0;
char fmtstr[8l];
_Bool tmp_if_expr$4;
if(*(*s) == 92u)
tmp_if_expr$4 = (*s)[(signed long int)1] != 0u ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$4 = (_Bool)0;
signed int return_value_zebra_ucs4_strlen$1;
signed int return_value_zebra_ucs4_strlen$2;
signed int return_value_zebra_ucs4_strlen$3;
if(tmp_if_expr$4)
{
*s = *s + 1l;
c = *(*s);
switch(c)
{
case (unsigned int)92:
{
c = (unsigned int)92;
*s = *s + 1l;
break;
}
case (unsigned int)114:
{
c = (unsigned int)13;
*s = *s + 1l;
break;
}
case (unsigned int)110:
{
c = (unsigned int)10;
*s = *s + 1l;
break;
}
case (unsigned int)116:
{
c = (unsigned int)9;
*s = *s + 1l;
break;
}
case (unsigned int)115:
{
c = (unsigned int)32;
*s = *s + 1l;
break;
}
case (unsigned int)120:
{
return_value_zebra_ucs4_strlen$1=zebra_ucs4_strlen(*s);
if(return_value_zebra_ucs4_strlen$1 >= 3)
{
fmtstr[(signed long int)0] = (char)(*s)[(signed long int)1];
fmtstr[(signed long int)1] = (char)(*s)[(signed long int)2];
fmtstr[(signed long int)2] = (char)0;
sscanf(fmtstr, "%x", &i);
c = i;
*s = *s + (signed long int)3;
}
break;
}
case (unsigned int)48:
case (unsigned int)49:
case (unsigned int)50:
case (unsigned int)51:
case (unsigned int)52:
case (unsigned int)53:
case (unsigned int)54:
case (unsigned int)55:
case (unsigned int)56:
case (unsigned int)57:
{
return_value_zebra_ucs4_strlen$2=zebra_ucs4_strlen(*s);
if(return_value_zebra_ucs4_strlen$2 >= 3)
{
fmtstr[(signed long int)0] = (char)(*s)[(signed long int)0];
fmtstr[(signed long int)1] = (char)(*s)[(signed long int)1];
fmtstr[(signed long int)2] = (char)(*s)[(signed long int)2];
fmtstr[(signed long int)3] = (char)0;
sscanf(fmtstr, "%o", &i);
c = i;
*s = *s + (signed long int)3;
}
break;
}
case (unsigned int)76:
{
return_value_zebra_ucs4_strlen$3=zebra_ucs4_strlen(*s);
if(return_value_zebra_ucs4_strlen$3 >= 5)
{
fmtstr[(signed long int)0] = (char)(*s)[(signed long int)1];
fmtstr[(signed long int)1] = (char)(*s)[(signed long int)2];
fmtstr[(signed long int)2] = (char)(*s)[(signed long int)3];
fmtstr[(signed long int)3] = (char)(*s)[(signed long int)4];
fmtstr[(signed long int)4] = (char)0;
sscanf(fmtstr, "%x", &i);
c = i;
*s = *s + (signed long int)5;
}
break;
}
default:
*s = *s + 1l;
}
}
else
{
c = *(*s);
*s = *s + 1l;
}
yaz_log(0x00000002, "out %d", c);
return c;
}
// zebra_replace
// file zebramap.c line 618
struct wrbuf * zebra_replace(struct zebra_map *zm, const char *ex_list, const char *input_str, signed int input_len)
{
wrbuf_rewind(zm->zebra_maps->wrbuf_1);
wrbuf_write(zm->zebra_maps->wrbuf_1, input_str, (unsigned long int)input_len);
return zm->zebra_maps->wrbuf_1;
}
// zebra_snippets_append
// file snippet.c line 51
void zebra_snippets_append(struct zebra_snippets *l, signed long long int seqno, signed int ws, signed int ord, const char *term)
{
unsigned long int return_value_strlen$1;
return_value_strlen$1=strlen(term);
zebra_snippets_append_match(l, seqno, ws, ord, term, return_value_strlen$1, 0);
}
// zebra_snippets_append_match
// file snippet.c line 65
void zebra_snippets_append_match(struct zebra_snippets *l, signed long long int seqno, signed int ws, signed int ord, const char *term, unsigned long int term_len, signed int match)
{
struct zebra_snippet_word *w;
void *return_value_nmem_malloc$1;
return_value_nmem_malloc$1=nmem_malloc(l->nmem, sizeof(struct zebra_snippet_word) /*56ul*/ );
w = (struct zebra_snippet_word *)return_value_nmem_malloc$1;
w->next = ((struct zebra_snippet_word *)NULL);
w->prev = l->tail;
if(!(l->tail == ((struct zebra_snippet_word *)NULL)))
l->tail->next = w;
else
l->front = w;
l->tail = w;
w->seqno = seqno;
w->ws = ws;
w->ord = ord;
void *return_value_nmem_malloc$2;
return_value_nmem_malloc$2=nmem_malloc(l->nmem, term_len + (unsigned long int)1);
w->term = (char *)return_value_nmem_malloc$2;
memcpy((void *)w->term, (const void *)term, term_len);
w->term[(signed long int)term_len] = (char)0;
w->match = match;
w->mark = 0;
}
// zebra_snippets_appendn
// file snippet.c line 57
void zebra_snippets_appendn(struct zebra_snippets *l, signed long long int seqno, signed int ws, signed int ord, const char *term, unsigned long int term_len)
{
zebra_snippets_append_match(l, seqno, ws, ord, term, term_len, 0);
}
// zebra_snippets_clear
// file snippet.c line 207
static void zebra_snippets_clear(struct zebra_snippets *sn)
{
struct zebra_snippet_word *w;
w=zebra_snippets_list(sn);
for( ; !(w == ((struct zebra_snippet_word *)NULL)); w = w->next)
{
w->mark = 0;
w->match = 0;
}
}
// zebra_snippets_constlist
// file snippet.c line 99
const struct zebra_snippet_word * zebra_snippets_constlist(const struct zebra_snippets *l)
{
return l->front;
}
// zebra_snippets_create
// file snippet.c line 36
struct zebra_snippets * zebra_snippets_create(void)
{
struct nmem_control *nmem;
nmem=nmem_create();
struct zebra_snippets *l;
void *return_value_nmem_malloc$1;
return_value_nmem_malloc$1=nmem_malloc(nmem, sizeof(struct zebra_snippets) /*24ul*/ );
l = (struct zebra_snippets *)return_value_nmem_malloc$1;
l->nmem = nmem;
l->tail = ((struct zebra_snippet_word *)NULL);
l->front = l->tail;
return l;
}
// zebra_snippets_destroy
// file snippet.c line 45
void zebra_snippets_destroy(struct zebra_snippets *l)
{
if(!(l == ((struct zebra_snippets *)NULL)))
nmem_destroy(l->nmem);
}
// zebra_snippets_list
// file snippet.c line 94
struct zebra_snippet_word * zebra_snippets_list(struct zebra_snippets *l)
{
return l->front;
}
// zebra_snippets_log
// file snippet.c line 104
void zebra_snippets_log(const struct zebra_snippets *l, signed int log_level, signed int all)
{
struct zebra_snippet_word *w = l->front;
_Bool tmp_if_expr$3;
const char *return_value_wrbuf_cstr$1;
_Bool tmp_if_expr$2;
for( ; !(w == ((struct zebra_snippet_word *)NULL)); w = w->next)
{
struct wrbuf *wr_term;
wr_term=wrbuf_alloc();
wrbuf_puts_escaped(wr_term, w->term);
if(!(all == 0))
tmp_if_expr$3 = (_Bool)1;
else
tmp_if_expr$3 = w->mark != 0 ? (_Bool)1 : (_Bool)0;
if(tmp_if_expr$3)
{
return_value_wrbuf_cstr$1=wrbuf_cstr(wr_term);
if(!(w->match == 0))
tmp_if_expr$2 = !(w->ws != 0) ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$2 = (_Bool)0;
yaz_log(log_level, "term='%s'%s mark=%d seqno=%lld ord=%d", return_value_wrbuf_cstr$1, tmp_if_expr$2 ? "*" : "", w->mark, w->seqno, w->ord);
}
wrbuf_destroy(wr_term);
}
}
// zebra_snippets_lookup
// file snippet.c line 218
struct zebra_snippet_word * zebra_snippets_lookup(const struct zebra_snippets *doc, const struct zebra_snippets *hit)
{
const struct zebra_snippet_word *hit_w;
hit_w=zebra_snippets_constlist(hit);
for( ; !(hit_w == ((const struct zebra_snippet_word *)NULL)); hit_w = hit_w->next)
{
const struct zebra_snippet_word *doc_w;
doc_w=zebra_snippets_constlist(doc);
for( ; !(doc_w == ((const struct zebra_snippet_word *)NULL)); doc_w = doc_w->next)
if(doc_w->ord == hit_w->ord)
{
if(doc_w->seqno == hit_w->seqno)
{
if(doc_w->ws == 0)
return doc_w;
}
}
}
return ((struct zebra_snippet_word *)NULL);
}
// zebra_snippets_ring
// file snippet.c line 237
void zebra_snippets_ring(struct zebra_snippets *doc, const struct zebra_snippets *hit, signed int before, signed int after)
{
signed int ord = -1;
zebra_snippets_clear(doc);
_Bool tmp_if_expr$1;
_Bool tmp_if_expr$2;
_Bool tmp_if_expr$3;
_Bool tmp_if_expr$4;
_Bool tmp_if_expr$5;
while((_Bool)1)
{
const struct zebra_snippet_word *hit_w;
struct zebra_snippet_word *doc_w;
signed int min_ord = 0;
hit_w=zebra_snippets_constlist(hit);
for( ; !(hit_w == ((const struct zebra_snippet_word *)NULL)); hit_w = hit_w->next)
if(!(ord >= hit_w->ord))
{
if(min_ord == 0)
tmp_if_expr$1 = (_Bool)1;
else
tmp_if_expr$1 = hit_w->ord < min_ord ? (_Bool)1 : (_Bool)0;
if(tmp_if_expr$1)
min_ord = hit_w->ord;
}
if(min_ord == 0)
break;
ord = min_ord;
hit_w=zebra_snippets_constlist(hit);
for( ; !(hit_w == ((const struct zebra_snippet_word *)NULL)); hit_w = hit_w->next)
if(hit_w->ord == ord)
{
doc_w=zebra_snippets_list(doc);
for( ; !(doc_w == ((struct zebra_snippet_word *)NULL)); doc_w = doc_w->next)
if(doc_w->ord == ord)
{
if(doc_w->seqno == hit_w->seqno)
{
if(doc_w->ws == 0)
{
doc_w->match = 1;
doc_w->mark = 1;
break;
}
}
}
if(!(doc_w == ((struct zebra_snippet_word *)NULL)))
{
struct zebra_snippet_word *w = doc_w->next;
while(!(w == ((struct zebra_snippet_word *)NULL)))
{
if(w->ord == ord)
tmp_if_expr$2 = hit_w->seqno - (signed long int)before < w->seqno ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$2 = (_Bool)0;
if(tmp_if_expr$2)
tmp_if_expr$3 = hit_w->seqno + (signed long int)after > w->seqno ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$3 = (_Bool)0;
if(tmp_if_expr$3)
{
w->mark = 1;
w = w->next;
}
else
break;
}
}
if(!(doc_w == ((struct zebra_snippet_word *)NULL)))
{
struct zebra_snippet_word *zebra_snippets_ring$$1$$1$$2$$1$$1$$3$$w = doc_w->prev;
while(!(zebra_snippets_ring$$1$$1$$2$$1$$1$$3$$w == ((struct zebra_snippet_word *)NULL)))
{
if(zebra_snippets_ring$$1$$1$$2$$1$$1$$3$$w->ord == ord)
tmp_if_expr$4 = hit_w->seqno - (signed long int)before < zebra_snippets_ring$$1$$1$$2$$1$$1$$3$$w->seqno ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$4 = (_Bool)0;
if(tmp_if_expr$4)
tmp_if_expr$5 = hit_w->seqno + (signed long int)after > zebra_snippets_ring$$1$$1$$2$$1$$1$$3$$w->seqno ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$5 = (_Bool)0;
if(tmp_if_expr$5)
{
zebra_snippets_ring$$1$$1$$2$$1$$1$$3$$w->mark = 1;
zebra_snippets_ring$$1$$1$$2$$1$$1$$3$$w = zebra_snippets_ring$$1$$1$$2$$1$$1$$3$$w->prev;
}
else
break;
}
}
}
}
}
// zebra_snippets_window
// file snippet.c line 121
struct zebra_snippets * zebra_snippets_window(const struct zebra_snippets *doc, const struct zebra_snippets *hit, signed int window_size)
{
signed int ord = -1;
struct zebra_snippets *result;
result=zebra_snippets_create();
if(window_size == 0)
window_size = 1000000;
_Bool tmp_if_expr$1;
while((_Bool)1)
{
signed long long int window_start;
signed long long int first_seq_no_best_window = (signed long long int)0;
signed long long int last_seq_no_best_window = (signed long long int)0;
signed int number_best_window = 0;
const struct zebra_snippet_word *hit_w;
const struct zebra_snippet_word *doc_w;
signed int min_ord = 0;
hit_w=zebra_snippets_constlist(hit);
for( ; !(hit_w == ((const struct zebra_snippet_word *)NULL)); hit_w = hit_w->next)
if(!(ord >= hit_w->ord))
{
if(min_ord == 0)
tmp_if_expr$1 = (_Bool)1;
else
tmp_if_expr$1 = hit_w->ord < min_ord ? (_Bool)1 : (_Bool)0;
if(tmp_if_expr$1)
min_ord = hit_w->ord;
}
if(min_ord == 0)
break;
ord = min_ord;
hit_w=zebra_snippets_constlist(hit);
for( ; !(hit_w == ((const struct zebra_snippet_word *)NULL)); hit_w = hit_w->next)
if(hit_w->ord == ord)
{
const struct zebra_snippet_word *look_w = hit_w;
signed int number_this = 0;
signed long long int seq_no_last = (signed long long int)0;
for( ; !(look_w == ((const struct zebra_snippet_word *)NULL)); look_w = look_w->next)
{
if(look_w->seqno >= hit_w->seqno + (signed long int)window_size)
break;
if(look_w->ord == ord)
{
seq_no_last = look_w->seqno;
number_this = number_this + 1;
}
}
if(!(number_best_window >= number_this))
{
number_best_window = number_this;
first_seq_no_best_window = hit_w->seqno;
last_seq_no_best_window = seq_no_last;
}
}
yaz_log(0x00000002, "ord=%d", ord);
yaz_log(0x00000002, "first_seq_no_best_window=%lld", first_seq_no_best_window);
yaz_log(0x00000002, "last_seq_no_best_window=%lld", last_seq_no_best_window);
yaz_log(0x00000002, "number_best_window=%d", number_best_window);
window_start = ((first_seq_no_best_window + last_seq_no_best_window) - (signed long int)window_size) / (signed long int)2;
doc_w=zebra_snippets_constlist(doc);
for( ; !(doc_w == ((const struct zebra_snippet_word *)NULL)); doc_w = doc_w->next)
if(doc_w->ord == ord)
{
if(doc_w->seqno >= window_start)
{
if(!(doc_w->seqno >= window_start + (signed long int)window_size))
{
signed int match = 0;
hit_w=zebra_snippets_constlist(hit);
for( ; !(hit_w == ((const struct zebra_snippet_word *)NULL)); hit_w = hit_w->next)
if(hit_w->ord == ord)
{
if(hit_w->seqno == doc_w->seqno)
{
match = 1;
break;
}
}
unsigned long int return_value_strlen$2;
return_value_strlen$2=strlen(doc_w->term);
zebra_snippets_append_match(result, doc_w->seqno, doc_w->ws, ord, doc_w->term, return_value_strlen$2, match);
}
}
}
}
return result;
}
// zebra_strmap_add
// file strmap.c line 80
void zebra_strmap_add(struct zebra_strmap *st, const char *name, void *data_buf, unsigned long int data_len)
{
struct strmap_entry **e;
e=hash(st, name);
struct strmap_entry *ne = st->free_entries;
void *return_value_nmem_malloc$1;
if(!(ne == ((struct strmap_entry *)NULL)))
st->free_entries = ne->next;
else
{
return_value_nmem_malloc$1=nmem_malloc(st->nmem_ent, sizeof(struct strmap_entry) /*32ul*/ );
ne = (struct strmap_entry *)return_value_nmem_malloc$1;
}
ne->next = *e;
*e = ne;
ne->name=nmem_strdup(st->nmem_str, name);
ne->data_buf=nmem_malloc(st->nmem_str, data_len);
memcpy(ne->data_buf, data_buf, data_len);
ne->data_len = data_len;
st->size = st->size + 1;
}
// zebra_strmap_create
// file strmap.c line 45
struct zebra_strmap * zebra_strmap_create(void)
{
signed int i;
struct nmem_control *nmem_ent;
nmem_ent=nmem_create();
struct zebra_strmap *st;
void *return_value_nmem_malloc$1;
return_value_nmem_malloc$1=nmem_malloc(nmem_ent, sizeof(struct zebra_strmap) /*40ul*/ );
st = (struct zebra_strmap *)return_value_nmem_malloc$1;
st->nmem_ent = nmem_ent;
st->nmem_str=nmem_create();
st->hsize = 1001;
st->size = 0;
st->free_entries = ((struct strmap_entry *)NULL);
void *return_value_nmem_malloc$2;
return_value_nmem_malloc$2=nmem_malloc(nmem_ent, (unsigned long int)st->hsize * sizeof(struct strmap_entry *) /*8ul*/ );
st->entries = (struct strmap_entry **)return_value_nmem_malloc$2;
i = 0;
for( ; !(i >= st->hsize); i = i + 1)
st->entries[(signed long int)i] = ((struct strmap_entry *)NULL);
return st;
}
// zebra_strmap_destroy
// file strmap.c line 61
void zebra_strmap_destroy(struct zebra_strmap *st)
{
if(!(st == ((struct zebra_strmap *)NULL)))
{
nmem_destroy(st->nmem_str);
nmem_destroy(st->nmem_ent);
}
}
// zebra_strmap_get_size
// file strmap.c line 136
signed int zebra_strmap_get_size(struct zebra_strmap *st)
{
return st->size;
}
// zebra_strmap_it_create
// file strmap.c line 148
struct zebra_strmap_it_s * zebra_strmap_it_create(struct zebra_strmap *st)
{
struct zebra_strmap_it_s *it;
void *return_value_xmalloc_f$1;
return_value_xmalloc_f$1=xmalloc_f(sizeof(struct zebra_strmap_it_s) /*24ul*/ , "strmap.c", 150);
it = (struct zebra_strmap_it_s *)return_value_xmalloc_f$1;
it->hno = 0;
it->ent = ((struct strmap_entry *)NULL);
it->st = st;
return it;
}
// zebra_strmap_it_destroy
// file strmap.c line 157
void zebra_strmap_it_destroy(struct zebra_strmap_it_s *it)
{
xfree_f((void *)it, "strmap.c", 159);
}
// zebra_strmap_it_next
// file strmap.c line 162
const char * zebra_strmap_it_next(struct zebra_strmap_it_s *it, void **data_buf, unsigned long int *data_len)
{
struct strmap_entry *ent = ((struct strmap_entry *)NULL);
for( ; it->ent == ((struct strmap_entry *)NULL); it->hno = it->hno + 1)
{
if(it->hno >= it->st->hsize)
break;
it->ent = it->st->entries[(signed long int)it->hno];
}
if(!(it->ent == ((struct strmap_entry *)NULL)))
{
ent = it->ent;
it->ent = ent->next;
}
if(!(ent == ((struct strmap_entry *)NULL)))
{
if(!(data_buf == ((void **)NULL)))
*data_buf = ent->data_buf;
if(!(data_len == ((unsigned long int *)NULL)))
*data_len = ent->data_len;
return ent->name;
}
else
return ((const char *)NULL);
}
// zebra_strmap_lookup
// file strmap.c line 99
void * zebra_strmap_lookup(struct zebra_strmap *st, const char *name, signed int no, unsigned long int *data_len)
{
struct strmap_entry *e;
struct strmap_entry **return_value_hash$1;
return_value_hash$1=hash(st, name);
e = *return_value_hash$1;
signed int i = 0;
signed int return_value_strcmp$2;
for( ; !(e == ((struct strmap_entry *)NULL)); e = e->next)
{
return_value_strcmp$2=strcmp(name, e->name);
if(return_value_strcmp$2 == 0)
{
if(i == no)
{
if(!(data_len == ((unsigned long int *)NULL)))
*data_len = e->data_len;
return e->data_buf;
}
i = i + 1;
}
}
return NULL;
}
// zebra_strmap_remove
// file strmap.c line 118
signed int zebra_strmap_remove(struct zebra_strmap *st, const char *name)
{
struct strmap_entry **e;
e=hash(st, name);
signed int return_value_strcmp$1;
for( ; !(*e == ((struct strmap_entry *)NULL)); e = &(*e)->next)
{
return_value_strcmp$1=strcmp(name, (*e)->name);
if(return_value_strcmp$1 == 0)
{
struct strmap_entry *tmp = *e;
*e = (*e)->next;
tmp->next = st->free_entries;
st->free_entries = tmp;
st->size = st->size - 1;
return 1;
}
}
return 0;
}
// zebra_ucs4_strlen
// file charmap.c line 231
static signed int zebra_ucs4_strlen(unsigned int *s)
{
signed int i = 0;
unsigned int *tmp_post$1;
do
{
tmp_post$1 = s;
s = s + 1l;
if(*tmp_post$1 == 0u)
break;
i = i + 1;
}
while((_Bool)1);
return i;
}
// zebra_unlock
// file ../include/idzebra/flock.h line 36
signed int zebra_unlock(struct zebra_lock_handle *h)
{
signed int r = 0;
yaz_log(log_level, "zebra_unlock fd=%d p=%p fname=%s begin", h->p->fd, h, h->p->fname);
zebra_mutex_lock(&h->p->file_mutex);
if(!(h->write_flag == 0))
{
if(h->p->no_file_write_lock >= 1)
h->p->no_file_write_lock = h->p->no_file_write_lock - 1;
}
else
if(h->p->no_file_read_lock >= 1)
h->p->no_file_read_lock = h->p->no_file_read_lock - 1;
_Bool tmp_if_expr$1;
if(h->p->no_file_read_lock == 0)
tmp_if_expr$1 = h->p->no_file_write_lock == 0 ? (_Bool)1 : (_Bool)0;
else
tmp_if_expr$1 = (_Bool)0;
if(tmp_if_expr$1)
r=unixLock(h->p->fd, 2, 7);
else
{
r = 0;
/* assertion posix_locks */
assert(posix_locks != 0);
}
zebra_mutex_unlock(&h->p->file_mutex);
if(!(posix_locks == 0))
{
if(!(h->write_flag == 0))
zebra_lock_rdwr_wunlock(&h->p->rdwr_lock);
else
zebra_lock_rdwr_runlock(&h->p->rdwr_lock);
}
yaz_log(log_level, "zebra_unlock fd=%d p=%p fname=%s end", h->p->fd, h, h->p->fname);
return r;
}
// zebra_zint_decode
// file zint.c line 39
void zebra_zint_decode(const char **src, signed long long int *pos)
{
const unsigned char **bp = (const unsigned char **)src;
signed long long int d = (signed long long int)0;
unsigned char c;
unsigned int r = (unsigned int)0;
const unsigned char *tmp_post$1;
do
{
tmp_post$1 = *bp;
*bp = *bp + 1l;
c = *tmp_post$1;
if((128 & (signed int)c) == 0)
break;
d = d + ((signed long long int)((signed int)c & 127) << r);
r = r + (unsigned int)7;
}
while((_Bool)1);
d = d + ((signed long long int)c << r);
*pos = d;
}
// zebra_zint_encode
// file zint.c line 26
void zebra_zint_encode(char **dst, signed long long int pos)
{
unsigned char *bp = (unsigned char *)*dst;
unsigned char *tmp_post$1;
for( ; pos >= 128l; pos = pos >> 7)
{
tmp_post$1 = bp;
bp = bp + 1l;
*tmp_post$1 = (unsigned char)((signed long int)128 | pos & (signed long int)127);
}
unsigned char *tmp_post$2 = bp;
bp = bp + 1l;
*tmp_post$2 = (unsigned char)pos;
*dst = (char *)bp;
}
|
the_stack_data/178266815.c | #include <stdio.h>
#include <stdlib.h>
//Govorimo o LBK 16,8,5 ==> n k d(k)
int polje[16];
int rez[8];
int G[8][16]={
{1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1},
{0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1 },
{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0 },
{0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1},
{0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1 },
{0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0 },
{0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0 },
{0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0 }
};
int H[8][16]={
{0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
{1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 },
{0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0 },
{0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0 },
{1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 },
{1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 },
{0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0},
{1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
};
int H_T[16][8];
void transpone()
{
int i;
int j;
for(i=0;i<8;++i)
{
for(j=0;j<16;++j)
H_T[j][i]=H[i][j];
}
}
void mul()
{
int i;
for(i=0;i<8;++i)
{
int j;
rez[i]=0;
for(j=0;j<16;++j)
{
rez[i]+=polje[j]*H_T[j][i];
}
rez[i]=rez[i]%2;
}
}
void mul2()
{
int j,k;
for(j=0;j<16;++j)
{
rez[j]=0;
for(k=0;k<8;++k)
{
rez[j]+=polje[k]*G[k][j];
}
rez[j]=rez[j]%2;
}
}
int arr[4545];
int br = 0;
void addInputs()
{
int i,j;
for(i=0;i<(1<<8);++i)
{
for(j=7;j>=0;--j)
{
polje[7-j]= (i & (1<<j))!=0;
}
/*for(j=0;j<8;++j)
printf("%d ",polje[j]);*/
//printf("\n");
mul2();
int broj=0;
for(j=0;j<16;++j)
{
arr[br] += rez[j] * (1<<(15-j));
}
printf("%d.%d %d\n",br,i,arr[br]);
++br;
}
}
int nadi(unsigned short oktet)
{
int i;
for(i=0;i<br;++i)
{
if(arr[i]==oktet)
return i;
}
return -1;
}
int correction()
{
int i,j;
for(i=0;i<16;++i)
{
int ca=1;
for(j=0;j<8;++j)
{
if(rez[j]!=H[j][i])
ca=0;
}
if(ca==1)
{
polje[i]=!polje[i];
return i;
}
}
int k;
int ko1 = rand()%14 +1;
int ko2 = rand()%14 +1;
for(i=ko1;i!=ko1-1;i=(i+1)%16)
{
for(j=ko2;j!=ko2-1;j=(j+1)%16)
{
//printf("%d %d %d %d\n",i,j,ko1,ko2);
int ca=1;
if(i!=j)
for(k=0;k<8;++k)
{
if(!(rez[k]!=H[k][i] && rez[k]==H[k][j]))
ca=0;
if(!(rez[k]==H[k][i] && rez[k]!=H[k][j]))
ca=0;
}
if(ca==1)
{
polje[i]=!polje[i];
polje[j]=!polje[j];
return -2;
}
}
}
return -1;
}
void solve(FILE *inputFile, FILE *outputFile)
{
transpone();
addInputs();
int prvi=0;
//printf("%d\n",fread(&oktet,sizeof(unsigned short),1,inputFile));
//printf("%d\n",oktet);
int dobri =0;
int losi=0;
while(fread(&prvi,sizeof(unsigned char),1,inputFile)==1)
{
int drugi ;
fread(&drugi,sizeof(unsigned char),1,inputFile);
unsigned int oktet=0;
int find = -1;
int i;
int c=0;
//printf("%d %d\n",prvi,drugi);
/*if(oktet!=0)
printf("%d\n",oktet);*/
polje[15]=(drugi & 1)!=0;
polje[14]=(drugi & 2)!=0;
polje[13]=(drugi & 4)!=0;
polje[12]=(drugi & 8)!=0;
polje[11]=(drugi & 16)!=0;
polje[10]=(drugi & 32)!=0;
polje[9]=(drugi & 64)!=0;
polje[8]=(drugi & 128)!=0;
polje[0]=(prvi & 128)!=0;
polje[1]=(prvi & 64)!=0;
polje[2]=(prvi & 32)!=0;
polje[3]=(prvi & 16)!=0;
polje[4]=(prvi & 8)!=0;
polje[5]=(prvi & 4)!=0;
polje[6]=(prvi & 2)!=0;
polje[7]=(prvi & 1)!=0;
//printf("%d %d\n",prvi,drugi);
/*for(i=0;i<16;++i)
printf("%d ",polje[i]);
printf("\n");*/
//if(oktet!=0)printf("%d\n",oktet);
//int oktet=0;
mul();
for(i=0;i<8;++i)
if(rez[i]>0)c=1;
/*if(c)
{for(i=0;i<8;++i)
printf("%d ",rez[i]);
printf("\n");}*/
int corr=correction();
printf("%d ",corr);
/*if(corr==7) polje[7] = !polje[7];
if(corr==6) polje[6] = !polje[6];
if(corr==5) polje[5] = !polje[5];
if(corr==4) polje[4] = !polje[4];
if(corr==3) polje[3] = !polje[3];
if(corr==2) polje[2] = !polje[2];
if(corr==1) polje[1] = !polje[1];
if(corr==0) polje[0] = !polje[0];*/
unsigned int broj1 =0 ;
find = nadi(prvi);
if(c!=0)
{ //printf("NIJE DOBRO %d\n",oktet);
++losi;
//broj1=polje[15] + 2*polje[14] + 4*polje[13] + 8*polje[12] + 16*polje[11] + 32*polje[10] + 64*polje[9] + 128*polje[8];
}
else
{
++dobri;
broj1=find;
}
//printf("%d\n",broj1);
broj1=polje[7] + 2*polje[6] + 4*polje[5] + 8*polje[4] + 16*polje[3] + 32*polje[2] + 64*polje[1] + 128*polje[0];
//broj1=polje[15] + 2*polje[14] + 4*polje[13] + 8*polje[12] + 16*polje[11] + 32*polje[10] + 64*polje[9] + 128*polje[8];
//if(broj1!=0)printf("%d\n",broj1);
//unsigned int broj2=rez[15] + 2*rez[14] + 4*rez[13] + 8*rez[12] + 16*rez[11] + 32*rez[10] + 64*rez[9] + 128*rez[8];
//if(broj1!=0)printf("%d %d\n",broj1,find);
int br = fwrite(&broj1,sizeof(unsigned char),1,outputFile);
if(br!=1)printf("KOKOK\n");
//fwrite(&broj2,sizeof(unsigned short),1,outputFile);
}
printf("%d %d\n",dobri,losi);
}
int main(int argc, char *argv[])
{
FILE *inputFile = fopen(argv[1],"rb");
FILE *outputFile = fopen(argv[2],"wb");
solve(inputFile,outputFile);
fclose(inputFile);
fclose(outputFile);
return 0;
}
|
the_stack_data/68734.c | /*
* Filename : mem_init.c
*
* Memory Initialization
*
* Copyrights 2015 @ APTCHIP
*
*
*/
#include "string.h"
extern char _end_rodata[];
extern char _start_data[];
extern char _end_data[];
extern char _bss_start[];
extern char _ebss[];
void __main( void )
{
char *dst = _start_data;
char *src = _end_rodata;
/* if the start of data (dst)
is not equal to end of text (src) then
copy it, else it's already in the right place
*/
if( _start_data != _end_rodata ) {
// __memcpy_fast( dst, src, (_end_data - _start_data));
memcpy( dst, src, (_end_data - _start_data));
}
/* zero the bss
*/
if( _ebss - _bss_start ) {
// __memset_fast( _bss_start, 0x00, ( _ebss - _bss_start ));
memset( _bss_start, 0x00, ( _ebss - _bss_start ));
}
}
|
the_stack_data/25136922.c | // Copyright 2012 Rui Ueyama. Released under the MIT license.
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
void testmain(void);
// For test/extern.c
int externvar1 = 98;
int externvar2 = 99;
// For test/function.c
int booltest1(bool x) { return x; }
int oldstyle1(int x, int y) { return x + y; }
void print(char *s) {
printf("Testing %s ... ", s);
fflush(stdout);
}
void printfail() {
printf(isatty(fileno(stdout)) ? "\e[1;31mFailed\e[0m\n" : "Failed\n");
}
void ffail(char *file, int line, char *msg) {
printfail();
printf("%s:%d: %s\n", file, line, msg);
exit(1);
}
void fexpect(char *file, int line, int a, int b) {
if (a == b) return;
printfail();
printf("%s:%d: %d expected, but got %d\n", file, line, a, b);
exit(1);
}
void fexpect_string(char *file, int line, char *a, char *b) {
if (!strcmp(a, b)) return;
printfail();
printf("%s:%d: \"%s\" expected, but got \"%s\"\n", file, line, a, b);
exit(1);
}
void fexpectf(char *file, int line, float a, float b) {
if (a == b) return;
printfail();
printf("%s:%d: %f expected, but got %f\n", file, line, a, b);
exit(1);
}
void fexpectd(char *file, int line, double a, double b) {
if (a == b) return;
printfail();
printf("%s:%d: %lf expected, but got %lf\n", file, line, a, b);
exit(1);
}
void fexpectl(char *file, int line, long a, long b) {
if (a == b) return;
printfail();
printf("%s:%d: %ld expected, but got %ld\n", file, line, a, b);
exit(1);
}
int main() {
testmain();
printf(isatty(fileno(stdout)) ? "\e[32mOK\e[0m\n" : "OK\n");
return 0;
}
|
the_stack_data/184517835.c | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int i;
for (i=1; i<argc; i++) {
FILE *f;
int c;
f = fopen(argv[i], "r");
if (!f) {
perror(argv[i]);
exit(1);
}
while ((c = fgetc(f)) != EOF) {
if (putchar(c) < 0) exit(1);
}
}
exit(0);
}
|
the_stack_data/307791.c | #include <stdio.h>
void print_array(int *p);
int main(void) {
int arr[] = {12, 7, 33, 9, 15, 28, 11, 5, 38, 25, -1};
print_array(&arr[0]);
print_array(arr); /* 配列名を渡しても同じ値になることを確認する */
return 0;
}
// 〇関数の仕様
// 返却値型:返却値に基づいて設定
// 関数名 :print_array
// 引数1 : int *p 配列の先頭要素を指すポインタ
// 機能 :ポインタを用いて配列の先頭から順に画面出力する.
// 返却値 :なし
// ※ユーザ関数内の配列操作は,添え字演算子 []ではなく,ポインタを活用して実装すること.
void print_array(int *p){
for(int i=0;*(p+i)!=-1;i++){
printf("%d ",*(p+i));
}
putchar('\n');
} |
the_stack_data/787335.c | const char rawdev_skeleton_pmd_info[] __attribute__((used)) = "PMD_INFO_STRING= {\"name\" : \"rawdev_skeleton\", \"pci_ids\" : []}";
|
the_stack_data/170452553.c | /*Exercise 2 - Selection
Write a program to calculate the amount to be paid for a rented vehicle.
• Input the distance the van has travelled
• The first 30 km is at a rate of 50/= per km.
• The remaining distance is calculated at the rate of 40/= per km.
e.g.
Distance -> 20
Amount = 20 x 50 = 1000
Distance -> 50
Amount = 30 x 50 + (50-30) x 40 = 2300*/
#include <stdio.h>
int main() {
float dis,amount;
printf("Distance ->");
scanf("%f",&dis);
if(dis > 30)
{
amount=30*50 + (dis-30)*40;
}
if(dis <=30)
{
amount= 50*dis;
}
printf("Amount= %2f",amount);
return 0;
}
|
the_stack_data/167330229.c | #include <stdio.h>
#include <stdlib.h>
int main(void){
int board[6][6] = { 0 };
char stt[3] = { 0 };
char bef[3] = { 0 };
int sucess = 1;
for(int i=0;i<36;i++){
char s[3];
scanf(" %s", s);
if(s[0] < 'A' || 'F' < s[0] || s[1] < '1' || '6' < s[1]){
sucess = 0;
break;
}
if(i == 0){
stt[0] = s[0], stt[1] = s[1];
}else{
int x = abs(bef[0] - s[0]);
int y = abs(bef[1] - s[1]);
if(x>y) x = x ^ y, y = x ^ y, x = x ^ y;
if(!(x == 1 && y == 2)){
sucess = 0;
break;
}
if(i == 35){
x = abs(stt[0] - s[0]);
y = abs(stt[1] - s[1]);
if(x>y) x = x ^ y, y = x ^ y, x = x ^ y;
if(!(x == 1 && y == 2)){
sucess = 0;
break;
}
}
}
if(board[s[0]-'A'][s[1]-'1']){
sucess = 0;
break;
}
board[s[0]-'A'][s[1]-'1'] = 1;
bef[0] = s[0], bef[1] = s[1];
}
if(sucess) printf("Valid");
else printf("Invalid");
return 0;
}
|
the_stack_data/77678.c | /* { dg-do compile } */
/* { dg-options "-Wbool-compare" } */
#ifndef __cplusplus
# define bool _Bool
#endif
#define A 0
#define B 1
int
foo (int i, bool b)
{
int r = 0;
r += i <= (A || B);
r += i <= b;
r += i <= A;
r += i < (A || B);
r += i < b;
r += i < A;
r += i > (A || B);
r += i > b;
r += i > A;
r += i >= (A || B);
r += i >= b;
r += i >= A;
return r;
}
|
the_stack_data/62637645.c | // RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define hash_hash # ## #
#define mkstr(a) # a
#define in_between(a) mkstr(a)
#define join(c, d) in_between(c hash_hash d)
char p[] = join(x, y);
// CHECK: char p[] = "x ## y";
|
the_stack_data/220456697.c | /*
* Author: Andrew Wesie <[email protected]>
*
* Copyright (c) 2014 Kaprica Security, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
#include <stdlib.h>
int readuntil(int fd, char *buf, size_t n, char delim)
{
char *bufend = buf + n - 1;
int ret;
while (buf != bufend)
{
size_t rx;
if (receive(fd, buf, 1, &rx) != 0 || rx == 0)
break;
if (*buf == delim)
break;
buf++;
}
if (buf == bufend || *buf != delim)
return 1;
buf[1] = '\0';
return 0;
}
int writeall(int fd, const void *buf, size_t n)
{
const void *wptr = buf;
const void *bufend = buf + n;
while (wptr != bufend)
{
size_t tx;
if (transmit(fd, buf, bufend - wptr, &tx) != 0 || tx == 0)
break;
wptr += tx;
}
return wptr - buf;
}
|
the_stack_data/1100390.c | #include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
struct ai_4_20 {
uint8_t onoff :1;
uint8_t status : 2;
uint8_t val :5;
};
union {
struct ai_4_20 SA[2];
unsigned short us;
}un;
int main()
{
struct ai_4_20 AI_4_20[2];
int i;
AI_4_20[0].onoff=0;
AI_4_20[0].status=3;
AI_4_20[0].val=31;
AI_4_20[1].onoff=0;
AI_4_20[1].status=0;
AI_4_20[1].val=0;
un.SA[0] = AI_4_20[0];
un.SA[1] = AI_4_20[1];
printf("AI_4_20[0].onoff= %d\n", AI_4_20[0].onoff);
printf("AI_4_20[0].status= %d\n", AI_4_20[0].status);
printf("AI_4_20[0].val= %d\n", AI_4_20[0].val);
printf("AI_4_20[1].onoff= %d\n", AI_4_20[1].onoff);
printf("AI_4_20[1].status= %d\n", AI_4_20[1].status);
printf("AI_4_20[1].val= %d\n", AI_4_20[1].val);
printf("\nUnsigned short = %d\n", un.us);
for(i=16;i>0;i--)
{
if((i%8)==0) putchar(' ');
printf("%d", un.us&0x800);
un.us<<=1;
}
return 0;
}
|
the_stack_data/8039.c | #include <stdio.h>
int main() {
int a;
scanf("%d", &a);
if ( a % 2 != 1 ) {
printf("yes\n");
} else {
printf("no\n");
}
return 0;
}
// Считать с клавиатуры целое число.
// Если число нечётное, вывести на экран yes, в противном случае вывести no. |
the_stack_data/154827524.c | #include <unistd.h>
#include "syscall.h"
#ifndef PS4
int pipe(int fd[2])
{
#ifdef SYS_pipe
return syscall(SYS_pipe, fd);
#else
return syscall(SYS_pipe2, fd, 0);
#endif
}
#endif
|
the_stack_data/62638653.c | /*-
* Copyright (c) 2014 Michael Roe
* All rights reserved.
*
* This software was developed by SRI International and the University of
* Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
* ("CTSRD"), as part of the DARPA CRASH research programme.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Convert from raw bytes into Intel hex format
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#define BUFF_SIZE 1024
#define IHEX_DATA_RECORD 0
static record_bytes = 4;
char out_buff[BUFF_SIZE];
void write_record(char *data, int bytes, int addr)
{
char *in_ptr;
char *out_ptr;
int i;
int checksum;
int out_len;
out_ptr = out_buff;
*out_ptr = ':';
out_ptr++;
checksum = 0;
sprintf(out_ptr, "%02x", bytes);
out_ptr += 2;
checksum += bytes;
sprintf(out_ptr, "%04x", addr & 0xffff);
out_ptr += 4;
checksum += (addr & 0xff) + ((addr >> 8) & 0xff);
sprintf(out_ptr, "%02x", IHEX_DATA_RECORD);
out_ptr += 2;
checksum += IHEX_DATA_RECORD;
in_ptr = data + bytes - 1;
for (i=0; i<bytes; i++)
{
sprintf(out_ptr, "%02x", (unsigned char) *in_ptr);
out_ptr += 2;
checksum += (unsigned char) *in_ptr;
in_ptr--;
}
checksum = (checksum & 0xff) ^ 0xff;
checksum = (checksum +1 ) & 0xff;
sprintf(out_ptr, "%02x", checksum);
out_ptr += 2;
*out_ptr = '\0';
out_len = strlen(out_buff);
for (i=0; i<out_len; i++)
out_buff[i] = toupper(out_buff[i]);
printf("%s\n", out_buff);
}
void print_usage(char *progname)
{
fprintf(stderr, "Usage: %s [-w <bit width>] <filename>\n", progname);
}
int main(int argc, char **argv)
{
int opt;
FILE *f1;
int len;
char buff[BUFF_SIZE];
char *cp;
int addr;
int i;
while ((opt = getopt(argc, argv, "w:")) != -1)
{
switch (opt)
{
case 'w':
break;
default:
break;
}
}
if (optind >= argc)
{
print_usage(argv[0]);
return -1;
}
f1 = fopen(argv[optind], "r");
if (f1 == NULL)
{
fprintf(stderr, "Couldn't open %s\n", argv[optind]);
return -1;
}
addr = 0;
while ((len = fread(buff, 1, BUFF_SIZE, f1)) > 0)
{
cp = buff;
while (len >= record_bytes)
{
write_record(cp, record_bytes, addr);
len -= record_bytes;
cp += record_bytes;
addr++;
}
if (len > 0)
{
write_record(cp, len, 0);
}
}
printf(":00000001FF\n");
return (0);
}
|
the_stack_data/154828532.c | #include<stdio.h>
int i,j;
void read(int a[10][10],int c,int b);
void add(int a[10][10],int b[10][10],int n,int z);
void display(int a[10][10],int n,int z);
void multi(int a[20][10],int b[10][10],int z,int n);
void trans(int a[10][10],int z,int x);
void diago(int a[10][10],int c,int s);
void uptr(int a[01][10],int f,int r);
void main()
{
int mat1[10][10],mat2[10][10],sm,sum[10][10],n,z,ch,upper,k;
printf(" Enter the number of rows: ");
scanf("%d",&n);
printf(" Enter the number of coloums: ");
scanf("%d",&z);
printf(" Enter the elements of MATRIX 1\n");
read(mat1,n,z);
printf(" Enter the elements of MATRIX 2\n");
read(mat2,n,z);
printf("Matrix 1 is\n\n");
display(mat1,n,z);
printf("Matrix 2 is\n\n");
display(mat2,n,z);
printf(" \n1.sum \n2.Transpose \n3.sum of diagonal elements\n");
if(n==z)
printf(" \n4.multiplication \n5.find if the triangle is upper triangular");
scanf(" %d",&ch);
switch(ch)
{
case 1:
{
add(mat1,mat2,n,z);
}
break;
case 2:
{
multi(mat1,mat2,n,z);
}
break;
case 3:
{
printf(" \n The transpose of matrix1 is:\n");
trans(mat1,n,z);
printf("The transpose of Matrix 2 is\n\n");
trans(mat2,n,z);
}
break;
case 4:
{
printf(" The sum of diagonal elements of matrix 1 is");
diago(mat1,n,z);
printf(" The sum of diagonal elements of matrix 2 is");
diago(mat2,n,z);
}
break;
case 5:
{
uptr(mat1,n,z);
}
break;
default:
{
printf(" Please enter a valid choice");
break;
}
}
}
void add(int mat1[][10],int mat2[][10],int n,int z)
{
int i,j,sum[10][10];
printf(" sum of matrix is:\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=z;j++)
{
sum[i][j]=mat1[i][j]+mat2[i][j];
printf("%d ",sum[i][j]);
}
printf("\n");
}
}
void read(int mat1[][10],int n,int z)
{
for(i=1;i<=n;i++)
{
for(j=1;j<=z;j++)
{
printf(" Enter element A%d%d: ",i,j);
scanf("%d",&mat1[i][j]);
}
}
}
void display(int mat1[][10],int n,int z)
{
for(i=1;i<=n;i++)
{
for(j=1;j<=z;j++)
{
printf("%d ",mat1[i][j]);
}
printf("\n");
}
}
void multi(int mat1[][10],int mat2[][10],int n, int z)
{
int mul[10][10],k;
for(i=1;i<=n;i++)
{
for(j=1;j<=z;j++)
{
mul[i][j]=0;
for(k=1;k<=z;k++)
{
mul[i][j]=mul[i][j]+mat1[i][k]*mat2[k][j];
}
}
}
printf(" Multiplication of matrix is:\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=z;j++)
{
printf("%d ",mul[i][j]);
}
printf("\n");
}
}
void trans(int mat1[][10],int n,int z)
{
for(i=1;i<=n;i++)
{
for(j=1;j<=z;j++)
{
printf("%d ",mat1[j][i]);
}
printf("\n");
}
}
void diago(int mat1[][10],int n,int z)
{
int sm;
for(i=1;i<=n;i++)
{
sm=sm+mat1[i][i];
}
printf(": %d",sm);
}
void uptr(int mat1[][10],int n,int z)
{
int upper;
for(i=0;i<n;i++)
{
for(j=0;j<z;j++)
{
if(i>j&&mat1[i][j]==0)
{
upper=1;
upper++;
}
}
}
if(upper==3&&n==3&&z==3||upper==2)
{
printf("matrix is upper triangular\n");
}
else
{
printf("matrix is not upper triangularr\n");
}
}
|
the_stack_data/97012827.c | #include <stdio.h>
int main() {
int count = 1;
while (count <= 4) {
printf("%d ", count);
count++;
}
return 0;
} |
the_stack_data/331205.c | #include <stdio.h>
typedef void (*void_noargs)();
void foo() {
printf("Hello,");
}
void bar() {
printf(" offset");
}
int main(int argc, char *argv[]) {
void_noargs foo_ptr = foo;
long offset = (long) bar - (long) foo;
foo_ptr();
(foo_ptr + offset)();
printf(" %ld!\n", offset);
return 0;
}
|
the_stack_data/98328.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(int argc, char *argv[]){
int fd,ret;
unsigned int file_size;
char *file_buffer,*token;
char output_buffer[100];
fd = open(argv[1],O_RDONLY);
if(fd == -1){
printf("open() ERROR!\n");
exit(-1);
}
file_size = lseek(fd,0,SEEK_END);
if(file_size == -1 || file_size > 4294967296){
printf("lseek() ERROR!\n");
exit(-1);
}
ret = lseek(fd,0,SEEK_SET);
if(ret == -1){
printf("lseek() ERROR!\n");
exit(-1);
}
file_buffer = (char *)malloc(sizeof(char) * file_size);
if(file_buffer == NULL){
printf("malloc() ERROR!\n");
exit(-1);
}
ret = read(fd,file_buffer,file_size);
if(ret == -1){
printf("read() ERROR!\n");
exit(-1);
}
token = strtok(file_buffer," \n");
while(token != NULL){
strcpy(output_buffer,token);
puts(output_buffer);
token = strtok(NULL," \n");
}
return 0;
}
|
the_stack_data/243892794.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <pthread.h>
#define BUF_SIZE 100
#define MAX_CLNT 256
void* handle_clnt(void *arg);
void send_msg(int clnt_sock, char *msg, int len);
void error_handling(char *msg);
int clnt_cnt = 0;
int clnt_socks[MAX_CLNT];
pthread_mutex_t mutex;
int main(int argc, char *argv[]){
int serv_sock, clnt_sock;
struct sockaddr_in serv_adr, clnt_adr;
int clnt_adr_sz;
pthread_t t_id;
if(argc != 2){
printf("Usage : %s <port> \n", argv[0]);
exit(1);
}
pthread_mutex_init(&mutex, NULL);
serv_sock = socket(PF_INET, SOCK_STREAM, 0);
memset(&serv_adr, 0, sizeof(serv_adr));
serv_adr.sin_family = AF_INET;
serv_adr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_adr.sin_port = htons(atoi(argv[1]));
if(bind(serv_sock, (struct sockaddr*)&serv_adr, sizeof(serv_adr)) == -1)
error_handling("bind() error");
if(listen(serv_sock, 5) == -1)
error_handling("listen() error");
while(1){
clnt_adr_sz = sizeof(clnt_adr);
clnt_sock = accept(serv_sock, (struct sockaddr*)&clnt_adr, &clnt_adr_sz);
pthread_mutex_lock(&mutex);
clnt_socks[clnt_cnt++] = clnt_sock;
pthread_mutex_unlock(&mutex);
pthread_create(&t_id, NULL, handle_clnt, (void*)&clnt_sock);
pthread_detach(t_id);
printf("Connected client IP : %s\n", inet_ntoa(clnt_adr.sin_addr));
}
close(serv_sock);
return 0;
}
void* handle_clnt(void *arg){
int clnt_sock =*((int*)arg);
int str_len = 0, i;
char msg[BUF_SIZE];
while((str_len=read(clnt_sock, msg, sizeof(msg))) != 0)
send_msg(clnt_sock, msg, str_len);
pthread_mutex_lock(&mutex);
for(i = 0; i < clnt_cnt; i++){
if(clnt_sock == clnt_socks[i]){
while(i++ < clnt_cnt-1)
clnt_socks[i] = clnt_socks[i+1];
break;
}
}
clnt_cnt--;
pthread_mutex_unlock(&mutex);
close(clnt_sock);
return NULL;
}
void send_msg(int clnt_sock, char *msg, int len){
int i;
pthread_mutex_lock(&mutex);
for(i = 0; i < clnt_cnt; i++)
if(clnt_sock != clnt_socks[i])
write(clnt_socks[i], msg, len);
pthread_mutex_unlock(&mutex);
}
void error_handling(char *msg){
fputs(msg, stderr);
fputc('\n', stderr);
exit(1);
}
|
the_stack_data/140764968.c | /*
URI Online Judge | 1174
Array Selection I
Adapted by Neilor Tonin, URI Brazil
https://www.urionlinejudge.com.br/judge/en/problems/view/1174
Timelimit: 1
In this problem, your task is to read an array A[100]. At the end, print all array positions that store a number less or equal to 10 and the number stored in that position.
Input
The input contains 100 numbers. Each number can be integer, floating-point number, positive or negative.
Output
For each number of the array that is equal to 10 or less, print "A [i] = x", where i is the position of the array and x is the number stored in the position, with one digit after the decimal point.
@author Marcos Lima
@profile https://www.urionlinejudge.com.br/judge/pt/profile/242402
@status Accepted
@language C (gcc 4.8.5, -O2 -lm) [+0s]
@time 0.000s
@size 248 Bytes
@submission 12/22/19, 4:20:45 PM
*/
#include <stdio.h>
int main()
{
double x;
unsigned char i = 0;
for (; i < 100; i++) {
scanf("%lf", &x);
if (x < 10.00000000000001)
printf("A[%hhu] = %.1lf\n", i, x);
}
return 0;
} |
the_stack_data/1247229.c | /*
FFTE: A FAST FOURIER TRANSFORM PACKAGE
(C) COPYRIGHT SOFTWARE, 2000-2004, 2008-2014, ALL RIGHTS RESERVED
BY
DAISUKE TAKAHASHI
FACULTY OF ENGINEERING, INFORMATION AND SYSTEMS
UNIVERSITY OF TSUKUBA
1-1-1 TENNODAI, TSUKUBA, IBARAKI 305-8573, JAPAN
E-MAIL: [email protected]
WRITTEN BY DAISUKE TAKAHASHI
THIS KERNEL WAS GENERATED BY SPIRAL 8.2.0a03
*/
void dft20c_(double *Y, double *X, int *lp1, int *mp1) {
static double D23[40];
double s1534, s1535, s1536, s1537, s1538, s1539, s1540, s1541,
s1542, s1543, s1544, s1545, s1546, s1547, s1548, s1549,
s1550, s1551, s1552, s1553, s1554, s1555, s1556, s1557,
s1558, s1559, s1560, s1561, s1562, s1563, s1564, s1565,
s1566, s1567, s1568, s1569, s1570, s1571, s1572, s1573,
s1574, s1575, s1576, s1577, s1578, s1579, s1580, s1581,
s1582, s1583, s1584, s1585, s1586, s1587, s1588, s1589,
s1590, s1591, s1592, s1593, s1594, s1595, s1596, s1597,
s1598, s1599, s1600, s1601, s1602, s1603, s1604, s1605,
s1606, s1607, s1608, s1609, s1610, s1611, s1612, s1613,
s1614, s1615, s1616, s1617, s1618, s1619, s1620, s1621,
s1622, s1623, s1624, s1625, s1626, s1627, s1628, s1629,
s1630, s1631, s1632, s1633, s1634, s1635, s1636, s1637,
t2886, t2887, t2888, t2889, t2890, t2891, t2892, t2893,
t2894, t2895, t2896, t2897, t2898, t2899, t2900, t2901,
t2902, t2903, t2904, t2905, t2906, t2907, t2908, t2909,
t2910, t2911, t2912, t2913, t2914, t2915, t2916, t2917,
t2918, t2919, t2920, t2921, t2922, t2923, t2924, t2925,
t2926, t2927, t2928, t2929, t2930, t2931, t2932, t2933,
t2934, t2935, t2936, t2937, t2938, t2939, t2940, t2941,
t2942, t2943, t2944, t2945, t2946, t2947, t2948, t2949,
t2950, t2951, t2952, t2953, t2954, t2955, t2956, t2957,
t2958, t2959, t2960, t2961, t2962, t2963, t2964, t2965,
t2966, t2967, t2968, t2969, t2970, t2971, t2972, t2973,
t2974, t2975, t2976, t2977, t2978, t2979, t2980, t2981,
t2982, t2983, t2984, t2985, t2986, t2987, t2988, t2989,
t2990, t2991, t2992, t2993, t2994, t2995, t2996, t2997,
t2998, t2999, t3000, t3001, t3002, t3003, t3004, t3005,
t3006, t3007, t3008, t3009, t3010, t3011, t3012, t3013,
t3014, t3015, t3016, t3017, t3018, t3019, t3020, t3021,
t3022, t3023, t3024, t3025, t3026, t3027, t3028, t3029,
t3030, t3031, t3032, t3033, t3034, t3035, t3036, t3037,
t3038, t3039, t3040, t3041, t3042, t3043, t3044, t3045,
t3046, t3047, t3048, t3049, t3050, t3051, t3052, t3053,
t3054, t3055, t3056, t3057, t3058, t3059, t3060, t3061;
int a3425, a3426, a3427, a3428, a3429, a3430, a3431, a3432,
a3433, a3434, a3435, a3436, a3437, a3438, a3439, a3440,
a3441, a3442, a3443, a3444, a3445, a3446, a3447, a3448,
a3449, a3450, a3451, a3452, a3453, a3454, a3455, a3456,
a3457, a3458, a3459, a3460, a3461, a3462, a3463, a3464,
b83, l1, m1;
l1 = *(lp1);
m1 = *(mp1);
for(int k1 = 0; k1 < m1; k1++) {
a3425 = (2*k1);
s1534 = X[a3425];
a3426 = (a3425 + 1);
s1535 = X[a3426];
b83 = (l1*m1);
a3427 = (a3425 + (2*b83));
s1536 = X[a3427];
s1537 = X[(a3427 + 1)];
a3428 = (a3425 + (4*b83));
s1538 = X[a3428];
s1539 = X[(a3428 + 1)];
a3429 = (a3425 + (6*b83));
s1540 = X[a3429];
s1541 = X[(a3429 + 1)];
a3430 = (a3425 + (8*b83));
s1542 = X[a3430];
s1543 = X[(a3430 + 1)];
a3431 = (a3425 + (10*b83));
s1544 = X[a3431];
s1545 = X[(a3431 + 1)];
a3432 = (a3425 + (12*b83));
s1546 = X[a3432];
s1547 = X[(a3432 + 1)];
a3433 = (a3425 + (14*b83));
s1548 = X[a3433];
s1549 = X[(a3433 + 1)];
a3434 = (a3425 + (16*b83));
s1550 = X[a3434];
s1551 = X[(a3434 + 1)];
a3435 = (a3425 + (18*b83));
s1552 = X[a3435];
s1553 = X[(a3435 + 1)];
a3436 = (a3425 + (20*b83));
s1554 = X[a3436];
s1555 = X[(a3436 + 1)];
a3437 = (a3425 + (22*b83));
s1556 = X[a3437];
s1557 = X[(a3437 + 1)];
a3438 = (a3425 + (24*b83));
s1558 = X[a3438];
s1559 = X[(a3438 + 1)];
a3439 = (a3425 + (26*b83));
s1560 = X[a3439];
s1561 = X[(a3439 + 1)];
a3440 = (a3425 + (28*b83));
s1562 = X[a3440];
s1563 = X[(a3440 + 1)];
a3441 = (a3425 + (30*b83));
s1564 = X[a3441];
s1565 = X[(a3441 + 1)];
a3442 = (a3425 + (32*b83));
s1566 = X[a3442];
s1567 = X[(a3442 + 1)];
a3443 = (a3425 + (34*b83));
s1568 = X[a3443];
s1569 = X[(a3443 + 1)];
a3444 = (a3425 + (36*b83));
s1570 = X[a3444];
s1571 = X[(a3444 + 1)];
a3445 = (a3425 + (38*b83));
s1572 = X[a3445];
s1573 = X[(a3445 + 1)];
t2886 = (s1534 + s1554);
t2887 = (s1535 + s1555);
t2888 = (s1534 - s1554);
t2889 = (s1535 - s1555);
t2890 = (s1544 + s1564);
t2891 = (s1545 + s1565);
t2892 = (s1544 - s1564);
t2893 = (s1545 - s1565);
t2894 = (t2886 + t2890);
t2895 = (t2887 + t2891);
t2896 = (t2886 - t2890);
t2897 = (t2887 - t2891);
s1574 = ((D23[0]*t2894) - (D23[1]*t2895));
s1575 = ((D23[1]*t2894) + (D23[0]*t2895));
s1576 = ((D23[2]*t2896) - (D23[3]*t2897));
s1577 = ((D23[3]*t2896) + (D23[2]*t2897));
t2898 = (t2888 + t2893);
t2899 = (t2889 - t2892);
t2900 = (t2888 - t2893);
t2901 = (t2889 + t2892);
s1578 = ((D23[4]*t2898) - (D23[5]*t2899));
s1579 = ((D23[5]*t2898) + (D23[4]*t2899));
s1580 = ((D23[6]*t2900) - (D23[7]*t2901));
s1581 = ((D23[7]*t2900) + (D23[6]*t2901));
t2902 = (s1536 + s1556);
t2903 = (s1537 + s1557);
t2904 = (s1536 - s1556);
t2905 = (s1537 - s1557);
t2906 = (s1546 + s1566);
t2907 = (s1547 + s1567);
t2908 = (s1546 - s1566);
t2909 = (s1547 - s1567);
t2910 = (t2902 + t2906);
t2911 = (t2903 + t2907);
t2912 = (t2902 - t2906);
t2913 = (t2903 - t2907);
s1582 = ((D23[8]*t2910) - (D23[9]*t2911));
s1583 = ((D23[9]*t2910) + (D23[8]*t2911));
s1584 = ((D23[10]*t2912) - (D23[11]*t2913));
s1585 = ((D23[11]*t2912) + (D23[10]*t2913));
t2914 = (t2904 + t2909);
t2915 = (t2905 - t2908);
t2916 = (t2904 - t2909);
t2917 = (t2905 + t2908);
s1586 = ((D23[12]*t2914) - (D23[13]*t2915));
s1587 = ((D23[13]*t2914) + (D23[12]*t2915));
s1588 = ((D23[14]*t2916) - (D23[15]*t2917));
s1589 = ((D23[15]*t2916) + (D23[14]*t2917));
t2918 = (s1538 + s1558);
t2919 = (s1539 + s1559);
t2920 = (s1538 - s1558);
t2921 = (s1539 - s1559);
t2922 = (s1548 + s1568);
t2923 = (s1549 + s1569);
t2924 = (s1548 - s1568);
t2925 = (s1549 - s1569);
t2926 = (t2918 + t2922);
t2927 = (t2919 + t2923);
t2928 = (t2918 - t2922);
t2929 = (t2919 - t2923);
s1590 = ((D23[16]*t2926) - (D23[17]*t2927));
s1591 = ((D23[17]*t2926) + (D23[16]*t2927));
s1592 = ((D23[18]*t2928) - (D23[19]*t2929));
s1593 = ((D23[19]*t2928) + (D23[18]*t2929));
t2930 = (t2920 + t2925);
t2931 = (t2921 - t2924);
t2932 = (t2920 - t2925);
t2933 = (t2921 + t2924);
s1594 = ((D23[20]*t2930) - (D23[21]*t2931));
s1595 = ((D23[21]*t2930) + (D23[20]*t2931));
s1596 = ((D23[22]*t2932) - (D23[23]*t2933));
s1597 = ((D23[23]*t2932) + (D23[22]*t2933));
t2934 = (s1540 + s1560);
t2935 = (s1541 + s1561);
t2936 = (s1540 - s1560);
t2937 = (s1541 - s1561);
t2938 = (s1550 + s1570);
t2939 = (s1551 + s1571);
t2940 = (s1550 - s1570);
t2941 = (s1551 - s1571);
t2942 = (t2934 + t2938);
t2943 = (t2935 + t2939);
t2944 = (t2934 - t2938);
t2945 = (t2935 - t2939);
s1598 = ((D23[24]*t2942) - (D23[25]*t2943));
s1599 = ((D23[25]*t2942) + (D23[24]*t2943));
s1600 = ((D23[26]*t2944) - (D23[27]*t2945));
s1601 = ((D23[27]*t2944) + (D23[26]*t2945));
t2946 = (t2936 + t2941);
t2947 = (t2937 - t2940);
t2948 = (t2936 - t2941);
t2949 = (t2937 + t2940);
s1602 = ((D23[28]*t2946) - (D23[29]*t2947));
s1603 = ((D23[29]*t2946) + (D23[28]*t2947));
s1604 = ((D23[30]*t2948) - (D23[31]*t2949));
s1605 = ((D23[31]*t2948) + (D23[30]*t2949));
t2950 = (s1542 + s1562);
t2951 = (s1543 + s1563);
t2952 = (s1542 - s1562);
t2953 = (s1543 - s1563);
t2954 = (s1552 + s1572);
t2955 = (s1553 + s1573);
t2956 = (s1552 - s1572);
t2957 = (s1553 - s1573);
t2958 = (t2950 + t2954);
t2959 = (t2951 + t2955);
t2960 = (t2950 - t2954);
t2961 = (t2951 - t2955);
s1606 = ((D23[32]*t2958) - (D23[33]*t2959));
s1607 = ((D23[33]*t2958) + (D23[32]*t2959));
s1608 = ((D23[34]*t2960) - (D23[35]*t2961));
s1609 = ((D23[35]*t2960) + (D23[34]*t2961));
t2962 = (t2952 + t2957);
t2963 = (t2953 - t2956);
t2964 = (t2952 - t2957);
t2965 = (t2953 + t2956);
s1610 = ((D23[36]*t2962) - (D23[37]*t2963));
s1611 = ((D23[37]*t2962) + (D23[36]*t2963));
s1612 = ((D23[38]*t2964) - (D23[39]*t2965));
s1613 = ((D23[39]*t2964) + (D23[38]*t2965));
t2966 = (s1582 + s1606);
t2967 = (s1583 + s1607);
t2968 = (s1582 - s1606);
t2969 = (s1583 - s1607);
t2970 = (s1590 + s1598);
t2971 = (s1591 + s1599);
t2972 = (s1590 - s1598);
t2973 = (s1591 - s1599);
t2974 = (t2966 + t2970);
t2975 = (t2967 + t2971);
t2976 = (t2968 + t2973);
t2977 = (t2969 - t2972);
t2978 = (t2968 - t2973);
t2979 = (t2969 + t2972);
t2980 = (s1574 - (0.25*t2974));
t2981 = (s1575 - (0.25*t2975));
s1614 = ((0.29389262614623657*t2976) + (0.47552825814757677*t2977));
s1615 = ((0.29389262614623657*t2977) - (0.47552825814757677*t2976));
s1616 = (0.55901699437494745*(t2966 - t2970));
s1617 = (0.55901699437494745*(t2967 - t2971));
s1618 = ((0.47552825814757682*t2979) - (0.29389262614623657*t2978));
s1619 = ((0.47552825814757682*t2978) + (0.29389262614623657*t2979));
t2982 = (t2980 + s1616);
t2983 = (t2981 + s1617);
t2984 = (t2980 - s1616);
t2985 = (t2981 - s1617);
t2986 = (s1614 + s1618);
t2987 = (s1615 - s1619);
t2988 = (s1614 - s1618);
t2989 = (s1615 + s1619);
t2990 = (s1586 + s1610);
t2991 = (s1587 + s1611);
t2992 = (s1586 - s1610);
t2993 = (s1587 - s1611);
t2994 = (s1594 + s1602);
t2995 = (s1595 + s1603);
t2996 = (s1594 - s1602);
t2997 = (s1595 - s1603);
t2998 = (t2990 + t2994);
t2999 = (t2991 + t2995);
t3000 = (t2992 + t2997);
t3001 = (t2993 - t2996);
t3002 = (t2992 - t2997);
t3003 = (t2993 + t2996);
t3004 = (s1578 - (0.25*t2998));
t3005 = (s1579 - (0.25*t2999));
s1620 = ((0.29389262614623657*t3000) + (0.47552825814757677*t3001));
s1621 = ((0.29389262614623657*t3001) - (0.47552825814757677*t3000));
s1622 = (0.55901699437494745*(t2990 - t2994));
s1623 = (0.55901699437494745*(t2991 - t2995));
s1624 = ((0.47552825814757682*t3003) - (0.29389262614623657*t3002));
s1625 = ((0.47552825814757682*t3002) + (0.29389262614623657*t3003));
t3006 = (t3004 + s1622);
t3007 = (t3005 + s1623);
t3008 = (t3004 - s1622);
t3009 = (t3005 - s1623);
t3010 = (s1620 + s1624);
t3011 = (s1621 - s1625);
t3012 = (s1620 - s1624);
t3013 = (s1621 + s1625);
t3014 = (s1584 + s1608);
t3015 = (s1585 + s1609);
t3016 = (s1584 - s1608);
t3017 = (s1585 - s1609);
t3018 = (s1592 + s1600);
t3019 = (s1593 + s1601);
t3020 = (s1592 - s1600);
t3021 = (s1593 - s1601);
t3022 = (t3014 + t3018);
t3023 = (t3015 + t3019);
t3024 = (t3016 + t3021);
t3025 = (t3017 - t3020);
t3026 = (t3016 - t3021);
t3027 = (t3017 + t3020);
t3028 = (s1576 - (0.25*t3022));
t3029 = (s1577 - (0.25*t3023));
s1626 = ((0.29389262614623657*t3024) + (0.47552825814757677*t3025));
s1627 = ((0.29389262614623657*t3025) - (0.47552825814757677*t3024));
s1628 = (0.55901699437494745*(t3014 - t3018));
s1629 = (0.55901699437494745*(t3015 - t3019));
s1630 = ((0.47552825814757682*t3027) - (0.29389262614623657*t3026));
s1631 = ((0.47552825814757682*t3026) + (0.29389262614623657*t3027));
t3030 = (t3028 + s1628);
t3031 = (t3029 + s1629);
t3032 = (t3028 - s1628);
t3033 = (t3029 - s1629);
t3034 = (s1626 + s1630);
t3035 = (s1627 - s1631);
t3036 = (s1626 - s1630);
t3037 = (s1627 + s1631);
t3038 = (s1588 + s1612);
t3039 = (s1589 + s1613);
t3040 = (s1588 - s1612);
t3041 = (s1589 - s1613);
t3042 = (s1596 + s1604);
t3043 = (s1597 + s1605);
t3044 = (s1596 - s1604);
t3045 = (s1597 - s1605);
t3046 = (t3038 + t3042);
t3047 = (t3039 + t3043);
t3048 = (t3040 + t3045);
t3049 = (t3041 - t3044);
t3050 = (t3040 - t3045);
t3051 = (t3041 + t3044);
t3052 = (s1580 - (0.25*t3046));
t3053 = (s1581 - (0.25*t3047));
s1632 = ((0.29389262614623657*t3048) + (0.47552825814757677*t3049));
s1633 = ((0.29389262614623657*t3049) - (0.47552825814757677*t3048));
s1634 = (0.55901699437494745*(t3038 - t3042));
s1635 = (0.55901699437494745*(t3039 - t3043));
s1636 = ((0.47552825814757682*t3051) - (0.29389262614623657*t3050));
s1637 = ((0.47552825814757682*t3050) + (0.29389262614623657*t3051));
t3054 = (t3052 + s1634);
t3055 = (t3053 + s1635);
t3056 = (t3052 - s1634);
t3057 = (t3053 - s1635);
t3058 = (s1632 + s1636);
t3059 = (s1633 - s1637);
t3060 = (s1632 - s1636);
t3061 = (s1633 + s1637);
Y[a3425] = (s1574 + t2974);
Y[a3426] = (s1575 + t2975);
a3446 = (a3425 + (2*m1));
Y[a3446] = (s1578 + t2998);
Y[(a3446 + 1)] = (s1579 + t2999);
a3447 = (a3425 + (4*m1));
Y[a3447] = (s1576 + t3022);
Y[(a3447 + 1)] = (s1577 + t3023);
a3448 = (a3425 + (6*m1));
Y[a3448] = (s1580 + t3046);
Y[(a3448 + 1)] = (s1581 + t3047);
a3449 = (a3425 + (8*m1));
Y[a3449] = (t2982 + t2986);
Y[(a3449 + 1)] = (t2983 + t2987);
a3450 = (a3425 + (10*m1));
Y[a3450] = (t3006 + t3010);
Y[(a3450 + 1)] = (t3007 + t3011);
a3451 = (a3425 + (12*m1));
Y[a3451] = (t3030 + t3034);
Y[(a3451 + 1)] = (t3031 + t3035);
a3452 = (a3425 + (14*m1));
Y[a3452] = (t3054 + t3058);
Y[(a3452 + 1)] = (t3055 + t3059);
a3453 = (a3425 + (16*m1));
Y[a3453] = (t2984 + t2989);
Y[(a3453 + 1)] = (t2985 - t2988);
a3454 = (a3425 + (18*m1));
Y[a3454] = (t3008 + t3013);
Y[(a3454 + 1)] = (t3009 - t3012);
a3455 = (a3425 + (20*m1));
Y[a3455] = (t3032 + t3037);
Y[(a3455 + 1)] = (t3033 - t3036);
a3456 = (a3425 + (22*m1));
Y[a3456] = (t3056 + t3061);
Y[(a3456 + 1)] = (t3057 - t3060);
a3457 = (a3425 + (24*m1));
Y[a3457] = (t2984 - t2989);
Y[(a3457 + 1)] = (t2985 + t2988);
a3458 = (a3425 + (26*m1));
Y[a3458] = (t3008 - t3013);
Y[(a3458 + 1)] = (t3009 + t3012);
a3459 = (a3425 + (28*m1));
Y[a3459] = (t3032 - t3037);
Y[(a3459 + 1)] = (t3033 + t3036);
a3460 = (a3425 + (30*m1));
Y[a3460] = (t3056 - t3061);
Y[(a3460 + 1)] = (t3057 + t3060);
a3461 = (a3425 + (32*m1));
Y[a3461] = (t2982 - t2986);
Y[(a3461 + 1)] = (t2983 - t2987);
a3462 = (a3425 + (34*m1));
Y[a3462] = (t3006 - t3010);
Y[(a3462 + 1)] = (t3007 - t3011);
a3463 = (a3425 + (36*m1));
Y[a3463] = (t3030 - t3034);
Y[(a3463 + 1)] = (t3031 - t3035);
a3464 = (a3425 + (38*m1));
Y[a3464] = (t3054 - t3058);
Y[(a3464 + 1)] = (t3055 - t3059);
}
}
|
the_stack_data/90766901.c | // General tests that ld invocations on Linux targets sane. Note that we use
// sysroot to make these tests independent of the host system.
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
// CHECK-LD-32-NOT: warning:
// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
// CHECK-LD-32: "-L[[SYSROOT]]/lib"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD-64 %s
// CHECK-LD-64-NOT: warning:
// CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-LD-64: "--eh-frame-hdr"
// CHECK-LD-64: "-m" "elf_x86_64"
// CHECK-LD-64: "-dynamic-linker"
// CHECK-LD-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
// CHECK-LD-64: "-L[[SYSROOT]]/lib"
// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
// CHECK-LD-64: "-lc"
// CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-unknown-linux \
// RUN: -static-libgcc \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC-LIBGCC %s
// CHECK-LD-64-STATIC-LIBGCC-NOT: warning:
// CHECK-LD-64-STATIC-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-LD-64-STATIC-LIBGCC: "--eh-frame-hdr"
// CHECK-LD-64-STATIC-LIBGCC: "-m" "elf_x86_64"
// CHECK-LD-64-STATIC-LIBGCC: "-dynamic-linker"
// CHECK-LD-64-STATIC-LIBGCC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/lib"
// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
// CHECK-LD-64-STATIC-LIBGCC: "-lc"
// CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-unknown-linux \
// RUN: -static \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC %s
// CHECK-LD-64-STATIC-NOT: warning:
// CHECK-LD-64-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-LD-64-STATIC-NOT: "--eh-frame-hdr"
// CHECK-LD-64-STATIC: "-m" "elf_x86_64"
// CHECK-LD-64-STATIC-NOT: "-dynamic-linker"
// CHECK-LD-64-STATIC: "-static"
// CHECK-LD-64-STATIC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbeginT.o"
// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/lib"
// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD-64-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
//
// Check that flags can be combined. The -static dominates.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-unknown-linux \
// RUN: -static-libgcc -static \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC %s
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux -m32 \
// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-32-TO-32 %s
// CHECK-32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-32-TO-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib32"
// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib32"
// CHECK-32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
// CHECK-32-TO-32: "-L[[SYSROOT]]/lib"
// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux -m64 \
// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-32-TO-64 %s
// CHECK-32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-32-TO-64: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/64{{/|\\\\}}crtbegin.o"
// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/64"
// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib64"
// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib64"
// CHECK-32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
// CHECK-32-TO-64: "-L[[SYSROOT]]/lib"
// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-unknown-linux -m64 \
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-64-TO-64 %s
// CHECK-64-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-64-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib64"
// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib64"
// CHECK-64-TO-64: "-L[[SYSROOT]]/lib/../lib64"
// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
// CHECK-64-TO-64: "-L[[SYSROOT]]/lib"
// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-unknown-linux -m32 \
// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-64-TO-32 %s
// CHECK-64-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-64-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32{{/|\\\\}}crtbegin.o"
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib32"
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib32"
// CHECK-64-TO-32: "-L[[SYSROOT]]/lib/../lib32"
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
// CHECK-64-TO-32: "-L[[SYSROOT]]/lib"
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-unknown-linux -m32 \
// RUN: --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \
// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-64-TO-32-SYSROOT %s
// CHECK-64-TO-32-SYSROOT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-64-TO-32-SYSROOT: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32{{/|\\\\}}crtbegin.o"
// CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib/../lib32"
// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib/../lib32"
// CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib"
// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux -m32 \
// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-32 %s
// CHECK-INSTALL-DIR-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-INSTALL-DIR-32: "{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0{{/|\\\\}}crtbegin.o"
// CHECK-INSTALL-DIR-32: "-L{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0"
//
// Check that with 64-bit builds, we don't actually use the install directory
// as its version of GCC is lower than our sysrooted version.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-unknown-linux -m64 \
// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-64 %s
// CHECK-INSTALL-DIR-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-INSTALL-DIR-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
// CHECK-INSTALL-DIR-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
//
// Check that we support unusual patch version formats, including missing that
// component.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux -m32 \
// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing1/bin \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION1 %s
// CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-GCC-VERSION1: "{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7{{/|\\\\}}crtbegin.o"
// CHECK-GCC-VERSION1: "-L{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux -m32 \
// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing2/bin \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION2 %s
// CHECK-GCC-VERSION2: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-GCC-VERSION2: "{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x{{/|\\\\}}crtbegin.o"
// CHECK-GCC-VERSION2: "-L{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux -m32 \
// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing3/bin \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION3 %s
// CHECK-GCC-VERSION3: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-GCC-VERSION3: "{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5{{/|\\\\}}crtbegin.o"
// CHECK-GCC-VERSION3: "-L{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux -m32 \
// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing4/bin \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION4 %s
// CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99{{/|\\\\}}crtbegin.o"
// CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99"
//
// Test a very broken version of multiarch that shipped in Ubuntu 11.04.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-unknown-linux \
// RUN: --sysroot=%S/Inputs/ubuntu_11.04_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-11-04 %s
// CHECK-UBUNTU-11-04: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-UBUNTU-11-04: "{{.*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu"
// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/lib"
// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib"
//
// Check multi arch support on Ubuntu 12.04 LTS.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-unknown-linux-gnueabihf \
// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM-HF %s
// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crt1.o"
// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crti.o"
// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3{{/|\\\\}}crtbegin.o"
// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3"
// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf"
// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/lib/arm-linux-gnueabihf"
// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabihf"
// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../.."
// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3{{/|\\\\}}crtend.o"
// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crtn.o"
//
// Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabihf.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-gnueabihf \
// RUN: --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
// RUN: | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM-HF %s
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crt1.o"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crti.o"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtbegin.o"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/lib/../lib"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/../lib"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtend.o"
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crtn.o"
//
// Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabi.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-gnueabi \
// RUN: --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
// RUN: | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM %s
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-X86-64-UBUNTU-13-10-ARM: "-dynamic-linker" "/lib/ld-linux.so.3"
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crt1.o"
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crti.o"
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtbegin.o"
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7"
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib"
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/lib/../lib"
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/../lib"
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib"
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtend.o"
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crtn.o"
//
// Check fedora 18 on arm.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=armv7-unknown-linux-gnueabihf \
// RUN: --sysroot=%S/Inputs/fedora_18_tree \
// RUN: | FileCheck --check-prefix=CHECK-FEDORA-18-ARM-HF %s
// CHECK-FEDORA-18-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crt1.o"
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crti.o"
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtbegin.o"
// CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2"
// CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib"
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtend.o"
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crtn.o"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-unknown-linux-gnueabi \
// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM %s
// CHECK-UBUNTU-12-04-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi{{/|\\\\}}crt1.o"
// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi{{/|\\\\}}crti.o"
// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1{{/|\\\\}}crtbegin.o"
// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1"
// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi"
// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/lib/arm-linux-gnueabi"
// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabi"
// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../.."
// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1{{/|\\\\}}crtend.o"
// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi{{/|\\\\}}crtn.o"
//
// Test the setup that shipped in SUSE 10.3 on ppc64.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=powerpc64-suse-linux \
// RUN: --sysroot=%S/Inputs/suse_10.3_ppc64_tree \
// RUN: | FileCheck --check-prefix=CHECK-SUSE-10-3-PPC64 %s
// CHECK-SUSE-10-3-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-SUSE-10-3-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64{{/|\\\\}}crtbegin.o"
// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64"
// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/../../../../lib64"
// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
//
// Check dynamic-linker for different archs
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-gnueabi \
// RUN: | FileCheck --check-prefix=CHECK-ARM %s
// CHECK-ARM: "{{.*}}ld{{(.exe)?}}"
// CHECK-ARM: "-m" "armelf_linux_eabi"
// CHECK-ARM: "-dynamic-linker" "{{.*}}/lib/ld-linux.so.3"
//
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-gnueabihf \
// RUN: | FileCheck --check-prefix=CHECK-ARM-HF %s
// CHECK-ARM-HF: "{{.*}}ld{{(.exe)?}}"
// CHECK-ARM-HF: "-m" "armelf_linux_eabi"
// CHECK-ARM-HF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3"
//
// Check that we do not pass --hash-style=gnu and --hash-style=both to linker
// and provide correct path to the dynamic linker and emulation mode when build
// for MIPS platforms.
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=mips-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-MIPS %s
// CHECK-MIPS: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPS: "-m" "elf32btsmip"
// CHECK-MIPS: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
// CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=mipsel-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-MIPSEL %s
// CHECK-MIPSEL: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPSEL: "-m" "elf32ltsmip"
// CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
// CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=mips64-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-MIPS64 %s
// CHECK-MIPS64: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPS64: "-m" "elf64btsmip"
// CHECK-MIPS64: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
// CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=mips64el-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL %s
// CHECK-MIPS64EL: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPS64EL: "-m" "elf64ltsmip"
// CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
// CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=mips64-linux-gnu -mabi=n32 \
// RUN: | FileCheck --check-prefix=CHECK-MIPS64-N32 %s
// CHECK-MIPS64-N32: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPS64-N32: "-m" "elf32btsmipn32"
// CHECK-MIPS64-N32: "-dynamic-linker" "{{.*}}/lib32/ld.so.1"
// CHECK-MIPS64-N32-NOT: "--hash-style={{gnu|both}}"
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=mips64el-linux-gnu -mabi=n32 \
// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-N32 %s
// CHECK-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPS64EL-N32: "-m" "elf32ltsmipn32"
// CHECK-MIPS64EL-N32: "-dynamic-linker" "{{.*}}/lib32/ld.so.1"
// CHECK-MIPS64EL-N32-NOT: "--hash-style={{gnu|both}}"
//
// Thoroughly exercise the Debian multiarch environment.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i686-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86 %s
// CHECK-DEBIAN-X86: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-X86: "{{.*}}/usr/lib/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5"
// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../i386-linux-gnu"
// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86-64 %s
// CHECK-DEBIAN-X86-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-X86-64: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5"
// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../x86_64-linux-gnu"
// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/x86_64-linux-gnu"
// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=powerpc-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC %s
// CHECK-DEBIAN-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-PPC: "{{.*}}/usr/lib/gcc/powerpc-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5"
// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../powerpc-linux-gnu"
// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/powerpc-linux-gnu"
// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=powerpc64-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC64 %s
// CHECK-DEBIAN-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5"
// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../powerpc64-linux-gnu"
// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/powerpc64-linux-gnu"
// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS %s
// CHECK-DEBIAN-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-MIPS: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../../mips-linux-gnu"
// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/mips-linux-gnu"
// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mipsel-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPSEL %s
// CHECK-DEBIAN-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../../mipsel-linux-gnu"
// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/mipsel-linux-gnu"
// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64 %s
// CHECK-DEBIAN-MIPS64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-MIPS64: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/64{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/64"
// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64el-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL %s
// CHECK-DEBIAN-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/64{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/64"
// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64-linux-gnu -mabi=n32 \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64-N32 %s
// CHECK-DEBIAN-MIPS64-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-MIPS64-N32: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/n32{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/n32"
// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64el-linux-gnu -mabi=n32 \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL-N32 %s
// CHECK-DEBIAN-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/n32{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/n32"
// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
//
// Test linker invocation on Android.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mipsel-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
// CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
// CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib"
// CHECK-ANDROID-NOT: "gcc_s"
// CHECK-ANDROID: "-lgcc"
// CHECK-ANDROID: "-ldl"
// CHECK-ANDROID-NOT: "gcc_s"
// CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtend_android.o"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mipsel-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
// CHECK-ANDROID-SO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-ANDROID-SO: "-Bsymbolic"
// CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtbegin_so.o"
// CHECK-ANDROID-SO: "-L[[SYSROOT]]/usr/lib"
// CHECK-ANDROID-SO-NOT: "gcc_s"
// CHECK-ANDROID-SO: "-lgcc"
// CHECK-ANDROID-SO: "-ldl"
// CHECK-ANDROID-SO-NOT: "gcc_s"
// CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtend_so.o"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -static \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -static \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mipsel-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -static \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -static \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
// CHECK-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtbegin_static.o"
// CHECK-ANDROID-STATIC: "-L[[SYSROOT]]/usr/lib"
// CHECK-ANDROID-STATIC-NOT: "gcc_s"
// CHECK-ANDROID-STATIC: "-lgcc"
// CHECK-ANDROID-STATIC-NOT: "-ldl"
// CHECK-ANDROID-STATIC-NOT: "gcc_s"
// CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtend_android.o"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-androideabi \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -pie \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -pie \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mipsel-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -pie \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=i386-linux-android \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -pie \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
// CHECK-ANDROID-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
// CHECK-ANDROID-PIE: "-L[[SYSROOT]]/usr/lib"
// CHECK-ANDROID-PIE-NOT: "gcc_s"
// CHECK-ANDROID-PIE: "-lgcc"
// CHECK-ANDROID-PIE-NOT: "gcc_s"
// CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtend_android.o"
//
// Check linker invocation on Debian 6 MIPS 32/64-bit.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mipsel-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPSEL %s
// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib{{/|\\\\}}crt1.o"
// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib{{/|\\\\}}crti.o"
// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4"
// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib"
// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib/../lib"
// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/../lib"
// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64el-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL %s
// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64{{/|\\\\}}crt1.o"
// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64{{/|\\\\}}crti.o"
// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/64{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/64"
// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64"
// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib/../lib64"
// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/../lib64"
// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=mips64el-linux-gnu -mabi=n32 \
// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-N32 %s
// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32{{/|\\\\}}crt1.o"
// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32{{/|\\\\}}crti.o"
// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/n32{{/|\\\\}}crtbegin.o"
// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/n32"
// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32"
// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib/../lib32"
// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/../lib32"
// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
//
// Test linker invocation for Freescale SDK (OpenEmbedded).
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=powerpc-fsl-linux \
// RUN: --sysroot=%S/Inputs/freescale_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-FSL-PPC %s
// CHECK-FSL-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-FSL-PPC: "-m" "elf32ppclinux"
// CHECK-FSL-PPC: "{{.*}}{{/|\\\\}}crt1.o"
// CHECK-FSL-PPC: "{{.*}}{{/|\\\\}}crtbegin.o"
// CHECK-FSL-PPC: "-L[[SYSROOT]]/usr/lib"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=powerpc64-fsl-linux \
// RUN: --sysroot=%S/Inputs/freescale_ppc64_tree \
// RUN: | FileCheck --check-prefix=CHECK-FSL-PPC64 %s
// CHECK-FSL-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-FSL-PPC64: "-m" "elf64ppc"
// CHECK-FSL-PPC64: "{{.*}}{{/|\\\\}}crt1.o"
// CHECK-FSL-PPC64: "{{.*}}{{/|\\\\}}crtbegin.o"
// CHECK-FSL-PPC64: "-L[[SYSROOT]]/usr/lib64/powerpc64-fsl-linux/4.6.2/../.."
//
// Check that crtfastmath.o is linked with -ffast-math and with -Ofast.
// RUN: %clang --target=x86_64-unknown-linux -### %s \
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -ffast-math \
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -funsafe-math-optimizations\
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast\
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast -O3\
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -O3 -Ofast\
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -ffast-math -fno-fast-math \
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast -fno-fast-math \
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast -fno-unsafe-math-optimizations \
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -fno-fast-math -Ofast \
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
// RUN: %clang --target=x86_64-unknown-linux -### %s -fno-unsafe-math-optimizations -Ofast \
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
// We don't have crtfastmath.o in the i386 tree, use it to check that file
// detection works.
// RUN: %clang --target=i386-unknown-linux -### %s -ffast-math \
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
// CHECK-CRTFASTMATH: usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtfastmath.o
// CHECK-NOCRTFASTMATH-NOT: crtfastmath.o
// Check that we link in gcrt1.o when compiling with -pg
// RUN: %clang -pg --target=x86_64-unknown-linux -### %s \
// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>& 1 \
// RUN: | FileCheck --check-prefix=CHECK-PG %s
// CHECK-PG: gcrt1.o
|
the_stack_data/184518823.c | /**
******************************************************************************
* @file stm32l4xx_ll_exti.c
* @author MCD Application Team
* @brief EXTI LL module driver.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32l4xx_ll_exti.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/** @addtogroup STM32L4xx_LL_Driver
* @{
*/
#if defined (EXTI)
/** @defgroup EXTI_LL EXTI
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup EXTI_LL_Private_Macros
* @{
*/
#define IS_LL_EXTI_LINE_0_31(__VALUE__) (((__VALUE__) & ~LL_EXTI_LINE_ALL_0_31) == 0x00000000U)
#define IS_LL_EXTI_LINE_32_63(__VALUE__) (((__VALUE__) & ~LL_EXTI_LINE_ALL_32_63) == 0x00000000U)
#define IS_LL_EXTI_MODE(__VALUE__) (((__VALUE__) == LL_EXTI_MODE_IT) \
|| ((__VALUE__) == LL_EXTI_MODE_EVENT) \
|| ((__VALUE__) == LL_EXTI_MODE_IT_EVENT))
#define IS_LL_EXTI_TRIGGER(__VALUE__) (((__VALUE__) == LL_EXTI_TRIGGER_NONE) \
|| ((__VALUE__) == LL_EXTI_TRIGGER_RISING) \
|| ((__VALUE__) == LL_EXTI_TRIGGER_FALLING) \
|| ((__VALUE__) == LL_EXTI_TRIGGER_RISING_FALLING))
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup EXTI_LL_Exported_Functions
* @{
*/
/** @addtogroup EXTI_LL_EF_Init
* @{
*/
/**
* @brief De-initialize the EXTI registers to their default reset values.
* @retval An ErrorStatus enumeration value:
* - 0x00: EXTI registers are de-initialized
*/
uint32_t LL_EXTI_DeInit(void)
{
/* Interrupt mask register set to default reset values */
LL_EXTI_WriteReg(IMR1, 0xFF820000U);
/* Event mask register set to default reset values */
LL_EXTI_WriteReg(EMR1, 0x00000000U);
/* Rising Trigger selection register set to default reset values */
LL_EXTI_WriteReg(RTSR1, 0x00000000U);
/* Falling Trigger selection register set to default reset values */
LL_EXTI_WriteReg(FTSR1, 0x00000000U);
/* Software interrupt event register set to default reset values */
LL_EXTI_WriteReg(SWIER1, 0x00000000U);
/* Pending register clear */
LL_EXTI_WriteReg(PR1, 0x007DFFFFU);
/* Interrupt mask register 2 set to default reset values */
#if defined(LL_EXTI_LINE_40)
LL_EXTI_WriteReg(IMR2, 0x00000187U);
#else
LL_EXTI_WriteReg(IMR2, 0x00000087U);
#endif
/* Event mask register 2 set to default reset values */
LL_EXTI_WriteReg(EMR2, 0x00000000U);
/* Rising Trigger selection register 2 set to default reset values */
LL_EXTI_WriteReg(RTSR2, 0x00000000U);
/* Falling Trigger selection register 2 set to default reset values */
LL_EXTI_WriteReg(FTSR2, 0x00000000U);
/* Software interrupt event register 2 set to default reset values */
LL_EXTI_WriteReg(SWIER2, 0x00000000U);
/* Pending register 2 clear */
LL_EXTI_WriteReg(PR2, 0x00000078U);
return 0x00u;
}
/**
* @brief Initialize the EXTI registers according to the specified parameters in EXTI_InitStruct.
* @param EXTI_InitStruct pointer to a @ref LL_EXTI_InitTypeDef structure.
* @retval An ErrorStatus enumeration value:
* - 0x00: EXTI registers are initialized
* - any other calue : wrong configuration
*/
uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct)
{
uint32_t status = 0x00u;
/* Check the parameters */
assert_param(IS_LL_EXTI_LINE_0_31(EXTI_InitStruct->Line_0_31));
assert_param(IS_LL_EXTI_LINE_32_63(EXTI_InitStruct->Line_32_63));
assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->LineCommand));
assert_param(IS_LL_EXTI_MODE(EXTI_InitStruct->Mode));
/* ENABLE LineCommand */
if (EXTI_InitStruct->LineCommand != DISABLE)
{
assert_param(IS_LL_EXTI_TRIGGER(EXTI_InitStruct->Trigger));
/* Configure EXTI Lines in range from 0 to 31 */
if (EXTI_InitStruct->Line_0_31 != LL_EXTI_LINE_NONE)
{
switch (EXTI_InitStruct->Mode)
{
case LL_EXTI_MODE_IT:
/* First Disable Event on provided Lines */
LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31);
/* Then Enable IT on provided Lines */
LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31);
break;
case LL_EXTI_MODE_EVENT:
/* First Disable IT on provided Lines */
LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31);
/* Then Enable Event on provided Lines */
LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31);
break;
case LL_EXTI_MODE_IT_EVENT:
/* Directly Enable IT & Event on provided Lines */
LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31);
LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31);
break;
default:
status = 0x01u;
break;
}
if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE)
{
switch (EXTI_InitStruct->Trigger)
{
case LL_EXTI_TRIGGER_RISING:
/* First Disable Falling Trigger on provided Lines */
LL_EXTI_DisableFallingTrig_0_31(EXTI_InitStruct->Line_0_31);
/* Then Enable Rising Trigger on provided Lines */
LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31);
break;
case LL_EXTI_TRIGGER_FALLING:
/* First Disable Rising Trigger on provided Lines */
LL_EXTI_DisableRisingTrig_0_31(EXTI_InitStruct->Line_0_31);
/* Then Enable Falling Trigger on provided Lines */
LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31);
break;
case LL_EXTI_TRIGGER_RISING_FALLING:
LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31);
LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31);
break;
default:
status |= 0x02u;
break;
}
}
}
/* Configure EXTI Lines in range from 32 to 63 */
if (EXTI_InitStruct->Line_32_63 != LL_EXTI_LINE_NONE)
{
switch (EXTI_InitStruct->Mode)
{
case LL_EXTI_MODE_IT:
/* First Disable Event on provided Lines */
LL_EXTI_DisableEvent_32_63(EXTI_InitStruct->Line_32_63);
/* Then Enable IT on provided Lines */
LL_EXTI_EnableIT_32_63(EXTI_InitStruct->Line_32_63);
break;
case LL_EXTI_MODE_EVENT:
/* First Disable IT on provided Lines */
LL_EXTI_DisableIT_32_63(EXTI_InitStruct->Line_32_63);
/* Then Enable Event on provided Lines */
LL_EXTI_EnableEvent_32_63(EXTI_InitStruct->Line_32_63);
break;
case LL_EXTI_MODE_IT_EVENT:
/* Directly Enable IT & Event on provided Lines */
LL_EXTI_EnableIT_32_63(EXTI_InitStruct->Line_32_63);
LL_EXTI_EnableEvent_32_63(EXTI_InitStruct->Line_32_63);
break;
default:
status |= 0x04u;
break;
}
if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE)
{
switch (EXTI_InitStruct->Trigger)
{
case LL_EXTI_TRIGGER_RISING:
/* First Disable Falling Trigger on provided Lines */
LL_EXTI_DisableFallingTrig_32_63(EXTI_InitStruct->Line_32_63);
/* Then Enable IT on provided Lines */
LL_EXTI_EnableRisingTrig_32_63(EXTI_InitStruct->Line_32_63);
break;
case LL_EXTI_TRIGGER_FALLING:
/* First Disable Rising Trigger on provided Lines */
LL_EXTI_DisableRisingTrig_32_63(EXTI_InitStruct->Line_32_63);
/* Then Enable Falling Trigger on provided Lines */
LL_EXTI_EnableFallingTrig_32_63(EXTI_InitStruct->Line_32_63);
break;
case LL_EXTI_TRIGGER_RISING_FALLING:
LL_EXTI_EnableRisingTrig_32_63(EXTI_InitStruct->Line_32_63);
LL_EXTI_EnableFallingTrig_32_63(EXTI_InitStruct->Line_32_63);
break;
default:
status = ERROR;
break;
}
}
}
}
/* DISABLE LineCommand */
else
{
/* De-configure EXTI Lines in range from 0 to 31 */
LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31);
LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31);
/* De-configure EXTI Lines in range from 32 to 63 */
LL_EXTI_DisableIT_32_63(EXTI_InitStruct->Line_32_63);
LL_EXTI_DisableEvent_32_63(EXTI_InitStruct->Line_32_63);
}
return status;
}
/**
* @brief Set each @ref LL_EXTI_InitTypeDef field to default value.
* @param EXTI_InitStruct Pointer to a @ref LL_EXTI_InitTypeDef structure.
* @retval None
*/
void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct)
{
EXTI_InitStruct->Line_0_31 = LL_EXTI_LINE_NONE;
EXTI_InitStruct->Line_32_63 = LL_EXTI_LINE_NONE;
EXTI_InitStruct->LineCommand = DISABLE;
EXTI_InitStruct->Mode = LL_EXTI_MODE_IT;
EXTI_InitStruct->Trigger = LL_EXTI_TRIGGER_FALLING;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* defined (EXTI) */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
the_stack_data/40064.c | #include <stdio.h>
int main()
{
int num,row,col;
printf("Enter the value of N = ");
scanf("%d",&num);
for (row=1; row<=num; row++)
{
for(col=1; col<=num-row; col++)
{
printf(" ");
}
for(col=1;col<=row;col++)
{
printf("*");
}
printf("\n");
}
}
|
the_stack_data/67722.c | // File: test.c
// Created by hengxin on 17-10-29.
// Only for quick tests
#include <stdio.h>
#include <math.h>
int main(void) {
// (int) cannot be removed
printf("%d\n", (int) pow(2, 3));
// initialization of array
int array[5] = {1};
for (int i = 0; i < 5; ++i) {
printf("%d ", array[i]);
}
}
|
the_stack_data/231391949.c | // The error location is reachable in this file, because x is used when uninitialized and so both paths in f have to be possible on each call.
int i = 0;
void f() {
int x;
i++;
if (x == 0) {
x = 0;
} else {
if (i == 2) {
x = 2;
} else {
x = 1;
}
}
}
int main() {
f();
f();
if (i == 2) {
ERROR:
goto ERROR;
}
}
|
the_stack_data/168892622.c | int add(int a, int b) {
return a + b;
}
int main() {}
|
the_stack_data/9512558.c | //do while loop
#include<stdio.h>
int main()
{
int i = 1;
do
{
printf("My name is Rahat.\n");
i++;
}
while (i<=10);
return 0;
}
|
the_stack_data/1111142.c | // INFO: task hung in __io_uring_register
// https://syzkaller.appspot.com/bug?id=683bd00a08607efa6f70ca43719c33d54965fa41
// status:fixed
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <errno.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <linux/futex.h>
static void sleep_ms(uint64_t ms)
{
usleep(ms * 1000);
}
static uint64_t current_time_ms(void)
{
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts))
exit(1);
return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
}
static void use_temporary_dir(void)
{
char tmpdir_template[] = "./syzkaller.XXXXXX";
char* tmpdir = mkdtemp(tmpdir_template);
if (!tmpdir)
exit(1);
if (chmod(tmpdir, 0777))
exit(1);
if (chdir(tmpdir))
exit(1);
}
static void thread_start(void* (*fn)(void*), void* arg)
{
pthread_t th;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 128 << 10);
int i;
for (i = 0; i < 100; i++) {
if (pthread_create(&th, &attr, fn, arg) == 0) {
pthread_attr_destroy(&attr);
return;
}
if (errno == EAGAIN) {
usleep(50);
continue;
}
break;
}
exit(1);
}
typedef struct {
int state;
} event_t;
static void event_init(event_t* ev)
{
ev->state = 0;
}
static void event_reset(event_t* ev)
{
ev->state = 0;
}
static void event_set(event_t* ev)
{
if (ev->state)
exit(1);
__atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE);
syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG);
}
static void event_wait(event_t* ev)
{
while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0);
}
static int event_isset(event_t* ev)
{
return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE);
}
static int event_timedwait(event_t* ev, uint64_t timeout)
{
uint64_t start = current_time_ms();
uint64_t now = start;
for (;;) {
uint64_t remain = timeout - (now - start);
struct timespec ts;
ts.tv_sec = remain / 1000;
ts.tv_nsec = (remain % 1000) * 1000 * 1000;
syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts);
if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED))
return 1;
now = current_time_ms();
if (now - start > timeout)
return 0;
}
}
struct thread_t {
int created, call;
event_t ready, done;
};
static struct thread_t threads[16];
static void execute_call(int call);
static int running;
static void* thr(void* arg)
{
struct thread_t* th = (struct thread_t*)arg;
for (;;) {
event_wait(&th->ready);
event_reset(&th->ready);
execute_call(th->call);
__atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED);
event_set(&th->done);
}
return 0;
}
static void loop(void)
{
int i, call, thread;
for (call = 0; call < 3; call++) {
for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0]));
thread++) {
struct thread_t* th = &threads[thread];
if (!th->created) {
th->created = 1;
event_init(&th->ready);
event_init(&th->done);
event_set(&th->done);
thread_start(thr, th);
}
if (!event_isset(&th->done))
continue;
event_reset(&th->done);
th->call = call;
__atomic_fetch_add(&running, 1, __ATOMIC_RELAXED);
event_set(&th->ready);
event_timedwait(&th->done, 45);
break;
}
}
for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++)
sleep_ms(1);
}
#ifndef __NR_io_uring_enter
#define __NR_io_uring_enter 426
#endif
#ifndef __NR_io_uring_register
#define __NR_io_uring_register 427
#endif
#ifndef __NR_io_uring_setup
#define __NR_io_uring_setup 425
#endif
uint64_t r[1] = {0xffffffffffffffff};
void execute_call(int call)
{
long res;
switch (call) {
case 0:
*(uint32_t*)0x200000c0 = 0;
*(uint32_t*)0x200000c4 = 0;
*(uint32_t*)0x200000c8 = 0;
*(uint32_t*)0x200000cc = 0;
*(uint32_t*)0x200000d0 = 0;
*(uint32_t*)0x200000d4 = 0;
*(uint32_t*)0x200000d8 = 0;
*(uint32_t*)0x200000dc = 0;
*(uint32_t*)0x200000e0 = 0;
*(uint32_t*)0x200000e4 = 0;
*(uint32_t*)0x200000e8 = 0;
*(uint32_t*)0x200000ec = 0;
*(uint32_t*)0x200000f0 = 0;
*(uint32_t*)0x200000f4 = 0;
*(uint32_t*)0x200000f8 = 0;
*(uint32_t*)0x200000fc = 0;
*(uint32_t*)0x20000100 = 0;
*(uint32_t*)0x20000104 = 0;
*(uint64_t*)0x20000108 = 0;
*(uint32_t*)0x20000110 = 0;
*(uint32_t*)0x20000114 = 0;
*(uint32_t*)0x20000118 = 0;
*(uint32_t*)0x2000011c = 0;
*(uint32_t*)0x20000120 = 0;
*(uint32_t*)0x20000124 = 0;
*(uint32_t*)0x20000128 = 0;
*(uint32_t*)0x2000012c = 0;
*(uint64_t*)0x20000130 = 0;
res = syscall(__NR_io_uring_setup, 0x14a, 0x200000c0);
if (res != -1)
r[0] = res;
break;
case 1:
syscall(__NR_io_uring_register, r[0], 1, 0, 0);
break;
case 2:
syscall(__NR_io_uring_enter, r[0], 0x10005, 2, 3, 0, 0);
break;
}
}
int main(void)
{
syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
use_temporary_dir();
loop();
return 0;
}
|
the_stack_data/87264.c | /*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
int main() { putchar('a'); }
|
the_stack_data/1018137.c | int bar(int);
int foo(int X) {
X = 10;
return bar(X);
}
|
the_stack_data/165764587.c | /* gcc client.c -o client -lpthread */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <unistd.h>
#include <pthread.h>
#define TRUE 1
#define PORT 5000
int quit = 0;
void *get_server(void* sockfd) {
char buf[1024];
int rev;
if (((int)sockfd) < 0)
printf("\nCannot get the server information.\n");
else {
printf("\n\007\n");
for (;;) {
if (!quit) {
if ((rev = recv((int)sockfd, buf, 1024, 0)) > 0)
printf("\n\007%s\n", buf);
if (rev == 0) {
printf("\nThe server ends up the connection.\n");
quit = 1;
continue;
}
printf("\n");
} else {
close((int)sockfd);
break;
}
}
return(NULL);
}
}
int main() {
int connfd,snd,slenth;
struct sockaddr_in server;
struct hostent *hp;
char honame[20], msg2[1024], msg1[1024], cln[102], qstr[] = {"Quit"};
pthread_t tid;
printf("Please enter the server IP address.\n");
scanf("%s*", honame);
printf("Try to connect the server using socket...\n");
if ((connfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
printf("Error: Cannot create the socket.\n");
if ((hp = gethostbyname(honame)) == NULL) {
printf("Error: Cannot get the server IP address\n");
exit(1);
} else printf(" \n");
memcpy(&server.sin_addr, hp->h_addr, hp->h_length);
server.sin_family = AF_INET;
server.sin_port = htons(PORT);
if (connect(connfd, (struct sockaddr*)&server, sizeof(server)) < 0) {
printf("Error: Cannot connect to the server.\n");
exit(1);
}
printf("Build up the connection successfully.\n");
printf("Welcome to the ChatRoom.\n");
printf("Please input your username:\n");
scanf("%s",msg1);
slenth = strlen(msg1);
msg1[slenth] = ':';
msg1[slenth+1] = '\0';
strcpy(cln, msg1);
pthread_create(&tid, NULL, &get_server, (void*)connfd);
printf("\nLet's start chatting!\n");
while (TRUE) {
printf("\n");
scanf("%s", msg2);
if (strcmp(msg2, qstr) == 0) {
close(connfd);
quit = 1;
} else {
strcat(msg1, msg2);
snd = send(connfd, msg1, strlen(msg1)+1, 0);
strcpy(msg1, cln);
if (snd < 0) printf("\n \n");
}
}
return 0;
}
|
the_stack_data/725632.c | void
main ()
{
while(1);
}
|
the_stack_data/90764452.c | #ifdef STM32F0xx
#include "stm32f0xx_hal_uart.c"
#endif
#ifdef STM32F1xx
#include "stm32f1xx_hal_uart.c"
#endif
#ifdef STM32F2xx
#include "stm32f2xx_hal_uart.c"
#endif
#ifdef STM32F3xx
#include "stm32f3xx_hal_uart.c"
#endif
#ifdef STM32F4xx
#include "stm32f4xx_hal_uart.c"
#endif
#ifdef STM32F7xx
#include "stm32f7xx_hal_uart.c"
#endif
#ifdef STM32G0xx
#include "stm32g0xx_hal_uart.c"
#endif
#ifdef STM32G4xx
#include "stm32g4xx_hal_uart.c"
#endif
#ifdef STM32H7xx
#include "stm32h7xx_hal_uart.c"
#endif
#ifdef STM32L0xx
#include "stm32l0xx_hal_uart.c"
#endif
#ifdef STM32L1xx
#include "stm32l1xx_hal_uart.c"
#endif
#ifdef STM32L4xx
#include "stm32l4xx_hal_uart.c"
#endif
#ifdef STM32L5xx
#include "stm32l5xx_hal_uart.c"
#endif
#ifdef STM32MP1xx
#include "stm32mp1xx_hal_uart.c"
#endif
#ifdef STM32WBxx
#include "stm32wbxx_hal_uart.c"
#endif
|
the_stack_data/48574751.c | /* File: structs3a.c
*
* Purpose: Determine whether structs are passed by reference
* Input: None
* Output: struct member values
*
* Compile: gcc -g -Wall -o structs3a structs3a.c
* Usage: ./structs3a
*/
#include <stdio.h>
typedef struct {
double value;
int row;
int col;
} element_t;
void pass_struct(element_t x);
int main(void) {
element_t element;
element.value = 5.5;
element.row = 6;
element.col = 10;
printf("element.value = %f\n", element.value);
printf("element.row = %d\n", element.row);
printf("element.col = %d\n", element.col);
pass_struct(element);
printf("After call to pass_struct\n");
printf("element.value = %f\n", element.value);
printf("element.row = %d\n", element.row);
printf("element.col = %d\n", element.col);
return 0;
} /* main */
void pass_struct(element_t x) {
printf("\nIn pass_struct\n\n");
x.value = 2.71828;
x.row = 43;
x.col = 1027;
} /* pass_struct */
|
the_stack_data/231392792.c | /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
void f (const char *c, int *i)
{
*i = 42;
__builtin_memcpy (i + 1, c, sizeof (int));
if (*i != 42) __builtin_abort();
}
extern void keepit ();
void g (const char *c, int *i)
{
*i = 33;
__builtin_memcpy (i - 1, c, 3 * sizeof (int));
if (*i != 33) keepit();
}
/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */
/* { dg-final { scan-tree-dump "keepit" "optimized" } } */
|
the_stack_data/105582.c | #include<stdio.h>
#include<stdlib.h>
int bins(int a[],int n,int num)
{
int beg,mid,end;
beg=0; end=n-1;
while(beg<=end)
{
mid=(beg+end)/2;
if(a[mid]==num)
return mid;
else if( num>a[mid])
beg=mid+1;
else
end=mid-1;
}
return -1;
}
void main()
{
int *a,n,num,i,pos;
printf("\nEnter size of arrray:");
scanf("%d",&n);
a=(int *)malloc(n*sizeof(int));
printf("\nEnter %d elements:", n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("\nEnter number to be searched:");
scanf("%d",&num);
pos=bins(a,n,num);
if(pos==-1)
printf("\nNumber not found");
else
printf("\nNumber found at index %d and position %d",pos,pos+1);
}
|
the_stack_data/275227.c | #include <stdio.h>
#include <stdlib.h>
void
merge(int *vet, int left, int middle, int right) {
int i, j, k;
int n1 = middle - left + 1;
int n2 = right - middle;
int L[n1], R[n2]; // temp arrays
for (i = 0; i < n1; i++) // make a copy
L[i] = vet[left + i];
for (j = 0; j < n2; j++)
R[j] = vet[middle + 1 + j];
// Merge the temp arrays in vet[l..r]
i = 0;
j = 0;
k = left; // Initial index of merged subarray
while (i < n1 && j < n2) {
if (L[i] <= R[j])
vet[k++] = L[i++];
else
vet[k++] = R[j++];
}
// Copy the remaining elements of L[]
while (i < n1)
vet[k++] = L[i++];
// Copy the remaining elements of R[]
while (j < n2)
vet[k++] = R[j++];
}
void mergeSort(int *vet, int left, int right){
int middle;
if (left < right){
middle = left + (right - left)/2; // Same as (left + right)/2, but avoids overflow for large l and r
mergeSort(vet, left, middle);
mergeSort(vet, middle+1, right);
merge(vet, left, middle, right);
}
}
int main(int argc, char ** argv) {
int i, n, len;
int *vet;
if (argc != 2) {
printf ("Syntax: %s dimension", argv[0]);
return (1);
}
n = atoi(argv[1]);
vet = (int*) malloc(n * sizeof(int));
for(i = 0;i < n;i++) {
vet[i] = rand() % 100;
printf("%d\n",vet[i]);
}
mergeSort(vet,0, n);
printf("\n");
for(i = 0;i < n;i++)
printf("%d\n",vet[i]);
return 0;
}
|
the_stack_data/193842.c | /* Cálculo da media e da variância de 10 reais (segunda versão) */
#include <stdio.h>
/* Função para cálculo da média */
float media (int n, float *v)
{
int i;
float s = 0.0;
for (i = 0; i < n; i++)
s += v[i];
return s/n;
}
/* Função para cálculo da variância */
float variancia (int n, float *v, float m)
{
int i;
float s = 0.0;
for (i = 0; i < n; i++)
s += (v[i] - m) * (v[i] - m);
return s/n;
}
int main (void)
{
float v[10];
float med, var;
int i;
/* leitura dos valores */
for (i = 0; i < 10; i++)
scanf("%f", &v[i]);
med = media(10,v);
var = variancia(10,v,med);
printf("Media = %f Variancia = %f \n",med, var);
return 0;
} |
the_stack_data/159514692.c | #define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
#include <limits.h>
#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <string.h>
#include <stdbool.h>
#include <sys/types.h>
#include <sys/prctl.h>
#include <dirent.h>
#include <sys/select.h>
#include <stdio.h>
int rename_noreplace (int olddirfd, const char *oldpath, int newdirfd, const char *newpath)
{
int ret;
# ifdef SYS_renameat2
# ifndef RENAME_NOREPLACE
# define RENAME_NOREPLACE (1 << 0)
# endif
ret = (int) syscall (SYS_renameat2, olddirfd, oldpath, newdirfd, newpath, RENAME_NOREPLACE);
if (ret == 0 || errno != EINVAL)
return ret;
/* Fallback in case of errno==EINVAL. */
# endif
/* This might be an issue if another process is trying to read the file while it is empty. */
ret = open (newpath, O_EXCL|O_CREAT, 0700);
if (ret < 0)
return ret;
close (ret);
/* We are sure we created the file, let's overwrite it. */
return rename (oldpath, newpath);
}
#ifndef TEMP_FAILURE_RETRY
#define TEMP_FAILURE_RETRY(expression) \
(__extension__ \
({ long int __result; \
do __result = (long int) (expression); \
while (__result == -1L && errno == EINTR); \
__result; }))
#endif
static const char *_max_user_namespaces = "/proc/sys/user/max_user_namespaces";
static const char *_unprivileged_user_namespaces = "/proc/sys/kernel/unprivileged_userns_clone";
static int open_files_max_fd;
static fd_set *open_files_set;
static uid_t rootless_uid_init;
static gid_t rootless_gid_init;
static bool do_socket_activation = false;
static char *saved_systemd_listen_fds;
static char *saved_systemd_listen_pid;
static char *saved_systemd_listen_fdnames;
static int
syscall_setresuid (uid_t ruid, uid_t euid, uid_t suid)
{
return (int) syscall (__NR_setresuid, ruid, euid, suid);
}
static int
syscall_setresgid (gid_t rgid, gid_t egid, gid_t sgid)
{
return (int) syscall (__NR_setresgid, rgid, egid, sgid);
}
uid_t
rootless_uid ()
{
return rootless_uid_init;
}
uid_t
rootless_gid ()
{
return rootless_gid_init;
}
static void
do_pause ()
{
int i;
struct sigaction act;
int const sig[] =
{
SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGPOLL,
SIGPROF, SIGVTALRM, SIGXCPU, SIGXFSZ, 0
};
act.sa_handler = SIG_IGN;
for (i = 0; sig[i]; i++)
sigaction (sig[i], &act, NULL);
prctl (PR_SET_NAME, "podman pause", NULL, NULL, NULL);
while (1)
pause ();
}
static char **
get_cmd_line_args ()
{
int fd;
char *buffer;
size_t allocated;
size_t used = 0;
int ret;
int i, argc = 0;
char **argv;
fd = open ("/proc/self/cmdline", O_RDONLY);
if (fd < 0)
return NULL;
allocated = 512;
buffer = malloc (allocated);
if (buffer == NULL)
return NULL;
for (;;)
{
ret = TEMP_FAILURE_RETRY (read (fd, buffer + used, allocated - used));
if (ret < 0)
{
free (buffer);
return NULL;
}
if (ret == 0)
break;
used += ret;
if (allocated == used)
{
allocated += 512;
char *tmp = realloc (buffer, allocated);
if (tmp == NULL)
{
free (buffer);
return NULL;
}
buffer = tmp;
}
}
close (fd);
for (i = 0; i < used; i++)
if (buffer[i] == '\0')
argc++;
if (argc == 0)
{
free (buffer);
return NULL;
}
argv = malloc (sizeof (char *) * (argc + 1));
if (argv == NULL)
{
free (buffer);
return NULL;
}
argc = 0;
argv[argc++] = buffer;
for (i = 0; i < used - 1; i++)
if (buffer[i] == '\0')
argv[argc++] = buffer + i + 1;
argv[argc] = NULL;
return argv;
}
static bool
can_use_shortcut ()
{
int argc;
char **argv;
bool ret = true;
#ifdef DISABLE_JOIN_SHORTCUT
return false;
#endif
argv = get_cmd_line_args ();
if (argv == NULL)
return false;
if (strstr (argv[0], "podman") == NULL)
{
free (argv[0]);
free (argv);
return false;
}
for (argc = 0; argv[argc]; argc++)
{
if (argc == 0 || argv[argc][0] == '-')
continue;
if (strcmp (argv[argc], "mount") == 0
|| strcmp (argv[argc], "search") == 0
|| (strcmp (argv[argc], "system") == 0 && argv[argc+1] && strcmp (argv[argc+1], "service") != 0))
{
ret = false;
break;
}
if (argv[argc+1] != NULL && (strcmp (argv[argc], "container") == 0 ||
strcmp (argv[argc], "image") == 0) &&
strcmp (argv[argc+1], "mount") == 0)
{
ret = false;
break;
}
}
free (argv[0]);
free (argv);
return ret;
}
int
is_fd_inherited(int fd)
{
if (open_files_set == NULL || fd > open_files_max_fd || fd < 0)
return 0;
return FD_ISSET(fd % FD_SETSIZE, &(open_files_set[fd / FD_SETSIZE])) ? 1 : 0;
}
static void __attribute__((constructor)) init()
{
const char *xdg_runtime_dir;
const char *pause;
const char *listen_pid;
const char *listen_fds;
const char *listen_fdnames;
DIR *d;
pause = getenv ("_PODMAN_PAUSE");
if (pause && pause[0])
{
do_pause ();
_exit (EXIT_FAILURE);
}
/* Store how many FDs were open before the Go runtime kicked in. */
d = opendir ("/proc/self/fd");
if (d)
{
struct dirent *ent;
size_t size = 0;
for (ent = readdir (d); ent; ent = readdir (d))
{
int fd;
if (ent->d_name[0] == '.')
continue;
fd = atoi (ent->d_name);
if (fd == dirfd (d))
continue;
if (fd >= size * FD_SETSIZE)
{
int i;
size_t new_size;
new_size = (fd / FD_SETSIZE) + 1;
open_files_set = realloc (open_files_set, new_size * sizeof (fd_set));
if (open_files_set == NULL)
_exit (EXIT_FAILURE);
for (i = size; i < new_size; i++)
FD_ZERO (&(open_files_set[i]));
size = new_size;
}
if (fd > open_files_max_fd)
open_files_max_fd = fd;
FD_SET (fd % FD_SETSIZE, &(open_files_set[fd / FD_SETSIZE]));
}
closedir (d);
}
listen_pid = getenv("LISTEN_PID");
listen_fds = getenv("LISTEN_FDS");
listen_fdnames = getenv("LISTEN_FDNAMES");
if (listen_pid != NULL && listen_fds != NULL && strtol(listen_pid, NULL, 10) == getpid())
{
// save systemd socket environment for rootless child
do_socket_activation = true;
saved_systemd_listen_pid = strdup(listen_pid);
saved_systemd_listen_fds = strdup(listen_fds);
if (listen_fdnames != NULL)
saved_systemd_listen_fdnames = strdup(listen_fdnames);
if (saved_systemd_listen_pid == NULL
|| saved_systemd_listen_fds == NULL)
{
fprintf (stderr, "save socket listen environments error: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
}
/* Shortcut. If we are able to join the pause pid file, do it now so we don't
need to re-exec. */
xdg_runtime_dir = getenv ("XDG_RUNTIME_DIR");
if (geteuid () != 0 && xdg_runtime_dir && xdg_runtime_dir[0] && can_use_shortcut ())
{
int r;
int fd;
long pid;
char buf[12];
uid_t uid;
gid_t gid;
char path[PATH_MAX];
const char *const suffix = "/libpod/tmp/pause.pid";
char *cwd = getcwd (NULL, 0);
char uid_fmt[16];
char gid_fmt[16];
size_t len;
if (cwd == NULL)
{
fprintf (stderr, "error getting current working directory: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
len = snprintf (path, PATH_MAX, "%s%s", xdg_runtime_dir, suffix);
if (len >= PATH_MAX)
{
fprintf (stderr, "invalid value for XDG_RUNTIME_DIR: %s", strerror (ENAMETOOLONG));
exit (EXIT_FAILURE);
}
fd = open (path, O_RDONLY);
if (fd < 0)
{
free (cwd);
return;
}
r = TEMP_FAILURE_RETRY (read (fd, buf, sizeof (buf) - 1));
close (fd);
if (r < 0)
{
free (cwd);
return;
}
buf[r] = '\0';
pid = strtol (buf, NULL, 10);
if (pid == LONG_MAX)
{
free (cwd);
return;
}
uid = geteuid ();
gid = getegid ();
sprintf (path, "/proc/%ld/ns/user", pid);
fd = open (path, O_RDONLY);
if (fd < 0 || setns (fd, 0) < 0)
{
free (cwd);
return;
}
close (fd);
/* Errors here cannot be ignored as we already joined a ns. */
sprintf (path, "/proc/%ld/ns/mnt", pid);
fd = open (path, O_RDONLY);
if (fd < 0)
{
fprintf (stderr, "cannot open %s: %s", path, strerror (errno));
exit (EXIT_FAILURE);
}
sprintf (uid_fmt, "%d", uid);
sprintf (gid_fmt, "%d", gid);
setenv ("_CONTAINERS_USERNS_CONFIGURED", "init", 1);
setenv ("_CONTAINERS_ROOTLESS_UID", uid_fmt, 1);
setenv ("_CONTAINERS_ROOTLESS_GID", gid_fmt, 1);
r = setns (fd, 0);
if (r < 0)
{
fprintf (stderr, "cannot join mount namespace for %ld: %s", pid, strerror (errno));
exit (EXIT_FAILURE);
}
close (fd);
if (syscall_setresgid (0, 0, 0) < 0)
{
fprintf (stderr, "cannot setresgid: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (syscall_setresuid (0, 0, 0) < 0)
{
fprintf (stderr, "cannot setresuid: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (chdir (cwd) < 0)
{
fprintf (stderr, "cannot chdir to %s: %s\n", cwd, strerror (errno));
_exit (EXIT_FAILURE);
}
free (cwd);
rootless_uid_init = uid;
rootless_gid_init = gid;
}
}
static int
syscall_clone (unsigned long flags, void *child_stack)
{
#if defined(__s390__) || defined(__CRIS__)
return (int) syscall (__NR_clone, child_stack, flags);
#else
return (int) syscall (__NR_clone, flags, child_stack);
#endif
}
int
reexec_in_user_namespace_wait (int pid, int options)
{
pid_t p;
int status;
p = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
if (p < 0)
return -1;
if (WIFEXITED (status))
return WEXITSTATUS (status);
if (WIFSIGNALED (status))
return 128 + WTERMSIG (status);
return -1;
}
static int
create_pause_process (const char *pause_pid_file_path, char **argv)
{
int r, p[2];
if (pipe (p) < 0)
_exit (EXIT_FAILURE);
r = fork ();
if (r < 0)
_exit (EXIT_FAILURE);
if (r)
{
char b;
close (p[1]);
/* Block until we write the pid file. */
r = TEMP_FAILURE_RETRY (read (p[0], &b, 1));
close (p[0]);
reexec_in_user_namespace_wait (r, 0);
return r == 1 && b == '0' ? 0 : -1;
}
else
{
int fd;
pid_t pid;
close (p[0]);
setsid ();
pid = fork ();
if (r < 0)
_exit (EXIT_FAILURE);
if (pid)
{
char pid_str[12];
char *tmp_file_path = NULL;
sprintf (pid_str, "%d", pid);
if (asprintf (&tmp_file_path, "%s.XXXXXX", pause_pid_file_path) < 0)
{
fprintf (stderr, "unable to print to string\n");
kill (pid, SIGKILL);
_exit (EXIT_FAILURE);
}
if (tmp_file_path == NULL)
{
fprintf (stderr, "temporary file path is NULL\n");
kill (pid, SIGKILL);
_exit (EXIT_FAILURE);
}
fd = mkstemp (tmp_file_path);
if (fd < 0)
{
fprintf (stderr, "error creating temporary file: %s\n", strerror (errno));
kill (pid, SIGKILL);
_exit (EXIT_FAILURE);
}
r = TEMP_FAILURE_RETRY (write (fd, pid_str, strlen (pid_str)));
if (r < 0)
{
fprintf (stderr, "cannot write to file descriptor: %s\n", strerror (errno));
kill (pid, SIGKILL);
_exit (EXIT_FAILURE);
}
close (fd);
/* There can be another process at this point trying to configure the user namespace and the pause
process, do not override the pid file if it already exists. */
if (rename_noreplace (AT_FDCWD, tmp_file_path, AT_FDCWD, pause_pid_file_path) < 0)
{
unlink (tmp_file_path);
kill (pid, SIGKILL);
_exit (EXIT_FAILURE);
}
r = TEMP_FAILURE_RETRY (write (p[1], "0", 1));
if (r < 0)
{
fprintf (stderr, "cannot write to pipe: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
close (p[1]);
_exit (EXIT_SUCCESS);
}
else
{
int null;
close (p[1]);
null = open ("/dev/null", O_RDWR);
if (null >= 0)
{
dup2 (null, 0);
dup2 (null, 1);
dup2 (null, 2);
close (null);
}
for (fd = 3; fd < open_files_max_fd + 16; fd++)
close (fd);
setenv ("_PODMAN_PAUSE", "1", 1);
execlp (argv[0], argv[0], NULL);
/* If the execve fails, then do the pause here. */
do_pause ();
_exit (EXIT_FAILURE);
}
}
}
static int
open_namespace (int pid_to_join, const char *ns_file)
{
char ns_path[PATH_MAX];
int ret;
ret = snprintf (ns_path, PATH_MAX, "/proc/%d/ns/%s", pid_to_join, ns_file);
if (ret == PATH_MAX)
{
fprintf (stderr, "internal error: namespace path too long\n");
return -1;
}
return open (ns_path, O_CLOEXEC | O_RDONLY);
}
static void
join_namespace_or_die (const char *name, int ns_fd)
{
if (setns (ns_fd, 0) < 0)
{
fprintf (stderr, "cannot set %s namespace\n", name);
_exit (EXIT_FAILURE);
}
}
int
reexec_userns_join (int pid_to_join, char *pause_pid_file_path)
{
char uid[16];
char gid[16];
char **argv;
int pid;
int mnt_ns = -1;
int user_ns = -1;
char *cwd = getcwd (NULL, 0);
sigset_t sigset, oldsigset;
if (cwd == NULL)
{
fprintf (stderr, "error getting current working directory: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
sprintf (uid, "%d", geteuid ());
sprintf (gid, "%d", getegid ());
argv = get_cmd_line_args ();
if (argv == NULL)
{
fprintf (stderr, "cannot read argv: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
user_ns = open_namespace (pid_to_join, "user");
if (user_ns < 0)
return user_ns;
mnt_ns = open_namespace (pid_to_join, "mnt");
if (mnt_ns < 0)
{
close (user_ns);
return mnt_ns;
}
pid = fork ();
if (pid < 0)
fprintf (stderr, "cannot fork: %s\n", strerror (errno));
if (pid)
{
int f;
/* We passed down these fds, close them. */
close (user_ns);
close (mnt_ns);
for (f = 3; f <= open_files_max_fd; f++)
if (is_fd_inherited (f))
close (f);
if (do_socket_activation)
{
unsetenv ("LISTEN_PID");
unsetenv ("LISTEN_FDS");
unsetenv ("LISTEN_FDNAMES");
}
return pid;
}
if (sigfillset (&sigset) < 0)
{
fprintf (stderr, "cannot fill sigset: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (sigdelset (&sigset, SIGCHLD) < 0)
{
fprintf (stderr, "cannot sigdelset(SIGCHLD): %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (sigdelset (&sigset, SIGTERM) < 0)
{
fprintf (stderr, "cannot sigdelset(SIGTERM): %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (sigprocmask (SIG_BLOCK, &sigset, &oldsigset) < 0)
{
fprintf (stderr, "cannot block signals: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (do_socket_activation)
{
char s[32];
sprintf (s, "%d", getpid());
setenv ("LISTEN_PID", s, true);
setenv ("LISTEN_FDS", saved_systemd_listen_fds, true);
// Setting fdnames is optional for systemd_socket_activation
if (saved_systemd_listen_fdnames != NULL)
setenv ("LISTEN_FDNAMES", saved_systemd_listen_fdnames, true);
}
setenv ("_CONTAINERS_USERNS_CONFIGURED", "init", 1);
setenv ("_CONTAINERS_ROOTLESS_UID", uid, 1);
setenv ("_CONTAINERS_ROOTLESS_GID", gid, 1);
if (prctl (PR_SET_PDEATHSIG, SIGTERM, 0, 0, 0) < 0)
{
fprintf (stderr, "cannot prctl(PR_SET_PDEATHSIG): %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
join_namespace_or_die ("user", user_ns);
join_namespace_or_die ("mnt", mnt_ns);
close (user_ns);
close (mnt_ns);
if (syscall_setresgid (0, 0, 0) < 0)
{
fprintf (stderr, "cannot setresgid: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (syscall_setresuid (0, 0, 0) < 0)
{
fprintf (stderr, "cannot setresuid: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (chdir (cwd) < 0)
{
fprintf (stderr, "cannot chdir to %s: %s\n", cwd, strerror (errno));
_exit (EXIT_FAILURE);
}
free (cwd);
if (pause_pid_file_path && pause_pid_file_path[0] != '\0')
{
/* We ignore errors here as we didn't create the namespace anyway. */
create_pause_process (pause_pid_file_path, argv);
}
if (sigprocmask (SIG_SETMASK, &oldsigset, NULL) < 0)
{
fprintf (stderr, "cannot block signals: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
execvp (argv[0], argv);
_exit (EXIT_FAILURE);
}
static void
check_proc_sys_userns_file (const char *path)
{
FILE *fp;
fp = fopen (path, "r");
if (fp)
{
char buf[32];
size_t n_read = fread (buf, 1, sizeof(buf) - 1, fp);
if (n_read > 0)
{
buf[n_read] = '\0';
if (strtol (buf, NULL, 10) == 0)
fprintf (stderr, "user namespaces are not enabled in %s\n", path);
}
fclose (fp);
}
}
static int
copy_file_to_fd (const char *file_to_read, int outfd)
{
char buf[512];
int fd;
fd = open (file_to_read, O_RDONLY);
if (fd < 0)
return fd;
for (;;)
{
ssize_t r, w, t = 0;
r = TEMP_FAILURE_RETRY (read (fd, buf, sizeof buf));
if (r < 0)
{
close (fd);
return r;
}
if (r == 0)
break;
while (t < r)
{
w = TEMP_FAILURE_RETRY (write (outfd, &buf[t], r - t));
if (w < 0)
{
close (fd);
return w;
}
t += w;
}
}
close (fd);
return 0;
}
int
reexec_in_user_namespace (int ready, char *pause_pid_file_path, char *file_to_read, int outputfd)
{
int ret;
pid_t pid;
char b;
char **argv;
char uid[16];
char gid[16];
char *cwd = getcwd (NULL, 0);
sigset_t sigset, oldsigset;
if (cwd == NULL)
{
fprintf (stderr, "error getting current working directory: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
sprintf (uid, "%d", geteuid ());
sprintf (gid, "%d", getegid ());
pid = syscall_clone (CLONE_NEWUSER|CLONE_NEWNS|SIGCHLD, NULL);
if (pid < 0)
{
fprintf (stderr, "cannot clone: %s\n", strerror (errno));
check_proc_sys_userns_file (_max_user_namespaces);
check_proc_sys_userns_file (_unprivileged_user_namespaces);
}
if (pid)
{
if (do_socket_activation)
{
long num_fds;
num_fds = strtol (saved_systemd_listen_fds, NULL, 10);
if (num_fds != LONG_MIN && num_fds != LONG_MAX)
{
int f;
for (f = 3; f < num_fds + 3; f++)
if (is_fd_inherited (f))
close (f);
}
unsetenv ("LISTEN_PID");
unsetenv ("LISTEN_FDS");
unsetenv ("LISTEN_FDNAMES");
}
return pid;
}
if (sigfillset (&sigset) < 0)
{
fprintf (stderr, "cannot fill sigset: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (sigdelset (&sigset, SIGCHLD) < 0)
{
fprintf (stderr, "cannot sigdelset(SIGCHLD): %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (sigdelset (&sigset, SIGTERM) < 0)
{
fprintf (stderr, "cannot sigdelset(SIGTERM): %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (sigprocmask (SIG_BLOCK, &sigset, &oldsigset) < 0)
{
fprintf (stderr, "cannot block signals: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
argv = get_cmd_line_args ();
if (argv == NULL)
{
fprintf (stderr, "cannot read argv: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (do_socket_activation)
{
char s[32];
sprintf (s, "%d", getpid());
setenv ("LISTEN_PID", s, true);
setenv ("LISTEN_FDS", saved_systemd_listen_fds, true);
// Setting fdnames is optional for systemd_socket_activation
if (saved_systemd_listen_fdnames != NULL)
setenv ("LISTEN_FDNAMES", saved_systemd_listen_fdnames, true);
}
setenv ("_CONTAINERS_USERNS_CONFIGURED", "init", 1);
setenv ("_CONTAINERS_ROOTLESS_UID", uid, 1);
setenv ("_CONTAINERS_ROOTLESS_GID", gid, 1);
ret = TEMP_FAILURE_RETRY (read (ready, &b, 1));
if (ret < 0)
{
fprintf (stderr, "cannot read from sync pipe: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (ret != 1 || b != '0')
_exit (EXIT_FAILURE);
if (syscall_setresgid (0, 0, 0) < 0)
{
fprintf (stderr, "cannot setresgid: %s\n", strerror (errno));
TEMP_FAILURE_RETRY (write (ready, "1", 1));
_exit (EXIT_FAILURE);
}
if (syscall_setresuid (0, 0, 0) < 0)
{
fprintf (stderr, "cannot setresuid: %s\n", strerror (errno));
TEMP_FAILURE_RETRY (write (ready, "1", 1));
_exit (EXIT_FAILURE);
}
if (chdir (cwd) < 0)
{
fprintf (stderr, "cannot chdir to %s: %s\n", cwd, strerror (errno));
TEMP_FAILURE_RETRY (write (ready, "1", 1));
_exit (EXIT_FAILURE);
}
free (cwd);
if (pause_pid_file_path && pause_pid_file_path[0] != '\0')
{
if (create_pause_process (pause_pid_file_path, argv) < 0)
{
TEMP_FAILURE_RETRY (write (ready, "2", 1));
_exit (EXIT_FAILURE);
}
}
ret = TEMP_FAILURE_RETRY (write (ready, "0", 1));
if (ret < 0)
{
fprintf (stderr, "cannot write to ready pipe: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
close (ready);
if (sigprocmask (SIG_SETMASK, &oldsigset, NULL) < 0)
{
fprintf (stderr, "cannot block signals: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (file_to_read && file_to_read[0])
{
ret = copy_file_to_fd (file_to_read, outputfd);
close (outputfd);
_exit (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
execvp (argv[0], argv);
_exit (EXIT_FAILURE);
}
|
the_stack_data/1184259.c | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
if (argc < 3) {
fprintf(stderr, "At least a dividend and a divisor is required.\n");
return 1;
}
int remainder = atoi(argv[1]);
for (int i = 2; i < argc; ++i)
remainder %= atoi(argv[i]);
printf("%i\n", remainder);
return 0;
}
|
the_stack_data/35639.c | /*
* Creating elliptic curve (x25519) cryptography key pairs
*/
#include <stdio.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/bio.h>
int main() {
/* Generate private and public key */
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(NID_X25519, NULL);
EVP_PKEY_keygen_init(pctx);
EVP_PKEY_keygen(pctx, &pkey);
EVP_PKEY_CTX_free(pctx);
/* Print keys to stdout */
printf("\nAlice's PRIVATE KEY:\n");
PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);
printf("\nAlice's PUBKEY:\n");
PEM_write_PUBKEY(stdout, pkey);
/* Write public key to file */
BIO *out;
out = BIO_new_file("pubkey-alice.txt", "w+");
if (!out) {
/* Error */
printf("BIO out is empty\n");
}
PEM_write_bio_PUBKEY(out, pkey);
BIO_flush(out);
/* Initiate Bob to receive his public key */
printf("\nInitiate Bob and press <enter>");
int ok = getchar();
/* Read Bob's public key */
FILE *keyfile = fopen("pubkey-bob.txt", "r");
EVP_PKEY *peerkey = NULL;
peerkey = PEM_read_PUBKEY(keyfile, NULL, NULL, NULL);
printf("\nBob's PUBKEY:\n");
PEM_write_PUBKEY(stdout, peerkey);
/* Generate shared secret */
EVP_PKEY_CTX *ctx;
unsigned char *skey;
size_t skeylen;
ctx = EVP_PKEY_CTX_new(pkey, NULL);
if (!ctx) {
/* Error */
printf("CTX is empty");
}
if (EVP_PKEY_derive_init(ctx) <= 0) {
/* Error */
printf("EVP derive initialization failed\n");
}
if (EVP_PKEY_derive_set_peer(ctx, peerkey) <= 0) {
/* Error */
printf("EVP derive set peer failed\n");
}
/* Determine buffer length */
if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0) {
/* Error */
printf("EVP derive failed\n");
}
skey = OPENSSL_malloc(skeylen);
if (!skey) {
/* Malloc failure */
printf("OpenSSL Malloc failed");
}
if (EVP_PKEY_derive(ctx, skey, &skeylen) <= 0) {
/* Error */
printf("Shared key derivation failed");
}
printf("\nShared secret:\n");
for (size_t i = 0; i < skeylen; i++) {
printf("%02x", skey[i]);
}
return 0;
}
|
the_stack_data/1224089.c | /* $OpenBSD: eck_prn.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
/* ====================================================================
* Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* [email protected].
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* ([email protected]). This product includes software written by Tim
* Hudson ([email protected]).
*
*/
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
* Portions originally developed by SUN MICROSYSTEMS, INC., and
* contributed to the OpenSSL project.
*/
#include <stdio.h>
#include <string.h>
#include <openssl/opensslconf.h>
#include <openssl/bn.h>
#include <openssl/ec.h>
#include <openssl/err.h>
#include <openssl/evp.h>
int
ECPKParameters_print_fp(FILE * fp, const EC_GROUP * x, int off)
{
BIO *b;
int ret;
if ((b = BIO_new(BIO_s_file())) == NULL) {
ECerror(ERR_R_BUF_LIB);
return (0);
}
BIO_set_fp(b, fp, BIO_NOCLOSE);
ret = ECPKParameters_print(b, x, off);
BIO_free(b);
return (ret);
}
int
EC_KEY_print_fp(FILE * fp, const EC_KEY * x, int off)
{
BIO *b;
int ret;
if ((b = BIO_new(BIO_s_file())) == NULL) {
ECerror(ERR_R_BIO_LIB);
return (0);
}
BIO_set_fp(b, fp, BIO_NOCLOSE);
ret = EC_KEY_print(b, x, off);
BIO_free(b);
return (ret);
}
int
ECParameters_print_fp(FILE * fp, const EC_KEY * x)
{
BIO *b;
int ret;
if ((b = BIO_new(BIO_s_file())) == NULL) {
ECerror(ERR_R_BIO_LIB);
return (0);
}
BIO_set_fp(b, fp, BIO_NOCLOSE);
ret = ECParameters_print(b, x);
BIO_free(b);
return (ret);
}
int
EC_KEY_print(BIO * bp, const EC_KEY * x, int off)
{
EVP_PKEY *pk;
int ret;
pk = EVP_PKEY_new();
if (!pk || !EVP_PKEY_set1_EC_KEY(pk, (EC_KEY *) x))
return 0;
ret = EVP_PKEY_print_private(bp, pk, off, NULL);
EVP_PKEY_free(pk);
return ret;
}
int
ECParameters_print(BIO * bp, const EC_KEY * x)
{
EVP_PKEY *pk;
int ret;
pk = EVP_PKEY_new();
if (!pk || !EVP_PKEY_set1_EC_KEY(pk, (EC_KEY *) x))
return 0;
ret = EVP_PKEY_print_params(bp, pk, 4, NULL);
EVP_PKEY_free(pk);
return ret;
}
static int
print_bin(BIO * fp, const char *str, const unsigned char *num,
size_t len, int off);
int
ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off)
{
unsigned char *buffer = NULL;
size_t buf_len = 0, i;
int ret = 0, reason = ERR_R_BIO_LIB;
BN_CTX *ctx = NULL;
const EC_POINT *point = NULL;
BIGNUM *p = NULL, *a = NULL, *b = NULL, *gen = NULL, *order = NULL,
*cofactor = NULL;
const unsigned char *seed;
size_t seed_len = 0;
const char *nname;
static const char *gen_compressed = "Generator (compressed):";
static const char *gen_uncompressed = "Generator (uncompressed):";
static const char *gen_hybrid = "Generator (hybrid):";
if (!x) {
reason = ERR_R_PASSED_NULL_PARAMETER;
goto err;
}
ctx = BN_CTX_new();
if (ctx == NULL) {
reason = ERR_R_MALLOC_FAILURE;
goto err;
}
if (EC_GROUP_get_asn1_flag(x)) {
/* the curve parameter are given by an asn1 OID */
int nid;
if (!BIO_indent(bp, off, 128))
goto err;
nid = EC_GROUP_get_curve_name(x);
if (nid == 0)
goto err;
if (BIO_printf(bp, "ASN1 OID: %s", OBJ_nid2sn(nid)) <= 0)
goto err;
if (BIO_printf(bp, "\n") <= 0)
goto err;
nname = EC_curve_nid2nist(nid);
if (nname) {
if (!BIO_indent(bp, off, 128))
goto err;
if (BIO_printf(bp, "NIST CURVE: %s\n", nname) <= 0)
goto err;
}
} else {
/* explicit parameters */
int is_char_two = 0;
point_conversion_form_t form;
int tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x));
if (tmp_nid == NID_X9_62_characteristic_two_field)
is_char_two = 1;
if ((p = BN_new()) == NULL || (a = BN_new()) == NULL ||
(b = BN_new()) == NULL || (order = BN_new()) == NULL ||
(cofactor = BN_new()) == NULL) {
reason = ERR_R_MALLOC_FAILURE;
goto err;
}
#ifndef OPENSSL_NO_EC2M
if (is_char_two) {
if (!EC_GROUP_get_curve_GF2m(x, p, a, b, ctx)) {
reason = ERR_R_EC_LIB;
goto err;
}
} else /* prime field */
#endif
{
if (!EC_GROUP_get_curve_GFp(x, p, a, b, ctx)) {
reason = ERR_R_EC_LIB;
goto err;
}
}
if ((point = EC_GROUP_get0_generator(x)) == NULL) {
reason = ERR_R_EC_LIB;
goto err;
}
if (!EC_GROUP_get_order(x, order, NULL) ||
!EC_GROUP_get_cofactor(x, cofactor, NULL)) {
reason = ERR_R_EC_LIB;
goto err;
}
form = EC_GROUP_get_point_conversion_form(x);
if ((gen = EC_POINT_point2bn(x, point,
form, NULL, ctx)) == NULL) {
reason = ERR_R_EC_LIB;
goto err;
}
buf_len = (size_t) BN_num_bytes(p);
if (buf_len < (i = (size_t) BN_num_bytes(a)))
buf_len = i;
if (buf_len < (i = (size_t) BN_num_bytes(b)))
buf_len = i;
if (buf_len < (i = (size_t) BN_num_bytes(gen)))
buf_len = i;
if (buf_len < (i = (size_t) BN_num_bytes(order)))
buf_len = i;
if (buf_len < (i = (size_t) BN_num_bytes(cofactor)))
buf_len = i;
if ((seed = EC_GROUP_get0_seed(x)) != NULL)
seed_len = EC_GROUP_get_seed_len(x);
buf_len += 10;
if ((buffer = malloc(buf_len)) == NULL) {
reason = ERR_R_MALLOC_FAILURE;
goto err;
}
if (!BIO_indent(bp, off, 128))
goto err;
/* print the 'short name' of the field type */
if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid))
<= 0)
goto err;
if (is_char_two) {
/* print the 'short name' of the base type OID */
int basis_type = EC_GROUP_get_basis_type(x);
if (basis_type == 0)
goto err;
if (!BIO_indent(bp, off, 128))
goto err;
if (BIO_printf(bp, "Basis Type: %s\n",
OBJ_nid2sn(basis_type)) <= 0)
goto err;
/* print the polynomial */
if ((p != NULL) && !ASN1_bn_print(bp, "Polynomial:", p, buffer,
off))
goto err;
} else {
if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, buffer, off))
goto err;
}
if ((a != NULL) && !ASN1_bn_print(bp, "A: ", a, buffer, off))
goto err;
if ((b != NULL) && !ASN1_bn_print(bp, "B: ", b, buffer, off))
goto err;
if (form == POINT_CONVERSION_COMPRESSED) {
if ((gen != NULL) && !ASN1_bn_print(bp, gen_compressed, gen,
buffer, off))
goto err;
} else if (form == POINT_CONVERSION_UNCOMPRESSED) {
if ((gen != NULL) && !ASN1_bn_print(bp, gen_uncompressed, gen,
buffer, off))
goto err;
} else { /* form == POINT_CONVERSION_HYBRID */
if ((gen != NULL) && !ASN1_bn_print(bp, gen_hybrid, gen,
buffer, off))
goto err;
}
if ((order != NULL) && !ASN1_bn_print(bp, "Order: ", order,
buffer, off))
goto err;
if ((cofactor != NULL) && !ASN1_bn_print(bp, "Cofactor: ", cofactor,
buffer, off))
goto err;
if (seed && !print_bin(bp, "Seed:", seed, seed_len, off))
goto err;
}
ret = 1;
err:
if (!ret)
ECerror(reason);
BN_free(p);
BN_free(a);
BN_free(b);
BN_free(gen);
BN_free(order);
BN_free(cofactor);
BN_CTX_free(ctx);
free(buffer);
return (ret);
}
static int
print_bin(BIO * fp, const char *name, const unsigned char *buf,
size_t len, int off)
{
size_t i;
char str[128];
if (buf == NULL)
return 1;
if (off) {
if (off > 128)
off = 128;
memset(str, ' ', off);
if (BIO_write(fp, str, off) <= 0)
return 0;
}
if (BIO_printf(fp, "%s", name) <= 0)
return 0;
for (i = 0; i < len; i++) {
if ((i % 15) == 0) {
str[0] = '\n';
memset(&(str[1]), ' ', off + 4);
if (BIO_write(fp, str, off + 1 + 4) <= 0)
return 0;
}
if (BIO_printf(fp, "%02x%s", buf[i], ((i + 1) == len) ? "" : ":") <= 0)
return 0;
}
if (BIO_write(fp, "\n", 1) <= 0)
return 0;
return 1;
}
|
the_stack_data/75138001.c | /*
* Program used in the experimental evaluation of the following papers.
* 2008ESOP - Chawdhary,Cook,Gulwani,Sagiv,Yang - Ranking Abstractions
* 2010SAS - Alias,Darte,Feautrier,Gonnord, Multi-dimensional Rankings, Program Termination, and Complexity Bounds of Flowchart Programs
*
* Date: 2014
* Author: Caterina Urban
*/
extern int __VERIFIER_nondet_int(void);
int main() {
int x = __VERIFIER_nondet_int();
int y = __VERIFIER_nondet_int();
int z = __VERIFIER_nondet_int();
int tx = __VERIFIER_nondet_int();
while (x >= y && x <= tx + z) {
if (__VERIFIER_nondet_int()) {
z = z - 1;
tx = x;
x = __VERIFIER_nondet_int();
} else {
y = y + 1;
}
}
return 0;
}
|
the_stack_data/26699094.c | // WARNING: The files in this directory have not been extensively tested
// and may be incorrect. --JTB
void main() {
int a = 1;
int b = 3;
for(int t = 0; t < 10; t++) {
a = 1 - a;
if (a == 1) {
b = b - 1;
} else {
a = 4 - b;
}
}
__VERIFIER_assert(a + b == 4);
}
|
the_stack_data/103266293.c |
#include <stdio.h>
#include <stdlib.h>
void scilab_rt_graduate_d0d0_i0i0i0(double scalarin0,
double scalarin1,
int* scalarout0,
int* scalarout1,
int* scalarout2)
{
printf("%f", scalarin0);
printf("%f", scalarin1);
*scalarout0 = rand();
*scalarout1 = rand();
*scalarout2 = rand();
}
|
the_stack_data/92842.c | #include <stdio.h>
#include <string.h>
char A[10][100];
char Sup[1000];
int overlap (int str1, int str2)
{
int i, j;
j = 0;
i = 0;
while (i < strlen (A[str1]))
{
if (A[str1][i] == A[str2][j])
++j;
else if (j >= 1 && A[str1][i] != A[str2][j])
{
--i;
j = 0;
}
else
j = 0;
++i;
}
return j;
}
char cut (int a, int b, int maxoverlap)
{
A[a][strlen (A[a]) - maxoverlap] = 0;
strcat (A[a], A[b]);
strcpy (A[b], A[a]);
A[a][0] = '\0';
}
int main(int argc, char **argv)
{
int n, i, j, maxi, maxj, k;
int maxoverlap;
int curoverlap;
n = 0;
scanf ("%d", &n);
for (i = 0; i < n; ++i)
scanf ("%s", &A[i][0]);
if (n == 1)
{
printf ("%d", strlen (A[0]));
return 0;
}
for (k = 0; k < n; ++k)
{
maxoverlap = -1;
for (i = 0; i < n; ++i)
for (j = 0; j < n; ++j)
{
if (i == j)
continue;
if (strlen (A[i]) > 0 && strlen (A[j]) > 0)
{
curoverlap = overlap (i, j);
if (curoverlap > maxoverlap)
{
maxoverlap = curoverlap;
maxi = i;
maxj = j;
}
}
}
cut (maxi, maxj, maxoverlap);
}
for (i = 0; i < n; ++i)
if (strlen (A[i]) > 0)
printf ("%d", strlen (A[i]));
return 0;
} |
the_stack_data/132954100.c |
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Specifies the cut-off size of the array before it switches from
// parallel merges/sorts to a serial implementation
#define THRESHOLD 512
#define TRUE 1
#define FALSE 0
///////////////////////////////////////////////////////////////////////////////
// Type Declarations //
///////////////////////////////////////////////////////////////////////////////
// Contains the arguments that get passed to the pthread_sort functions
typedef struct
{
long *result;
long *source;
long size;
} SortArg_t;
// Represents the arguments passed as part of the merge process
typedef struct
{
long *result;
long *array_b;
long *array_c;
long b_size;
long c_size;
} MergeArg_t;
///////////////////////////////////////////////////////////////////////////////
// Global Variables //
///////////////////////////////////////////////////////////////////////////////
// manage access to the active thread_count
pthread_mutex_t mutex_;
// Running count of the number of threads within the threads array that are currently running
long thread_count_ = 0;
// Stores the size of the thread pool that is specified from command line
long THREAD_MAX_NUM = 0;
///////////////////////////////////////////////////////////////////////////////
// Function Prototypes //
///////////////////////////////////////////////////////////////////////////////
long pthread_binary_search( long *search_array, long array_size, long value );
void pthread_s_merge( long *result, long *array_b, long b_size, long *array_c, long c_size );
void* pthread_p_merge( void* args );
void* pthread_merge_sort( void *args );
void internal_pthread_join( long thread_index );
void internal_pthread_create(void *(*start_routine) (void *), void* args, long *p_thread_index);
int initialize_threads( int num_of_threads );
int cleanup_threads();
long *pthread_sort(long *array, long size, int num_of_threads);
int increment_thread_count();
void decrement_thread_count();
///////////////////////////////////////////////////////////////////////////////
// Function Implementation //
///////////////////////////////////////////////////////////////////////////////
long pthread_binary_search( long *search_array, long array_size, long value )
{
long min = 0;
long max = array_size - 1;
long mid = 0;
if(value <= search_array[0])
{
return 0;
}
if(value >= search_array[array_size - 1])
{
return array_size;
}
while(min < max)
{
mid = (min + max) / 2;
if(search_array[mid-1] <= value && search_array[mid] >= value)
{
return mid;
}
else if(search_array[mid] <= value && search_array[mid+1] >= value)
{
return mid + 1;
}
if(search_array[mid] < value)
{
min = mid + 1;
}
else if(search_array[mid] > value)
{
max = mid - 1;
}
else
{
return mid;
}
}
return -1;
}
void pthread_s_merge( long *result, long *array_b, long b_size, long *array_c, long c_size )
{
while( b_size > 0 && c_size > 0 )
{
if(*array_b <= *array_c)
{
*result++ = *array_b++; b_size--;
}
else
{
*result++ = *array_c++; c_size--;
}
}
while( b_size > 0 )
{
*result++ = *array_b++; b_size--;
}
while( c_size > 0 )
{
*result++ = *array_c++; c_size--;
}
}
void* pthread_p_merge( void* args )
{
MergeArg_t *pMergeArgs = (MergeArg_t*)args;
pthread_t thread_ctx;
int needs_cleanup = FALSE;
// invert the array that is considered B as B needs to be the larger one
if(pMergeArgs->b_size < pMergeArgs->c_size)
{
MergeArg_t merge_args;
merge_args.result = pMergeArgs->result;
merge_args.array_b = pMergeArgs->array_c;
merge_args.b_size = pMergeArgs->c_size;
merge_args.array_c = pMergeArgs->array_b;;
merge_args.c_size = pMergeArgs->b_size;
pthread_p_merge( (void*)&merge_args );
}
else if( pMergeArgs->b_size <= THRESHOLD )
{
// perform sequential merge rather than parallel
pthread_s_merge( pMergeArgs->result, pMergeArgs->array_b, pMergeArgs->b_size, pMergeArgs->array_c, pMergeArgs->c_size );
}
else
{
long mid_index = pMergeArgs->b_size / 2;
long bin_index = pthread_binary_search( pMergeArgs->array_c, pMergeArgs->c_size, pMergeArgs->array_b[mid_index] );
if(bin_index < 0)
{
printf("ERROR: Received Invalid Binary Search Result\n");
exit(1);
}
pMergeArgs->result[mid_index + bin_index] = pMergeArgs->array_b[mid_index];
// handle values less than the mid_index value within B
MergeArg_t left_args;
left_args.result = pMergeArgs->result;
left_args.array_b = pMergeArgs->array_b;
left_args.b_size = mid_index;
left_args.array_c = pMergeArgs->array_c;
left_args.c_size = bin_index;
if(increment_thread_count() == TRUE)
{
pthread_create( &thread_ctx, NULL, &pthread_p_merge, &left_args );
needs_cleanup = TRUE;
}
else
{
// The thread pool is full and thus execution needs to continue within this thread
// so that work is being completed. A deadlock situation can take place if a forced
// spawn of a thread is necessary. This is particularly likely if the number of allowed
// threads is small while the source array is large.
pthread_p_merge((void*)&left_args);
}
// handle values larger than the mid_index value within B
MergeArg_t right_args;
right_args.result = pMergeArgs->result + mid_index + bin_index + 1;
right_args.array_b = pMergeArgs->array_b + mid_index + 1;
right_args.b_size = pMergeArgs->b_size - mid_index - 1;
right_args.array_c = pMergeArgs->array_c + bin_index;
right_args.c_size = pMergeArgs->c_size - bin_index;
pthread_p_merge( (void*)&right_args );
// Need to wait for the thread created to handle the left half of problem
if(needs_cleanup == TRUE)
{
pthread_join( thread_ctx, NULL );
decrement_thread_count();
}
}
return NULL;
}
long pthread_partition( long *buffer, long start, long end )
{
long temp = 0;
long pivot = buffer[end];
long i = start - 1;
long j = start;
for( j = start; j < end; j++ )
{
if(buffer[j] <= pivot)
{
i++;
temp = buffer[i];
buffer[i] = buffer[j];
buffer[j] = temp;
}
}
temp = buffer[i+1];
buffer[i+1] = buffer[end];
buffer[end] = temp;
return i + 1;
}
void pthread_recursive_quicksort( long *buffer, long start, long end )
{
if(start >= end)
{
return;
}
long mid = pthread_partition( buffer, start, end );
pthread_recursive_quicksort( buffer, start, mid - 1 );
pthread_recursive_quicksort( buffer, mid + 1, end );
}
void pthread_quicksort( long *result, long *source, long size )
{
// the following sort algorithm will perform an in place
// sorting of the data so it needs to be copied to the
// destination buffer so that they sorting can be performed
memcpy( result, source, sizeof(long) * size);
pthread_recursive_quicksort( result, 0, size - 1 );
}
void* pthread_merge_sort( void *args )
{
SortArg_t *pSortArgs = (SortArg_t*)args;
pthread_t thread_ctx;
int needs_cleanup = FALSE;
if(pSortArgs->size <= THRESHOLD)
{
pthread_quicksort( pSortArgs->result, pSortArgs->source, pSortArgs->size );
}
else if(pSortArgs->size == 0)
{
return NULL;
}
else
{
long *C = malloc(pSortArgs->size * sizeof(long));
if(C == 0)
{
printf("ERROR: Insufficient Memory; size=%ld\n", pSortArgs->size);
exit(-1);
}
SortArg_t left_args;
left_args.result = C;
left_args.source = pSortArgs->source;
left_args.size = pSortArgs->size / 2;
if(increment_thread_count() == TRUE)
{
pthread_create( &thread_ctx, NULL, &pthread_merge_sort, &left_args );
needs_cleanup = TRUE;
}
else
{
// The thread pool is full and thus execution needs to continue within this thread
// so that work is being completed. A deadlock situation can take place if a forced
// spawn of a thread is necessary. This is particularly likely if the number of allowed
// threads is small while the source array is large.
pthread_merge_sort((void*)&left_args);
}
SortArg_t right_args;
right_args.result = C + (pSortArgs->size / 2);
right_args.source = pSortArgs->source + (pSortArgs->size / 2);
right_args.size = pSortArgs->size - (pSortArgs->size / 2);
pthread_merge_sort((void*)&right_args);
// Need to wait for the thread created to handle the left half of problem
if(needs_cleanup == TRUE)
{
pthread_join( thread_ctx, NULL );
decrement_thread_count();
}
MergeArg_t merge_args;
merge_args.result = pSortArgs->result;
merge_args.array_b = C;
merge_args.b_size = (pSortArgs->size / 2);
merge_args.array_c = C + (pSortArgs->size / 2);
merge_args.c_size = pSortArgs->size - (pSortArgs->size / 2);
pthread_p_merge( (void*)&merge_args );
free(C);
}
return NULL;
}
int increment_thread_count()
{
int ret_val = TRUE;
pthread_mutex_lock( &mutex_ );
if(thread_count_ >= THREAD_MAX_NUM)
{
ret_val = FALSE;
}
else
{
thread_count_ += 1;
ret_val = TRUE;
}
pthread_mutex_unlock( &mutex_ );
return ret_val;
}
void decrement_thread_count()
{
pthread_mutex_lock(&mutex_);
thread_count_ -= 1;
pthread_mutex_unlock(&mutex_);
}
int initialize_threads( int num_of_threads )
{
// Step 1. Need to initialize the mutex for protecting access to thread_count and
// thread pool
if(pthread_mutex_init(&mutex_, NULL) != 0)
{
printf("ERROR: Failed to initialize mutex\n");
return FALSE;
}
// Step 2. Reset active thread count
thread_count_ = 0;
// Step 3. Configure the thread pool size global
THREAD_MAX_NUM = num_of_threads;
return TRUE;
}
int cleanup_threads()
{
// Step 1. Destroy the mutex
if(pthread_mutex_destroy(&mutex_) != 0)
{
printf("ERROR: Failed to destroy the mutex properly\n");
return FALSE;
}
// Step 2. Reset the thread pool size and active counts
thread_count_ = 0;
THREAD_MAX_NUM = 0;
return TRUE;
}
long *pthread_sort(long *array, long size, int num_of_threads)
{
int error = FALSE;
// attempt to initialize all the resources necessary to manage
// the specified thread pool size
if(!initialize_threads(num_of_threads))
{
printf("ERROR: Failed to inialize memory system\n");
return array;
}
long *result = malloc(sizeof(long) * size);
if(result == 0)
{
printf("Insufficient Memory\n");
error = TRUE;
}
if(error == FALSE)
{
SortArg_t args;
args.result = result;
args.source = array;
args.size = size;
pthread_merge_sort( (void*)&args );
}
if(!cleanup_threads())
{
printf("ERROR: Failed to release resources from thread pool\n");
}
if(error == FALSE)
return result;
else
return array;
}
|
the_stack_data/98576043.c | #include<stdio.h>
int main(int argc, char **argv)
{
printf("Hello World\n");
int i;
printf("%d\n", argc);
for (i=0; i<=argc; i++) {
printf("%d %s\n", i, argv[i]);
}
return 0;
}
|
the_stack_data/200143566.c | #include <stdio.h>
#include <stdlib.h>
#define MAX_LENGTH_ARRAY 50
// Helper function
int is_found(int input_short[MAX_LENGTH_ARRAY],int size, int val);
void get_ans(int input_short[MAX_LENGTH_ARRAY],int input_long[MAX_LENGTH_ARRAY],int size_short,int size_long);
int get_array(int input[MAX_LENGTH_ARRAY]);
int until_all_found(int input_short[MAX_LENGTH_ARRAY],int input_long[MAX_LENGTH_ARRAY], int size_short,int size_long,int index);
int All_positive(int count[100001],int input_short[MAX_LENGTH_ARRAY],int size_short);
int main()
{
int input_short[MAX_LENGTH_ARRAY],input_long[MAX_LENGTH_ARRAY];
int size_short = get_array(input_short);
int size_long = get_array(input_long);
printf("reached Here\n");
get_ans(input_short,input_long,size_short,size_long);
return 0;
}
int get_array(int input[MAX_LENGTH_ARRAY])
{
int size;
printf("Size( < 50): ");
scanf("%d", &size);
for(int index = 0; index < size; index ++)
{
scanf("%d", &input[index]);
}
return size;
}
int is_found(int input_short[MAX_LENGTH_ARRAY],int size, int val)
{
for(int i=0;i<size;i++)
{
if(input_short[i]==val)
{
return 1;
}
}
return 0;
}
int All_positive(int count[100001],int input_short[MAX_LENGTH_ARRAY],int size_short)
{
int c = 0;
for(int i = 0;i<size_short;i++)
{
if(count[input_short[i]]>0)
{
c++;
}
}
if(c == size_short)
{
return 1;
}
return 0;
}
int until_all_found(int input_short[MAX_LENGTH_ARRAY],int input_long[MAX_LENGTH_ARRAY],
int size_short,int size_long,int index)
{
int count[100001] = {0};
while(1)
{
if(is_found(input_short,size_short,input_long[index]))
{
count[input_long[index]]++;
}
if(All_positive(count,input_short,size_short))
{
break;
}
index++;
}
return index;
}
void get_ans(int input_short[MAX_LENGTH_ARRAY],int input_long[MAX_LENGTH_ARRAY],int size_short,int size_long)
{
int min_index, min_window_size = MAX_LENGTH_ARRAY+1;
for(int i = 0;i<size_long-size_short+1;i++)
{
if(is_found(input_short,size_short,input_long[i]))
{
int last_index = until_all_found(input_short,input_long,size_short,size_long,i);
if(last_index-i < min_window_size)
{
min_window_size = last_index-i+1;
min_index = i;
}
}
}
printf("{%d,%d}\n",min_index,min_index+min_window_size-1);
return;
} |
the_stack_data/134639.c | /*****************************************************************************/
/* ti_nan.c */
/* */
/* Copyright (c) 2015 Texas Instruments Incorporated */
/* http://www.ti.com/ */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions */
/* are met: */
/* */
/* Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* */
/* Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in */
/* the documentation and/or other materials provided with the */
/* distribution. */
/* */
/* Neither the name of Texas Instruments Incorporated nor the names */
/* of its contributors may be used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
/* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/*****************************************************************************/
#include <math.h>
#pragma diag_suppress 880
float nanf(const char *s) { return NAN; }
double nan (const char *s) { return NAN; }
long double nanl(const char *s) { return NAN; }
|
the_stack_data/282014.c | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int a, b, aux;
printf("Digite o valor de a: ");
scanf("%d", &a);
printf("Digite o valor de b: ");
scanf("%d", &b);
aux = a;
a = b;
b = aux;
printf("O valor de a: %d, de b: %d", a,b);
return 0;
}
|
the_stack_data/198580683.c | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
n = 10;
while(n)
{
printf("%d\n",n);
n = n - 1;
}
printf("0\n");
printf("FIM!");
return 0;
} |
the_stack_data/151706283.c | #include <pthread.h>
#include <stdio.h>
double arr1[200000];
double total=0.0;
int c;
pthread_mutex_t my_mutex;
void * count_func(void * arg)
{
pthread_mutex_lock(&my_mutex);
int id = (int)arg;
if(id)
{ int i;
for(i=200000/c*(id-1);i<200000/c*id;i++)
{
total += arr1[i];
}
printf("%d: sum is %lf\n",id,total);
id = 0;
}
pthread_mutex_unlock(&my_mutex);
}
int main(int argc, char* argv[]) {
pthread_mutex_init(&my_mutex,NULL);
int rc;
int i= 0,*j;
for(i=0;i<200000;i++) arr1[i] = 1;
printf("The remainder of 200000 divided by this number is zero\nPlease input this number and: ");
scanf("%d",&c);
while(200000%c != 0){
printf("error ,please input again: \n");
printf("please input a number: ");
scanf("%d",&c);
}
pthread_t thread[c];
for(i=0;i<c;i++)
{
rc = pthread_create(&thread[i], NULL,count_func, (void *)(i+1));
if (rc)
printf("ERROR when creating default thread; Code is %d\n", rc);
pthread_join(thread[i], NULL);
}
printf("The final sum :%lf",total);
pthread_exit(NULL);
}
|
the_stack_data/181393640.c | #define _GNU_SOURCE /* Get definition of MSG_EXCEPT */
#include <sys/types.h>
#include <sys/mman.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* Does not work on OS X, as you can't mmap over /dev/zero */
int main(void)
{
const char str1[] = "string 1";
const char str2[] = "string 2";
pid_t parpid = getpid(), childpid;
int fd = -1;
char *anon, *zero;
if ((fd = open("/dev/zero", O_RDWR, 0)) == -1)
err(1, "open");
anon = (char*)mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
zero = (char*)mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (anon == MAP_FAILED || zero == MAP_FAILED)
errx(1, "either mmap");
strcpy(anon, str1);
strcpy(zero, str1);
printf("PID %d:\tanonymous %s, zero-backed %s\n", parpid, anon, zero);
switch ((childpid = fork())) {
case -1:
err(1, "fork");
/* NOTREACHED */
case 0:
childpid = getpid();
printf("PID %d:\tanonymous %s, zero-backed %s\n", childpid, anon, zero);
sleep(3);
printf("PID %d:\tanonymous %s, zero-backed %s\n", childpid, anon, zero);
munmap(anon, 4096);
munmap(zero, 4096);
close(fd);
return EXIT_SUCCESS;
}
sleep(2);
strcpy(anon, str2);
strcpy(zero, str2);
printf("PID %d:\tanonymous %s, zero-backed %s\n", parpid, anon, zero);
munmap(anon, 4096);
munmap(zero, 4096);
close(fd);
return EXIT_SUCCESS;
} |
the_stack_data/225143989.c | /*
* MVL support routines for PhysicsFS.
*
* This driver handles Descent II Movielib archives.
*
* The file format of MVL is quite easy...
*
* //MVL File format - Written by Heiko Herrmann
* char sig[4] = {'D','M', 'V', 'L'}; // "DMVL"=Descent MoVie Library
*
* int num_files; // the number of files in this MVL
*
* struct {
* char file_name[13]; // Filename, padded to 13 bytes with 0s
* int file_size; // filesize in bytes
* }DIR_STRUCT[num_files];
*
* struct {
* char data[file_size]; // The file data
* }FILE_STRUCT[num_files];
*
* (That info is from http://www.descent2.com/ddn/specs/mvl/)
*
* Please see the file LICENSE in the source's root directory.
*
* This file written by Bradley Bell.
* Based on grp.c by Ryan C. Gordon.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if (defined PHYSFS_SUPPORTS_MVL)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "../physfs_internal.h"
typedef struct
{
char name[13];
PHYSFS_uint32 startPos;
PHYSFS_uint32 size;
} MVLentry;
typedef struct
{
char *filename;
PHYSFS_sint64 last_mod_time;
PHYSFS_uint32 entryCount;
MVLentry *entries;
} MVLinfo;
typedef struct
{
void *handle;
MVLentry *entry;
PHYSFS_uint32 curPos;
} MVLfileinfo;
static void MVL_dirClose(DirHandle *h);
static PHYSFS_sint64 MVL_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static PHYSFS_sint64 MVL_write(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static int MVL_eof(FileHandle *handle);
static PHYSFS_sint64 MVL_tell(FileHandle *handle);
static int MVL_seek(FileHandle *handle, PHYSFS_uint64 offset);
static PHYSFS_sint64 MVL_fileLength(FileHandle *handle);
static int MVL_fileClose(FileHandle *handle);
static int MVL_isArchive(const char *filename, int forWriting);
static DirHandle *MVL_openArchive(const char *name, int forWriting);
static LinkedStringList *MVL_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks);
static int MVL_exists(DirHandle *h, const char *name);
static int MVL_isDirectory(DirHandle *h, const char *name, int *fileExists);
static int MVL_isSymLink(DirHandle *h, const char *name, int *fileExists);
static PHYSFS_sint64 MVL_getLastModTime(DirHandle *h, const char *n, int *e);
static FileHandle *MVL_openRead(DirHandle *h, const char *name, int *exist);
static FileHandle *MVL_openWrite(DirHandle *h, const char *name);
static FileHandle *MVL_openAppend(DirHandle *h, const char *name);
static int MVL_remove(DirHandle *h, const char *name);
static int MVL_mkdir(DirHandle *h, const char *name);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MVL =
{
"MVL",
MVL_ARCHIVE_DESCRIPTION,
"Bradley Bell <[email protected]>",
"http://icculus.org/physfs/",
};
static const FileFunctions __PHYSFS_FileFunctions_MVL =
{
MVL_read, /* read() method */
MVL_write, /* write() method */
MVL_eof, /* eof() method */
MVL_tell, /* tell() method */
MVL_seek, /* seek() method */
MVL_fileLength, /* fileLength() method */
MVL_fileClose /* fileClose() method */
};
const DirFunctions __PHYSFS_DirFunctions_MVL =
{
&__PHYSFS_ArchiveInfo_MVL,
MVL_isArchive, /* isArchive() method */
MVL_openArchive, /* openArchive() method */
MVL_enumerateFiles, /* enumerateFiles() method */
MVL_exists, /* exists() method */
MVL_isDirectory, /* isDirectory() method */
MVL_isSymLink, /* isSymLink() method */
MVL_getLastModTime, /* getLastModTime() method */
MVL_openRead, /* openRead() method */
MVL_openWrite, /* openWrite() method */
MVL_openAppend, /* openAppend() method */
MVL_remove, /* remove() method */
MVL_mkdir, /* mkdir() method */
MVL_dirClose /* dirClose() method */
};
static void MVL_dirClose(DirHandle *h)
{
MVLinfo *info = ((MVLinfo *) h->opaque);
free(info->filename);
free(info->entries);
free(info);
free(h);
} /* MVL_dirClose */
static PHYSFS_sint64 MVL_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
MVLfileinfo *finfo = (MVLfileinfo *) (handle->opaque);
MVLentry *entry = finfo->entry;
PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
PHYSFS_sint64 rc;
if (objsLeft < objCount)
objCount = objsLeft;
rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
if (rc > 0)
finfo->curPos += (PHYSFS_uint32) (rc * objSize);
return(rc);
} /* MVL_read */
static PHYSFS_sint64 MVL_write(FileHandle *handle, const void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* MVL_write */
static int MVL_eof(FileHandle *handle)
{
MVLfileinfo *finfo = (MVLfileinfo *) (handle->opaque);
MVLentry *entry = finfo->entry;
return(finfo->curPos >= entry->size);
} /* MVL_eof */
static PHYSFS_sint64 MVL_tell(FileHandle *handle)
{
return(((MVLfileinfo *) (handle->opaque))->curPos);
} /* MVL_tell */
static int MVL_seek(FileHandle *handle, PHYSFS_uint64 offset)
{
MVLfileinfo *finfo = (MVLfileinfo *) (handle->opaque);
MVLentry *entry = finfo->entry;
int rc;
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
if (rc)
finfo->curPos = (PHYSFS_uint32) offset;
return(rc);
} /* MVL_seek */
static PHYSFS_sint64 MVL_fileLength(FileHandle *handle)
{
MVLfileinfo *finfo = ((MVLfileinfo *) handle->opaque);
return((PHYSFS_sint64) finfo->entry->size);
} /* MVL_fileLength */
static int MVL_fileClose(FileHandle *handle)
{
MVLfileinfo *finfo = ((MVLfileinfo *) handle->opaque);
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
free(finfo);
free(handle);
return(1);
} /* MVL_fileClose */
static int mvl_open(const char *filename, int forWriting,
void **fh, PHYSFS_uint32 *count)
{
PHYSFS_uint8 buf[4];
*fh = NULL;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
*fh = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(*fh == NULL, NULL, 0);
if (__PHYSFS_platformRead(*fh, buf, 4, 1) != 1)
goto openMvl_failed;
if (memcmp(buf, "DMVL", 4) != 0)
{
__PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
goto openMvl_failed;
} /* if */
if (__PHYSFS_platformRead(*fh, count, sizeof (PHYSFS_uint32), 1) != 1)
goto openMvl_failed;
*count = PHYSFS_swapULE32(*count);
return(1);
openMvl_failed:
if (*fh != NULL)
__PHYSFS_platformClose(*fh);
*count = -1;
*fh = NULL;
return(0);
} /* mvl_open */
static int MVL_isArchive(const char *filename, int forWriting)
{
void *fh;
PHYSFS_uint32 fileCount;
int retval = mvl_open(filename, forWriting, &fh, &fileCount);
if (fh != NULL)
__PHYSFS_platformClose(fh);
return(retval);
} /* MVL_isArchive */
static int mvl_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
if (one != two)
{
const MVLentry *a = (const MVLentry *) _a;
return(strcmp(a[one].name, a[two].name));
} /* if */
return 0;
} /* mvl_entry_cmp */
static void mvl_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
if (one != two)
{
MVLentry tmp;
MVLentry *first = &(((MVLentry *) _a)[one]);
MVLentry *second = &(((MVLentry *) _a)[two]);
memcpy(&tmp, first, sizeof (MVLentry));
memcpy(first, second, sizeof (MVLentry));
memcpy(second, &tmp, sizeof (MVLentry));
} /* if */
} /* mvl_entry_swap */
static int mvl_load_entries(const char *name, int forWriting, MVLinfo *info)
{
void *fh = NULL;
PHYSFS_uint32 fileCount;
PHYSFS_uint32 location = 8; /* sizeof sig. */
MVLentry *entry;
BAIL_IF_MACRO(!mvl_open(name, forWriting, &fh, &fileCount), NULL, 0);
info->entryCount = fileCount;
info->entries = (MVLentry *) malloc(sizeof (MVLentry) * fileCount);
if (info->entries == NULL)
{
__PHYSFS_platformClose(fh);
BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
} /* if */
location += (17 * fileCount);
for (entry = info->entries; fileCount > 0; fileCount--, entry++)
{
if (__PHYSFS_platformRead(fh, &entry->name, 13, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
if (__PHYSFS_platformRead(fh, &entry->size, 4, 1) != 1)
{
__PHYSFS_platformClose(fh);
return(0);
} /* if */
entry->size = PHYSFS_swapULE32(entry->size);
entry->startPos = location;
location += entry->size;
} /* for */
__PHYSFS_platformClose(fh);
__PHYSFS_sort(info->entries, info->entryCount,
mvl_entry_cmp, mvl_entry_swap);
return(1);
} /* mvl_load_entries */
static DirHandle *MVL_openArchive(const char *name, int forWriting)
{
MVLinfo *info;
DirHandle *retval = malloc(sizeof (DirHandle));
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
info = retval->opaque = malloc(sizeof (MVLinfo));
if (info == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto MVL_openArchive_failed;
} /* if */
memset(info, '\0', sizeof (MVLinfo));
info->filename = (char *) malloc(strlen(name) + 1);
if (info->filename == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto MVL_openArchive_failed;
} /* if */
if (!mvl_load_entries(name, forWriting, info))
goto MVL_openArchive_failed;
strcpy(info->filename, name);
info->last_mod_time = modtime;
retval->funcs = &__PHYSFS_DirFunctions_MVL;
return(retval);
MVL_openArchive_failed:
if (retval != NULL)
{
if (retval->opaque != NULL)
{
if (info->filename != NULL)
free(info->filename);
if (info->entries != NULL)
free(info->entries);
free(info);
} /* if */
free(retval);
} /* if */
return(NULL);
} /* MVL_openArchive */
static LinkedStringList *MVL_enumerateFiles(DirHandle *h,
const char *dirname,
int omitSymLinks)
{
MVLinfo *info = ((MVLinfo *) h->opaque);
MVLentry *entry = info->entries;
LinkedStringList *retval = NULL, *p = NULL;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
/* no directories in MVL files. */
BAIL_IF_MACRO(*dirname != '\0', ERR_NOT_A_DIR, NULL);
for (i = 0; i < max; i++, entry++)
retval = __PHYSFS_addToLinkedStringList(retval, &p, entry->name, -1);
return(retval);
} /* MVL_enumerateFiles */
static MVLentry *mvl_find_entry(MVLinfo *info, const char *name)
{
char *ptr = strchr(name, '.');
MVLentry *a = info->entries;
PHYSFS_sint32 lo = 0;
PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
PHYSFS_sint32 middle;
int rc;
/*
* Rule out filenames to avoid unneeded processing...no dirs,
* big filenames, or extensions > 3 chars.
*/
BAIL_IF_MACRO((ptr) && (strlen(ptr) > 4), ERR_NO_SUCH_FILE, NULL);
BAIL_IF_MACRO(strlen(name) > 12, ERR_NO_SUCH_FILE, NULL);
BAIL_IF_MACRO(strchr(name, '/') != NULL, ERR_NO_SUCH_FILE, NULL);
while (lo <= hi)
{
middle = lo + ((hi - lo) / 2);
rc = __PHYSFS_platformStricmp(name, a[middle].name);
if (rc == 0) /* found it! */
return(&a[middle]);
else if (rc > 0)
lo = middle + 1;
else
hi = middle - 1;
} /* while */
BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
} /* mvl_find_entry */
static int MVL_exists(DirHandle *h, const char *name)
{
return(mvl_find_entry(((MVLinfo *) h->opaque), name) != NULL);
} /* MVL_exists */
static int MVL_isDirectory(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = MVL_exists(h, name);
return(0); /* never directories in a groupfile. */
} /* MVL_isDirectory */
static int MVL_isSymLink(DirHandle *h, const char *name, int *fileExists)
{
*fileExists = MVL_exists(h, name);
return(0); /* never symlinks in a groupfile. */
} /* MVL_isSymLink */
static PHYSFS_sint64 MVL_getLastModTime(DirHandle *h,
const char *name,
int *fileExists)
{
MVLinfo *info = ((MVLinfo *) h->opaque);
PHYSFS_sint64 retval = -1;
*fileExists = (mvl_find_entry(info, name) != NULL);
if (*fileExists) /* use time of MVL itself in the physical filesystem. */
retval = ((MVLinfo *) h->opaque)->last_mod_time;
return(retval);
} /* MVL_getLastModTime */
static FileHandle *MVL_openRead(DirHandle *h, const char *fnm, int *fileExists)
{
MVLinfo *info = ((MVLinfo *) h->opaque);
FileHandle *retval;
MVLfileinfo *finfo;
MVLentry *entry;
entry = mvl_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
retval = (FileHandle *) malloc(sizeof (FileHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
finfo = (MVLfileinfo *) malloc(sizeof (MVLfileinfo));
if (finfo == NULL)
{
free(retval);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
free(finfo);
free(retval);
return(NULL);
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
retval->opaque = (void *) finfo;
retval->funcs = &__PHYSFS_FileFunctions_MVL;
retval->dirHandle = h;
return(retval);
} /* MVL_openRead */
static FileHandle *MVL_openWrite(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* MVL_openWrite */
static FileHandle *MVL_openAppend(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* MVL_openAppend */
static int MVL_remove(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* MVL_remove */
static int MVL_mkdir(DirHandle *h, const char *name)
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* MVL_mkdir */
#endif /* defined PHYSFS_SUPPORTS_MVL */
/* end of mvl.c ... */
|
the_stack_data/182952770.c | //
// Created by zhangrongxiang on 2018/2/22 16:49
// File getpwnam_r
//
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
int main(int argc, char *argv[]) {
struct passwd pwd;
struct passwd *result;
char *buf;
size_t bufsize;
int s;
if (argc != 2) {
fprintf(stderr, "Usage: %s username\n", argv[0]);
exit(EXIT_FAILURE);
}
bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
if (bufsize == -1) /* Value was indeterminate */
bufsize = 16384; /* Should be more than enough */
buf = malloc(bufsize);
if (buf == NULL) {
perror("malloc");
exit(EXIT_FAILURE);
}
s = getpwnam_r(argv[1], &pwd, buf, bufsize, &result);
if (result == NULL) {
if (s == 0)
printf("Not found\n");
else {
errno = s;
perror("getpwnam_r");
}
exit(EXIT_FAILURE);
}
printf("Name: %s; UID: %ld\n", pwd.pw_gecos, (long) pwd.pw_uid);
exit(EXIT_SUCCESS);
}
|
the_stack_data/11075903.c | /* Simple implementation of strstr for systems without it.
This function is in the public domain. */
/*
@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
This function searches for the substring @var{sub} in the string
@var{string}, not including the terminating null characters. A pointer
to the first occurrence of @var{sub} is returned, or @code{NULL} if the
substring is absent. If @var{sub} points to a string with zero
length, the function returns @var{string}.
@end deftypefn
*/
#include <stddef.h>
extern int memcmp (const void *, const void *, size_t);
extern size_t strlen (const char *);
char *
strstr (const char *s1, const char *s2)
{
const size_t len = strlen (s2);
while (*s1)
{
if (!memcmp (s1, s2, len))
return (char *)s1;
++s1;
}
return (0);
}
|
the_stack_data/979950.c | #include <stdio.h>
#define MAX 1000001
int N;
int arr[MAX];
int MIN(int a, int b)
{
return a < b ? a : b;
}
int main(void)
{
scanf("%d",&N);
int tmp;
for (int i=2;i<=N;i++) //arr[0]=arr[1]=1
{
arr[i]=arr[i-1]+1;
if (i%3==0)
{
tmp=arr[i/3]+1;
arr[i]=MIN(arr[i],tmp);
}
if (i%2==0)
{
tmp=arr[i/2]+1;
arr[i]=MIN(arr[i],tmp);
}
}
printf("%d\n", arr[N]);
} |
the_stack_data/934907.c | /* { dg-do assemble } */
/* { dg-skip-if "" { "*-*-darwin*" "*-*-mingw*" } { "*" } { "" } } */
/* { dg-options "-std=c99 -x assembler-with-cpp" } */
#ifndef __ASSEMBLER__
extern int func(void);
#else
#ifdef __sun__
.globl func
#else
.global func
#endif
.type func,@function
.align 4
func:
ret
.size func,.-func
#endif
|
the_stack_data/141064.c | /* Generated automatically by H5make_libsettings -- do not edit */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* [email protected]. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Created: Nov 3, 2021
*
*
* Purpose: This machine-generated source code contains
* information about the library build configuration
*
* Modifications:
*
* DO NOT MAKE MODIFICATIONS TO THIS FILE!
* It was generated by code in `H5make_libsettings.c'.
*
*-------------------------------------------------------------------------
*/
char H5libhdf5_settings[]=
" SUMMARY OF THE HDF5 CONFIGURATION\n"
" =================================\n"
"\n"
"General Information:\n"
"-------------------\n"
" HDF5 Version: 1.12.1\n"
" Configured on: 2021-11-03\n"
" Configured by: Visual Studio 16 2019\n"
" Host system: Windows-10.0.19043\n"
" Uname information: Windows\n"
" Byte sex: little-endian\n"
" Installation point: C:/Program Files/HDF_Group/HDF5/1.12.1\n"
"\n"
"Compiling Options:\n"
"------------------\n"
" Build Mode: \n"
" Debugging Symbols: OFF\n"
" Asserts: OFF\n"
" Profiling: OFF\n"
" Optimization Level: OFF\n"
"\n"
"Linking Options:\n"
"----------------\n"
" Libraries: \n"
" Statically Linked Executables: OFF\n"
" LDFLAGS: /machine:x64\n"
" H5_LDFLAGS: \n"
" AM_LDFLAGS: \n"
" Extra libraries: \n"
" Archiver: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/lib.exe\n"
" Ranlib: :\n"
"\n"
"Languages:\n"
"----------\n"
" C: YES\n"
" C Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe 19.29.30037.0\n"
" CPPFLAGS: \n"
" H5_CPPFLAGS: \n"
" AM_CPPFLAGS: \n"
" CFLAGS: /DWIN32 /D_WINDOWS \n"
" H5_CFLAGS: /W3;/wd4100;/wd4706;/wd4127\n"
" AM_CFLAGS: \n"
" Shared C Library: YES\n"
" Static C Library: YES\n"
"\n"
" Fortran: OFF\n"
" Fortran Compiler: \n"
" Fortran Flags: \n"
" H5 Fortran Flags: \n"
" AM Fortran Flags: \n"
" Shared Fortran Library: YES\n"
" Static Fortran Library: YES\n"
"\n"
" C++: ON\n"
" C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe 19.29.30037.0\n"
" C++ Flags: \n"
" H5 C++ Flags: /W3;/wd4100;/wd4706;/wd4127\n"
" AM C++ Flags: \n"
" Shared C++ Library: YES\n"
" Static C++ Library: YES\n"
"\n"
" JAVA: OFF\n"
" JAVA Compiler: \n"
"\n"
"Features:\n"
"---------\n"
" Parallel HDF5: OFF\n"
"Parallel Filtered Dataset Writes: \n"
" Large Parallel I/O: \n"
" High-level library: ON\n"
" Build HDF5 Tests: ON\n"
" Build HDF5 Tools: ON\n"
" Threadsafety: ON (recursive RW locks: ) \n"
" Default API mapping: v18\n"
" With deprecated public symbols: ON\n"
" I/O filters (external): \n"
" MPE: \n"
" Direct VFD: \n"
" Mirror VFD: \n"
" (Read-Only) S3 VFD: \n"
" (Read-Only) HDFS VFD: \n"
" dmalloc: \n"
" Packages w/ extra debug output: \n"
" API Tracing: OFF\n"
" Using memory checker: OFF\n"
" Memory allocation sanity checks: OFF\n"
" Function Stack Tracing: OFF\n"
" Use file locking: best-effort\n"
" Strict File Format Checks: OFF\n"
" Optimization Instrumentation: \n"
;
|
the_stack_data/22012695.c |
/*@ begin PerfTuning (
def build
{
arg build_command = 'gcc -O3 -fopenmp ';
arg libs = '-lm -lrt';
}
def performance_counter
{
arg repetitions = 35;
}
def performance_params
{
param T1_I[] = [1,16,32,64,128,256,512];
param T1_J[] = [1,16,32,64,128,256,512];
param T2_I[] = [1,64,128,256,512,1024,2048];
param T2_J[] = [1,64,128,256,512,1024,2048];
param ACOPY_A[] = [False,True];
param U_I[] = range(1,31);
param U_J[] = range(1,31);
param SCREP[] = [False,True];
param VEC[] = [False,True];
param OMP[] = [False,True];
param PAR1i[]=[False,True];
param PAR1j[]=[False,True];
constraint tileI = ((T2_I == 1) or (T2_I % T1_I == 0));
constraint tileJ = ((T2_J == 1) or (T2_J % T1_J == 0));
constraint reg_capacity = (2*U_I*U_J + 2*U_I + 2*U_J <= 130);
constraint copy_limitA = ((not ACOPY_A) or (ACOPY_A and
(T1_I if T1_I>1 else T2_I)*(T1_J if T1_J>1 else T2_J) <= 512*512));
}
def search
{
arg algorithm = 'Randomsearch';
arg total_runs = 10000;
}
let SIZE = 2500;
def input_params
{
param MSIZE = SIZE;
param NSIZE = SIZE;
param M = SIZE;
param N = SIZE;
}
def input_vars
{
decl static double a[M][N] = random;
decl static double y_1[N] = random;
decl static double y_2[M] = random;
decl static double x1[M] = 0;
decl static double x2[N] = 0;
}
) @*/
int i, j;
int ii, jj;
int iii, jjj;
#define max(x,y) ((x) > (y)? (x) : (y))
#define min(x,y) ((x) < (y)? (x) : (y))
/*@ begin Loop(
transform Composite(
tile = [('i',T1_I,'ii'),('j',T1_J,'jj'),(('ii','i'),T2_I,'iii'),(('jj','j'),T2_J,'jjj')],
arrcopy = [(ACOPY_A,'a[i][j]',[(T1_I if T1_I>1 else T2_I),(T1_J if T1_J>1 else T2_J)],'_copy')],
scalarreplace = (SCREP, 'double', 'scv_'),
vector = (VEC, ['ivdep','vector always']),
unrolljam = (['i','j'],[U_I,U_J]),
openmp = (OMP, 'omp parallel for private(iii,jjj,ii,jj,i,j,a_copy)')
)
for (i=0;i<=N-1;i++)
for (j=0;j<=N-1;j++)
{
x1[i]=x1[i]+a[i][j]*y_1[j];
x2[j]=x2[j]+a[i][j]*y_2[i];
}
) @*/
/*@ end @*/
/*@ end @*/
|
the_stack_data/186264.c | // WARNING in tipc_msg_append
// https://syzkaller.appspot.com/bug?id=75139a7d2605236b0b7f
// status:6
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
uint64_t r[1] = {0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
intptr_t res = 0;
res = syscall(__NR_socketpair, 0x8000000000001eul, 5ul, 0, 0x2000dff8ul);
if (res != -1)
r[0] = *(uint32_t*)0x2000dffc;
*(uint64_t*)0x20236fc8 = 0x8000000;
*(uint32_t*)0x20236fd0 = 0;
*(uint64_t*)0x20236fd8 = 0x200fff80;
*(uint64_t*)0x20236fe0 = 0xc;
*(uint64_t*)0x20236fe8 = 0x201e1e78;
*(uint64_t*)0x20236ff0 = 0;
*(uint32_t*)0x20236ff8 = 0;
syscall(__NR_sendmmsg, r[0], 0x20236fc8ul, 0x4924924924926c8ul, 0ul);
return 0;
}
|
the_stack_data/237644491.c | #include<stdio.h>
#include<math.h>
void f()
{
float k = 121;
printf("in f %f\n",sqrt(k));
}
int main()
{
int k = 5;
printf("in main %f\n",pow(2,k));
f();
return 0;
}
/*HIGHLIGHTS
header functions pow and sqrt used*/
|
the_stack_data/175144496.c | #include <stdbool.h>
bool test1()
{
return false;
}
|
the_stack_data/93888113.c | #define SIZE 8
void break_w_test(float a_in[SIZE], float scalar_in, float b_out[SIZE])
{
int i = SIZE - 1;
while (i >= 0)
{
if (i < SIZE/2) break;
b_out[i] = a_in[i] * scalar_in;
i -= 1;
}
b_out[0] = scalar_in;
}
|
the_stack_data/90511.c | /*
** This module interfaces SQLite to the Google OSS-Fuzz, fuzzer as a service.
** (https://github.com/google/oss-fuzz)
*/
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "sqlite3.h"
/* Global debugging settings. OSS-Fuzz will have all debugging turned
** off. But if LLVMFuzzerTestOneInput() is called interactively from
** the ossshell utility program, then these flags might be set.
*/
static unsigned mDebug = 0;
#define FUZZ_SQL_TRACE 0x0001 /* Set an sqlite3_trace() callback */
#define FUZZ_SHOW_MAX_DELAY 0x0002 /* Show maximum progress callback delay */
#define FUZZ_SHOW_ERRORS 0x0004 /* Print error messages from SQLite */
/* The ossshell utility program invokes this interface to see the
** debugging flags. Unused by OSS-Fuzz.
*/
void ossfuzz_set_debug_flags(unsigned x){
mDebug = x;
}
/* Return the current real-world time in milliseconds since the
** Julian epoch (-4714-11-24).
*/
static sqlite3_int64 timeOfDay(void){
static sqlite3_vfs *clockVfs = 0;
sqlite3_int64 t;
if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0);
if( clockVfs->iVersion>=2 && clockVfs->xCurrentTimeInt64!=0 ){
clockVfs->xCurrentTimeInt64(clockVfs, &t);
}else{
double r;
clockVfs->xCurrentTime(clockVfs, &r);
t = (sqlite3_int64)(r*86400000.0);
}
return t;
}
/* An instance of the following object is passed by pointer as the
** client data to various callbacks.
*/
typedef struct FuzzCtx {
sqlite3 *db; /* The database connection */
sqlite3_int64 iCutoffTime; /* Stop processing at this time. */
sqlite3_int64 iLastCb; /* Time recorded for previous progress callback */
sqlite3_int64 mxInterval; /* Longest interval between two progress calls */
unsigned nCb; /* Number of progress callbacks */
} FuzzCtx;
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
/*
** Progress handler callback.
**
** The argument is the cutoff-time after which all processing should
** stop. So return non-zero if the cut-off time is exceeded.
*/
static int progress_handler(void *pClientData) {
FuzzCtx *p = (FuzzCtx*)pClientData;
sqlite3_int64 iNow = timeOfDay();
int rc = iNow>=p->iCutoffTime;
sqlite3_int64 iDiff = iNow - p->iLastCb;
if( iDiff > p->mxInterval ) p->mxInterval = iDiff;
p->nCb++;
return rc;
}
#endif
/*
** Disallow debugging pragmas such as "PRAGMA vdbe_debug" and
** "PRAGMA parser_trace" since they can dramatically increase the
** amount of output without actually testing anything useful.
*/
static int block_debug_pragmas(
void *Notused,
int eCode,
const char *zArg1,
const char *zArg2,
const char *zArg3,
const char *zArg4
){
if( eCode==SQLITE_PRAGMA
&& (sqlite3_strnicmp("vdbe_", zArg1, 5)==0
|| sqlite3_stricmp("parser_trace", zArg1)==0)
){
return SQLITE_DENY;
}
return SQLITE_OK;
}
/*
** Callback for sqlite3_exec().
*/
static int exec_handler(void *pCnt, int argc, char **argv, char **namev){
int i;
if( argv ){
for(i=0; i<argc; i++) sqlite3_free(sqlite3_mprintf("%s", argv[i]));
}
return ((*(int*)pCnt)--)<=0;
}
/*
** Main entry point. The fuzzer invokes this function with each
** fuzzed input.
*/
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
int execCnt = 0; /* Abort row callback when count reaches zero */
char *zErrMsg = 0; /* Error message returned by sqlite_exec() */
uint8_t uSelector; /* First byte of input data[] */
int rc; /* Return code from various interfaces */
char *zSql; /* Zero-terminated copy of data[] */
FuzzCtx cx; /* Fuzzing context */
memset(&cx, 0, sizeof(cx));
if( size<3 ) return 0; /* Early out if unsufficient data */
/* Extract the selector byte from the beginning of the input. But only
** do this if the second byte is a \n. If the second byte is not \n,
** then use a default selector */
if( data[1]=='\n' ){
uSelector = data[0]; data += 2; size -= 2;
}else{
uSelector = 0xfd;
}
/* Open the database connection. Only use an in-memory database. */
rc = sqlite3_open_v2("fuzz.db", &cx.db,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY, 0);
if( rc ) return 0;
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
/* Invoke the progress handler frequently to check to see if we
** are taking too long. The progress handler will return true
** (which will block further processing) if more than 10 seconds have
** elapsed since the start of the test.
*/
cx.iLastCb = timeOfDay();
cx.iCutoffTime = cx.iLastCb + 10000; /* Now + 10 seconds */
sqlite3_progress_handler(cx.db, 10, progress_handler, (void*)&cx);
#endif
/* Set a limit on the maximum size of a prepared statement */
sqlite3_limit(cx.db, SQLITE_LIMIT_VDBE_OP, 25000);
/* Bit 1 of the selector enables foreign key constraints */
sqlite3_db_config(cx.db, SQLITE_DBCONFIG_ENABLE_FKEY, uSelector&1, &rc);
uSelector >>= 1;
/* Do not allow debugging pragma statements that might cause excess output */
sqlite3_set_authorizer(cx.db, block_debug_pragmas, 0);
/* Remaining bits of the selector determine a limit on the number of
** output rows */
execCnt = uSelector + 1;
/* Run the SQL. The sqlite_exec() interface expects a zero-terminated
** string, so make a copy. */
zSql = sqlite3_mprintf("%.*s", (int)size, data);
sqlite3_exec(cx.db, zSql, exec_handler, (void*)&execCnt, &zErrMsg);
/* Show any errors */
if( (mDebug & FUZZ_SHOW_ERRORS)!=0 && zErrMsg ){
printf("Error: %s\n", zErrMsg);
}
/* Cleanup and return */
sqlite3_free(zErrMsg);
sqlite3_free(zSql);
sqlite3_exec(cx.db, "PRAGMA temp_store_directory=''", 0, 0, 0);
sqlite3_close(cx.db);
if( mDebug & FUZZ_SHOW_MAX_DELAY ){
printf("Progress callback count....... %d\n", cx.nCb);
printf("Max time between callbacks.... %d ms\n", (int)cx.mxInterval);
}
return 0;
}
|
the_stack_data/56499.c | // File name: ExtremeC_examples_chapter19_1_funcs.c
// Description: Contains two functions **max** and **max_3**.
int max(int a, int b) {
return a > b ? a : b;
}
int max_3(int a, int b, int c) {
int temp = max(a, b);
return c > temp ? c : temp;
}
|
the_stack_data/651623.c | /**
* _memcpy - copy memory
* @dest: pointer to destiny
* @src: source string
* @n: n bytes
* Return: pointer to dest
*/
char *_memcpy(char *dest, char *src, unsigned int n)
{
unsigned int i = 0;
while (i != n)
{
dest[i] = src[i];
i++;
}
return (dest);
}
|
the_stack_data/206392757.c | /*
ITS240-01
Lab 09
Ch10p523pe3
04/06/2017
Daniel Kuckuck
Create a function named setHolidays() that reads and displays the current list of holidays and then lets the user change, add, or delete holidays from the list. After a holiday has been modified, the function should sort the holidays and display a new list. Finally, the function should ask the user whether the new list should be saved; if the user responds affirmatively, the function should write the new data to the existing Holidays.txt file, overwriting the contents of the existing file.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 81
int holidays[SIZE]; /*global holiday array */
int main()
{
void setHolidays();
//int count = 0;
setHolidays();
/* this needs to be in the other function:
printf("\nThe holidays listed in our file are: \n");
for (int i = 0; i < count; ++i)
{
printf("%d\n", holidays[i]);
} */
return 0;
}
void setHolidays()
{
int mo, day, yr, j = 0;
char del1, del2, edit = 'e';
FILE *wrkFile;
wrkFile = fopen("Holidays.txt", "r");
if (wrkFile == NULL)
{
printf("\nFailed to open the file.\n");
exit(1);
}
while (edit == 'e')
{
while (fscanf(wrkFile, "%d%c%d%c%d", &mo, &del1, &day, &del2, &yr) != EOF)
holidays[j++] = yr * 10000 + mo * 100 + day;
printf("\nThis is what we currently have in our file:\n");
fclose(wrkFile);
for (int i = 0; i < j ; ++i)
{
printf("%d\n", holidays[i]);
}
printf("\nWould you like to continue (e)diting or (s)ave or close\n");
edit = getchar();
if (edit == 's')
{
wrkFile = fopen("Holidays.txt", "w");
for (int i = 0; i < j; ++i)
{
sprint(holidays[i], "%4d%2d%2d", yr, mo, day);
fprintf(wrkFile, "%d/%d/%d", mo, day, yr);
}
}
}
// return j;
} |
the_stack_data/23573959.c | #include <stdio.h>
const int globalConstInt = 0x414243;
int globalInt = 0xAB;
char *globalChar = "global variable";
static void example()
{
char *local = "local variable";
printf("Hello World\n");
printf("HELLO WORLD\n");
printf("local : %s\n", local);
printf("global : %s\n", globalChar);
printf("global const int : %d\n", globalConstInt);
globalInt = 0xCD;
printf("global const int : %d\n", globalInt);
printf("%s %s:%d\n", __FILE__, __FUNCTION__, __LINE__);
}
int main()
{
example();
return 0;
}
|
the_stack_data/70057.c | /* This testcase is part of GDB, the GNU debugger.
Copyright 2015-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <pthread.h>
pthread_t child_thread[2];
void *
thread_function2 (void *arg)
{
while (1)
sleep (1);
return NULL;
}
void *
thread_function1 (void *arg)
{
pthread_create (&child_thread[1], NULL, thread_function2, NULL);
while (1)
sleep (1);
return NULL;
}
int
main (void)
{
int i;
alarm (300);
pthread_create (&child_thread[0], NULL, thread_function1, NULL);
for (i = 0; i < 2; i++)
pthread_join (child_thread[i], NULL);
return 0;
}
|
the_stack_data/57711.c | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
int
main(void)
{
if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1 )
printf("cannot seek\n");
else
printf("seek OK\n");
fprintf(stderr, "%s\n", strerror(errno));
return 0;
}
|
the_stack_data/91699.c |
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/termios.h>
enum
{
OP_BR = 0,
OP_ADD,
OP_LD,
OP_ST,
OP_JSR,
OP_AND,
OP_LDR,
OP_STR,
OP_RTI,
OP_NOT,
OP_LDI,
OP_STI,
OP_JMP,
OP_RES,
OP_LEA,
OP_TRAP
};
enum
{
TRAP_GETC = 0x20,
TRAP_OUT = 0x21,
TRAP_PUTS = 0x22,
TRAP_IN = 0x23,
TRAP_PUTSP = 0x24,
TRAP_HALT = 0x25
};
enum
{
FL_POS = 1 << 0,
FL_ZRO = 1 << 1,
FL_NEG = 1 << 2,
};
enum
{
R_R0 = 0,
R_R1,
R_R2,
R_R3,
R_R4,
R_R5,
R_R6,
R_R7,
R_PC,
R_COND,
R_COUNT
};
enum
{
MR_KBSR = 0xFE00,
MR_KBDR = 0xFE02
};
uint16_t memory[UINT16_MAX];
uint16_t reg[R_COUNT];
uint16_t swap16(uint16_t x)
{
return (x << 8) | (x >> 8);
}
void update_flags(uint16_t r)
{
if (reg[r] == 0)
{
reg[R_COND] = FL_ZRO;
}
else if (reg[r] >> 15)
{
reg[R_COND] = FL_NEG;
}
else
{
reg[R_COND] = FL_POS;
}
}
uint16_t sign_extend(uint16_t x, int bit_count)
{
if ((x >> (bit_count - 1)) & 1) {
x |= (0xFFFF << bit_count);
}
return x;
}
void read_image_file(FILE* file)
{
uint16_t origin;
fread(&origin, sizeof(origin), 1, file);
origin = swap16(origin);
uint16_t max_read = UINT16_MAX - origin;
uint16_t* p = memory + origin;
size_t read = fread(p, sizeof(uint16_t), max_read, file);
while (read-- > 0)
{
*p = swap16(*p);
++p;
}
}
int read_image(const char* image_path)
{
FILE* file = fopen(image_path, "rb");
if (!file) { return 0; };
read_image_file(file);
fclose(file);
return 1;
}
uint16_t check_key()
{
fd_set readfds;
FD_ZERO(&readfds);
FD_SET(STDIN_FILENO, &readfds);
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
return select(1, &readfds, NULL, NULL, &timeout) != 0;
}
void mem_write(uint16_t address, uint16_t val)
{
memory[address] = val;
}
uint16_t mem_read(uint16_t address)
{
if (address == MR_KBSR)
{
if (check_key())
{
memory[MR_KBSR] = (1 << 15);
memory[MR_KBDR] = getchar();
}
else
{
memory[MR_KBSR] = 0;
}
}
return memory[address];
}
struct termios original_tio;
void disable_input_buffering()
{
tcgetattr(STDIN_FILENO, &original_tio);
struct termios new_tio = original_tio;
new_tio.c_lflag &= ~ICANON & ~ECHO;
tcsetattr(STDIN_FILENO, TCSANOW, &new_tio);
}
void restore_input_buffering()
{
tcsetattr(STDIN_FILENO, TCSANOW, &original_tio);
}
void handle_interrupt(int signal)
{
restore_input_buffering();
printf("\n");
exit(-2);
}
int main(int argc, const char* argv[])
{
if (argc < 2)
{
printf("lc3 [image-file1] ...\n");
exit(2);
}
for (int j = 1; j < argc; ++j)
{
if (!read_image(argv[j]))
{
printf("failed to load image: %s\n", argv[j]);
exit(1);
}
}
signal(SIGINT, handle_interrupt);
disable_input_buffering();
enum { PC_START = 0x3000 };
reg[R_PC] = PC_START;
int running = 1;
while (running)
{
uint16_t instr = mem_read(reg[R_PC]++);
uint16_t op = instr >> 12;
switch (op)
{
case OP_ADD:
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t r1 = (instr >> 6) & 0x7;
uint16_t imm_flag = (instr >> 5) & 0x1;
if (imm_flag)
{
uint16_t imm5 = sign_extend(instr & 0x1F, 5);
reg[r0] = reg[r1] + imm5;
}
else
{
uint16_t r2 = instr & 0x7;
reg[r0] = reg[r1] + reg[r2];
}
update_flags(r0);
}
break;
case OP_AND:
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t r1 = (instr >> 6) & 0x7;
uint16_t imm_flag = (instr >> 5) & 0x1;
if (imm_flag)
{
uint16_t imm5 = sign_extend(instr & 0x1F, 5);
reg[r0] = reg[r1] & imm5;
}
else
{
uint16_t r2 = instr & 0x7;
reg[r0] = reg[r1] & reg[r2];
}
update_flags(r0);
}
break;
case OP_NOT:
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t r1 = (instr >> 6) & 0x7;
reg[r0] = ~reg[r1];
update_flags(r0);
}
break;
case OP_BR:
{
uint16_t pc_offset = sign_extend((instr) & 0x1ff, 9);
uint16_t cond_flag = (instr >> 9) & 0x7;
if (cond_flag & reg[R_COND])
{
reg[R_PC] += pc_offset;
}
}
break;
case OP_JMP:
{
uint16_t r1 = (instr >> 6) & 0x7;
reg[R_PC] = reg[r1];
}
break;
case OP_JSR:
{
uint16_t r1 = (instr >> 6) & 0x7;
uint16_t long_pc_offset = sign_extend(instr & 0x7ff, 11);
uint16_t long_flag = (instr >> 11) & 1;
reg[R_R7] = reg[R_PC];
if (long_flag)
{
reg[R_PC] += long_pc_offset;
}
else
{
reg[R_PC] = reg[r1];
}
break;
}
break;
case OP_LD:
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t pc_offset = sign_extend(instr & 0x1ff, 9);
reg[r0] = mem_read(reg[R_PC] + pc_offset);
update_flags(r0);
}
break;
case OP_LDI:
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t pc_offset = sign_extend(instr & 0x1ff, 9);
reg[r0] = mem_read(mem_read(reg[R_PC] + pc_offset));
update_flags(r0);
}
break;
case OP_LDR:
/* LDR */
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t r1 = (instr >> 6) & 0x7;
uint16_t offset = sign_extend(instr & 0x3F, 6);
reg[r0] = mem_read(reg[r1] + offset);
update_flags(r0);
}
break;
case OP_LEA:
/* LEA */
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t pc_offset = sign_extend(instr & 0x1ff, 9);
reg[r0] = reg[R_PC] + pc_offset;
update_flags(r0);
}
break;
case OP_ST:
/* ST */
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t pc_offset = sign_extend(instr & 0x1ff, 9);
mem_write(reg[R_PC] + pc_offset, reg[r0]);
}
break;
case OP_STI:
/* STI */
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t pc_offset = sign_extend(instr & 0x1ff, 9);
mem_write(mem_read(reg[R_PC] + pc_offset), reg[r0]);
}
break;
case OP_STR:
/* STR */
{
uint16_t r0 = (instr >> 9) & 0x7;
uint16_t r1 = (instr >> 6) & 0x7;
uint16_t offset = sign_extend(instr & 0x3F, 6);
mem_write(reg[r1] + offset, reg[r0]);
}
break;
case OP_TRAP:
switch (instr & 0xFF)
{
case TRAP_GETC:
reg[R_R0] = (uint16_t)getchar();
break;
case TRAP_OUT:
putc((char)reg[R_R0], stdout);
fflush(stdout);
break;
case TRAP_PUTS:
{
uint16_t* c = memory + reg[R_R0];
while (*c)
{
putc((char)*c, stdout);
++c;
}
fflush(stdout);
}
break;
case TRAP_IN:
printf("Enter a character: ");
char c = getchar();
putc(c, stdout);
reg[R_R0] = (uint16_t)c;
break;
case TRAP_PUTSP:
{
uint16_t* c = memory + reg[R_R0];
while (*c)
{
char char1 = (*c) & 0xFF;
putc(char1, stdout);
char char2 = (*c) >> 8;
if (char2) putc(char2, stdout);
++c;
}
fflush(stdout);
}
break;
case TRAP_HALT:
puts("HALT");
fflush(stdout);
running = 0;
break;
}
break;
case OP_RES:
case OP_RTI:
default:
abort();
break;
}
}
restore_input_buffering();
}
|
the_stack_data/121.c | /*
Given a number , check whether the number is power of 2 or not.
We can check this by doing some bitwise operation.
Bitwise operations are best because they perform the operation in least possible time.
*/
#include <stdio.h>
#include <math.h>
// this number_is_power_of_2 will tell us whether a number is power of 2
int number_is_power_of_2(int number)
{
/* if bitwise and of number and number - 1 is zero
then we can say that number is power of 2
otherwise it is not.
*/
if((number & (number - 1)) == 0)
{
return 1;
}
return 0;
}
int main()
{
printf("Enter the number \n");
int number;
scanf("%d", &number);
int solve = number_is_power_of_2(number);
if(solve)
{
printf("The Number is power of 2\n");
}
else
{
printf("No. the number is not power of 2\n");
}
}
/*
Standard Input and Output
Enter the number
64
The Number is power of 2
Enter the number
34
No. the number is not power of 2
Time Complexity : O(1)
Space Complexity : O(1)
*/
|
the_stack_data/200141835.c | ///////////////////////////////////////////////////////////////////////////////
//
// The MIT License
//
// Copyright 2021 0xAA55
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
///////////////////////////////////////////////////////////////////////////////
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <ctype.h>
#include <time.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#define EXEC_NAME "mcrcond"
#define LOCK_FILE "/tmp/mcrcond.lock" // PID file name
#define LOG_FILE "mcrcond.log" // log file name
#define CFG_FILE "mcrcond.conf" // configure file name
#define DEFAULT_DAEMON_HOST "localhost"
#define DEFAULT_DAEMON_PORT 25585
#define DEFAULT_DAEMON_BACKLOG 256
#define RCON_HEADER_SIZE 12
#define MAX_RCON_REQUEST 1500
#define MAX_RCON_RESPONSE_WAIT 3
#define MAX_RCON_RESPONSE_PAYLOAD 4096
#define MAX_RCON_RESPONSE (MAX_RCON_RESPONSE_PAYLOAD + RCON_HEADER_SIZE)
#define CLIENT_BUFFER_SIZE 4096
#define SOCKET_BUFFER_SIZE 8192
#define MAX_SERVER_WAIT_INTERVAL (5 * 60)
static int signal_exit_catch = 0;
static void signal_handler(int sig)
{
switch(sig)
{
case SIGINT:
case SIGTERM:
signal_exit_catch = 1;
break;
}
}
// The client's structure, managed by the daemon
typedef struct daemon_client_struct
{
int socket_client;
int request_id;
// The client sends the command to execute.
// Max command length should be limited under 1.5 kb
// The client sends the length of the command first, then the command.
// After the whole command received, the daemon pack up the whole thing and send it to rcon, wait for the response.
char buffer[CLIENT_BUFFER_SIZE];
size_t buffer_received;
size_t buffer_to_receive;
int buffer_sent;
// The rcon server returns a response, with it's response packet size specified.
// However, the server may send multiple response packets.
// The packets are the fragmentation of the output of the command.
// If a packet size is exactly 4 kb, then it's possible to be fragmented, and it's necessary to poke the server with some invalid packets.
char response[MAX_RCON_RESPONSE];
size_t response_size;
int response_received;
int response_sent;
time_t response_time;
}daemon_client_t, *daemon_client_p;
// The daemon's structure
typedef struct daemon_inst_struct
{
// Parsed configurations
char conf_rcon_host[256];
int conf_rcon_port;
char conf_rcon_auth[64];
char conf_daemon_listen[256];
int conf_daemon_port;
int conf_daemon_backlog;
int conf_log_rcon;
int conf_debug;
int conf_response_newline;
FILE* fp_log;
int daemonized;
int socket_to_rcon;
int socket_listen;
int cur_request_id;
size_t client_count;
daemon_client_p clients;
}daemon_inst_t, *daemon_inst_p;
// The RCON protocol packet header
typedef struct rcon_packet_struct
{
int length;
int request_id;
int type;
char payload[0];
}rcon_packet_t, *rcon_packet_p;
static int socket_reuse_addr_port(int sfd)
{
int value = 1;
return
(setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &value, sizeof value) >= 0) &
(setsockopt(sfd, SOL_SOCKET, SO_REUSEPORT, &value, sizeof value) >= 0);
}
static void di_logtime(daemon_inst_p di, FILE *stream)
{
time_t t;
struct tm *tmp;
char szTime[128];
t = time(NULL);
tmp = localtime(&t);
if (tmp) strftime(szTime, sizeof szTime, "%H:%M:%S", tmp);
fprintf(stream, "[%s]: ", tmp ? szTime : strerror(errno));
}
void di_printf(daemon_inst_p di, const char *format, ...)
{
va_list ap;
va_start(ap, format);
di_logtime(di, di->fp_log);
vfprintf(di->fp_log, format, ap);
fflush(di->fp_log);
va_end(ap);
if (!di->daemonized)
{
va_start(ap, format);
di_logtime(di, stdout);
vprintf(format, ap);
va_end(ap);
}
}
// Delete the daemon instance
void di_delete(daemon_inst_p di)
{
if(!di) return;
if(di->socket_to_rcon != -1) close(di->socket_to_rcon);
if(di->socket_listen != -1) close(di->socket_listen);
if(di->clients)
{
size_t i;
for (i = 0; i < di->client_count; i++)
{
if(di->clients[i].socket_client != -1)
{
close(di->clients[i].socket_client);
}
}
free(di->clients);
}
if(di->fp_log)
{
di_printf(di, "[TERM] The daemon '"EXEC_NAME"' has been terminated.\n");
fclose(di->fp_log);
}
free(di);
}
// Create the daemon instance
daemon_inst_p di_create(char* log_filepath)
{
daemon_inst_p di = NULL;
if (!log_filepath) return di;
di = malloc(sizeof *di);
if (!di) return di;
memset(di, 0, sizeof *di);
di->socket_to_rcon = -1;
di->socket_listen = -1;
strcpy(di->conf_rcon_host, "localhost");
di->conf_rcon_port = 25575;
strcpy(di->conf_rcon_auth, "EX");
strcpy(di->conf_daemon_listen, "localhost");
di->conf_daemon_port = DEFAULT_DAEMON_PORT;
di->conf_daemon_backlog = DEFAULT_DAEMON_BACKLOG;
di->conf_log_rcon = 0;
di->fp_log = fopen(log_filepath, "a");
if(!di->fp_log)
{
// fprintf(stderr, "Open log file '%s' failed: %s.\n", log_filepath, strerror(errno));
goto FailExit;
}
di_printf(di, "[INIT] Starting daemon '"EXEC_NAME"'.\n");
return di;
FailExit:
di_delete(di);
return NULL;
}
// The default configure file generation
int di_write_default_cfg_file(daemon_inst_p di, char *cfg_filepath)
{
FILE *fp = fopen(cfg_filepath, "w");
if(!fp)
{
di_printf(di, "[FAIL] Writing default configure file '%s' failed: %s.\n", cfg_filepath, strerror(errno));
return 0;
}
di_printf(di, "[FAIL] Generating the default configure file to '%s'.\n", cfg_filepath);
di_printf(di, "[INFO] Please check the generated configure file and restart the daemon.\n");
fprintf(fp, "# The minecraft server RCON address, port, password\n");
fprintf(fp, "rcon-host=%s\n", di->conf_rcon_host);
fprintf(fp, "rcon-port=%d\n", di->conf_rcon_port);
fprintf(fp, "rcon-auth=%s\n", di->conf_rcon_auth);
fprintf(fp, "\n");
fprintf(fp, "# From what addresses can connect the daemon\n");
fprintf(fp, "daemon-listen=%s\n", di->conf_daemon_listen);
fprintf(fp, "\n");
fprintf(fp, "# The port of the daemon\n");
fprintf(fp, "daemon-port=%d\n", di->conf_daemon_port);
fprintf(fp, "\n");
fprintf(fp, "# How many connections to the daemon at the same time\n");
fprintf(fp, "daemon-backlog=%d\n", di->conf_daemon_backlog);
fprintf(fp, "\n");
fprintf(fp, "# Uncomment next line to log all RCON activities\n");
fprintf(fp, "#log-rcon=1\n");
fprintf(fp, "\n");
fprintf(fp, "# Uncomment next line to add a newline ending to responses\n");
fprintf(fp, "#response-add-newline=1\n");
fprintf(fp, "\n");
fclose(fp);
return 1;
}
// Parse existing configure file
int di_parse_cfg_file(daemon_inst_p di, char *cfg_filepath)
{
FILE *fp = fopen(cfg_filepath, "r");
if(!fp)
{
if(errno == ENOENT)
{
di_printf(di, "[FAIL] Configure file '%s' not found.\n", cfg_filepath);
di_write_default_cfg_file(di, cfg_filepath);
return 0;
}
else
{
di_printf(di, "[FAIL] Open configure file '%s' failed: %s.\n", cfg_filepath, strerror(errno));
return 0;
}
}
else
{
int line_no = 0;
int failure = 0;
char line_buf[512];
const char token_delims[] = " =\r\n";
do
{
char *ch;
// Read the configure file line by line, and use 'ch' to parse each line.
ch = fgets(line_buf, sizeof line_buf, fp); line_no++;
if(!ch && !feof(fp))
{
failure = 1;
break;
}
// Remove the comments
ch = strchr(line_buf, '#');
if (ch) *ch = '\0';
// Ignore the leading space
ch = line_buf;
while(isspace(*ch)) ch++;
// Ignore empty line
if (*ch == '\r' ||*ch == '\n' || *ch == '\0') continue;
// Remove the spaces of the line
memmove(line_buf, ch, strlen(ch) + 1);
// Parse the line
ch = strtok(line_buf, token_delims);
if (!ch)
{
failure = 2;
break;
}
if (!strcmp(ch, "rcon-host"))
{
ch = strtok(NULL, token_delims);
if(!ch || sscanf(ch, "%s", &di->conf_rcon_host[0]) != 1)
{
failure = 2;
break;
}
}
else if(!strcmp(ch, "rcon-port"))
{
ch = strtok(NULL, token_delims);
if(!ch || sscanf(ch, "%d", &di->conf_rcon_port) != 1)
{
failure = 2;
break;
}
}
else if(!strcmp(ch, "rcon-auth"))
{
ch = strtok(NULL, token_delims);
if(!ch || sscanf(ch, "%s", &di->conf_rcon_auth[0]) != 1)
{
failure = 2;
break;
}
}
else if(!strcmp(ch, "daemon-listen"))
{
ch = strtok(NULL, token_delims);
if(!ch || sscanf(ch, "%s", &di->conf_daemon_listen[0]) != 1)
{
failure = 2;
break;
}
}
else if(!strcmp(ch, "daemon-port"))
{
ch = strtok(NULL, token_delims);
if(!ch || sscanf(ch, "%d", &di->conf_daemon_port) != 1)
{
failure = 2;
break;
}
}
else if(!strcmp(ch, "daemon-backlog"))
{
ch = strtok(NULL, token_delims);
if(!ch || sscanf(ch, "%d", &di->conf_daemon_backlog) != 1)
{
failure = 2;
break;
}
}
else if(!strcmp(ch, "log-rcon"))
{
ch = strtok(NULL, token_delims);
if(!ch || sscanf(ch, "%d", &di->conf_log_rcon) != 1)
{
failure = 2;
break;
}
}
else if(!strcmp(ch, "debug"))
{
ch = strtok(NULL, token_delims);
if(!ch || sscanf(ch, "%d", &di->conf_debug) != 1)
{
failure = 2;
break;
}
}
else if(!strcmp(ch, "response-add-newline"))
{
ch = strtok(NULL, token_delims);
if(!ch || sscanf(ch, "%d", &di->conf_response_newline) != 1)
{
failure = 2;
break;
}
}
else
{
failure = 2;
break;
}
}while(!feof(fp));
fclose(fp);
switch(failure)
{
case 0:
return 1;
case 1:
di_printf(di, "[FAIL] Error occurs while parsing configure file '%s' at line %d:\n", cfg_filepath, line_no);
di_printf(di, "[FAIL] \t%s.\n", strerror(errno));
return 0;
case 2:
di_printf(di, "[FAIL] Error occurs while parsing configure file '%s' at line %d:\n", cfg_filepath, line_no);
di_printf(di, "[FAIL] Unknown '%s'.\n", line_buf);
return 0;
default:
di_printf(di, "[FAIL] Error occurs while parsing configure file '%s' at line %d:\n", cfg_filepath, line_no);
di_printf(di, "[FAIL] Unknown '%s' because of unknown 'failure' %d.\n", line_buf, failure);
return 0;
}
}
}
// Check if 'struct sockaddr' is an IPv4 address
static int is_v4_addr(struct sockaddr *addr, socklen_t addr_len)
{
return (addr->sa_family == AF_INET && addr_len == sizeof(struct sockaddr_in));
}
static void di_reset_listener_socket(daemon_inst_p di)
{
if(di->socket_listen != -1)
{
close(di->socket_listen);
di->socket_listen = -1;
}
di->client_count = 0;
if(di->clients)
{
size_t i;
for (i = 0; i < di->client_count; i++)
{
if(di->clients[i].socket_client != -1)
{
close(di->clients[i].socket_client);
}
}
free(di->clients);
di->clients = NULL;
}
}
// Create the socket for listening from the clients
static int di_init_listener_socket(daemon_inst_p di)
{
struct addrinfo hints;
struct addrinfo *result = NULL, *rp;
int s, sfd = -1;
char port_buf[8];
size_t i;
di_reset_listener_socket(di);
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC; // IPv4 or IPv6
hints.ai_socktype = SOCK_STREAM; // Stream socket
hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE; // Numeric port and wildcard IP address
hints.ai_protocol = IPPROTO_TCP; // Only TCP
hints.ai_canonname = NULL;
hints.ai_addr = NULL;
hints.ai_next = NULL;
sprintf(port_buf, "%d", di->conf_daemon_port);
s = getaddrinfo(di->conf_daemon_listen, port_buf, &hints, &result);
if (s)
{
di_printf(di, "[FAIL] Listen address '%s:%s' not resolvable: %s\n", di->conf_daemon_listen, port_buf, gai_strerror(s));
goto FailExit;
}
for(rp = result; rp; rp = rp->ai_next)
{
sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (sfd == -1) continue;
if (!socket_reuse_addr_port(sfd))
{
di_printf(di, "[WARN] Trying to enable reuse of address and port failed: %s.\n", strerror(s));
}
if (is_v4_addr(rp->ai_addr, rp->ai_addrlen))
{
struct sockaddr_in *v4_addr = (struct sockaddr_in*)rp->ai_addr;
di_printf(di, "[INFO] Binding to resolved address '%s:%d'\n",
inet_ntoa(v4_addr->sin_addr),
ntohs(v4_addr->sin_port));
}
if (bind(sfd, rp->ai_addr, rp->ai_addrlen) == 0)
{
di_printf(di, "[INFO] Bind to address '%s:%s' successful\n", di->conf_daemon_listen, port_buf);
break;
}
else if (is_v4_addr(rp->ai_addr, rp->ai_addrlen))
{
struct sockaddr_in *v4_addr = (struct sockaddr_in*)rp->ai_addr;
di_printf(di, "[WARN] Bind to resolved address '%s:%d' failed.\n",
inet_ntoa(v4_addr->sin_addr),
ntohs(v4_addr->sin_port));
}
close(sfd);
}
if (!rp)
{
di_printf(di, "[FAIL] None of the resolved address from '%s:%s' cannot be bound.\n", di->conf_daemon_listen, port_buf);
goto FailExit;
}
freeaddrinfo(result); result = NULL;
di->socket_listen = sfd;
if(listen(di->socket_listen, di->conf_daemon_backlog) < 0)
{
di_printf(di, "[FAIL] Listen to address '%s:%s' with backlog %d failed: %s.\n",
di->conf_daemon_listen, port_buf, di->conf_daemon_backlog, strerror(errno));
goto FailExit;
}
else
{
di_printf(di, "[INFO] Listening to address '%s:%s' with backlog %d\n", di->conf_daemon_listen, port_buf, di->conf_daemon_backlog);
}
di->client_count = di->conf_daemon_backlog;
di->clients = malloc(di->client_count * sizeof di->clients[0]);
if (!di->clients)
{
di_printf(di, "[FAIL] Prepare for incoming %d connections failed: %s.\n",
(int)di->client_count, strerror(errno));
goto FailExit;
}
memset(di->clients, 0, di->client_count * sizeof di->clients[0]);
for(i = 0; i < di->client_count; i++)
{
di->clients[i].socket_client = -1;
}
return 1;
FailExit:
di_reset_listener_socket(di);
if(result) freeaddrinfo(result);
return 0;
}
// Create the socket for listening from the clients
static int di_init_rcon_socket(daemon_inst_p di)
{
struct addrinfo hints;
struct addrinfo *result = NULL, *rp;
int s, sfd = -1;
char port_buf[8];
if(di->socket_to_rcon != -1)
{
close(di->socket_to_rcon);
di->socket_to_rcon = -1;
}
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC; // IPv4 or IPv6
hints.ai_socktype = SOCK_STREAM; // Stream socket
hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE; // Numeric port and wildcard IP address
hints.ai_protocol = IPPROTO_TCP; // Only TCP
hints.ai_canonname = NULL;
hints.ai_addr = NULL;
hints.ai_next = NULL;
sprintf(port_buf, "%d", di->conf_rcon_port);
s = getaddrinfo(di->conf_rcon_host, port_buf, &hints, &result);
if (s)
{
di_printf(di, "[FAIL] RCON address '%s:%s' not resolvable: %s\n", di->conf_rcon_host, port_buf, gai_strerror(s));
goto FailExit;
}
for(rp = result; rp; rp = rp->ai_next)
{
sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (sfd == -1) continue;
if (connect(sfd, rp->ai_addr, rp->ai_addrlen) == 0) break;
close(sfd);
}
if (!rp)
{
di_printf(di, "[FAIL] Connect to RCON host '%s:%s' failed\n", di->conf_rcon_host, port_buf);
goto FailExit;
}
freeaddrinfo(result); result = NULL;
di->socket_to_rcon = sfd;
return 1;
FailExit:
if(di->socket_to_rcon != -1)
{
close(di->socket_to_rcon);
di->socket_to_rcon = -1;
}
if(result) freeaddrinfo(result);
return 0;
}
static int di_send_rcon_packet(daemon_inst_p di, int request_id, int type, void *packet, size_t size, size_t *ret_send_len)
{
size_t send_len = RCON_HEADER_SIZE + size + 1;
char send_buf[SOCKET_BUFFER_SIZE];
rcon_packet_p packsend = (rcon_packet_p)&send_buf;
packsend->length = send_len - 4;
packsend->request_id = request_id;
packsend->type = type;
memcpy(packsend->payload, packet, size);
packsend->payload[size] = '\0';
*ret_send_len = send_len;
if (di->conf_log_rcon) di_printf(di, "[RCON] %s\n", packet);
return send(di->socket_to_rcon, send_buf, send_len, 0);
}
static int di_new_request_id(daemon_inst_p di)
{
size_t i;
di->cur_request_id ++;
for(;;)
{
int req_id_inuse = 0;
for(i = 0; i < di->client_count; i++)
{
daemon_client_p c = &di->clients[i];
if (c->socket_client == -1) continue;
if (c->request_id == di->cur_request_id)
{
di->cur_request_id ++;
req_id_inuse = 1;
break;
}
}
if (!req_id_inuse) return di->cur_request_id;
}
}
// Start authentication to the RCON server
static int di_rcon_auth(daemon_inst_p di)
{
char recv_buf[MAX_RCON_RESPONSE];
int nrecv;
rcon_packet_p packrecv = (rcon_packet_p)&recv_buf;
size_t send_len;
int req_id = di_new_request_id(di);
if(di_send_rcon_packet(di, req_id, 3, di->conf_rcon_auth, strlen(di->conf_rcon_auth), &send_len) != send_len)
{
di_printf(di, "[FAIL] Authentication to RCON host '%s:%d' by password '%s' failed: send()\n", di->conf_rcon_host, di->conf_rcon_port, di->conf_rcon_auth);
goto FailExit;
}
nrecv = recv(di->socket_to_rcon, recv_buf, sizeof recv_buf, 0);
if(!nrecv)
{
di_printf(di, "[FAIL] Authentication to RCON host '%s:%d' by password '%s' failed: Connection reset by the peer.\n", di->conf_rcon_host, di->conf_rcon_port, di->conf_rcon_auth);
goto FailExit;
}
if(nrecv < 0)
{
di_printf(di, "[FAIL] Authentication to RCON host '%s:%d' by password '%s' failed: %s\n", di->conf_rcon_host, di->conf_rcon_port, di->conf_rcon_auth, strerror(errno));
goto FailExit;
}
if(packrecv->request_id == req_id)
{
di_printf(di, "[AUTH] Authentication to RCON host '%s:%d' by password '%s' succeeded.\n", di->conf_rcon_host, di->conf_rcon_port, di->conf_rcon_auth);
}
else
{
di_printf(di, "[FAIL] Authentication to RCON host '%s:%d' by password '%s' failed: Wrong password\n", di->conf_rcon_host, di->conf_rcon_port, di->conf_rcon_auth);
goto FailExit;
}
return 1;
FailExit:
return 0;
}
// Run the daemon
int di_run(daemon_inst_p di)
{
fd_set readfds;
fd_set writefds;
struct timeval timeout;
size_t i;
int retval;
char recv_buf[SOCKET_BUFFER_SIZE];
char response_buf[SOCKET_BUFFER_SIZE * 2];
rcon_packet_p packrecv = (rcon_packet_p)response_buf;
size_t cb_to_recv = 0;
size_t cb_recv = 0;
int wait_interval = 0;
di->cur_request_id = (int)time(NULL);
do // while (di->daemonized)
{
if(!di_init_rcon_socket(di))
{
if(di->daemonized && !signal_exit_catch)
{
int wait_value;
if (wait_interval < 1)
wait_interval = 1;
else if (wait_interval < MAX_SERVER_WAIT_INTERVAL)
wait_interval <<= 1;
else
wait_interval = MAX_SERVER_WAIT_INTERVAL;
wait_value = rand() % wait_interval;
if (wait_value < 1) wait_value = 1;
sleep(wait_value);
continue;
}
else
{
return 0;
}
}
if(!di_rcon_auth(di)) return 0;
if(!di_init_listener_socket(di)) return 0;
wait_interval = 1;
while(!signal_exit_catch)
{
int maxfd = 0;
int rcon_ready_to_send = 0;
FD_ZERO(&readfds);
FD_ZERO(&writefds);
timeout.tv_sec = 1;
timeout.tv_usec = 0;
// Add active client sockets to the select() file descriptors list
for(i = 0; i < di->client_count; i ++)
{
int sock = di->clients[i].socket_client;
if(sock != -1)
{
FD_SET(sock, &readfds);
FD_SET(sock, &writefds);
maxfd ++;
}
}
// Add the RCON server to the list
FD_SET(di->socket_to_rcon, &readfds);
FD_SET(di->socket_to_rcon, &writefds);
maxfd ++;
// Add the listener server to the list
if(maxfd < di->client_count)
{
FD_SET(di->socket_listen, &readfds);
maxfd ++;
}
// First, wait for any activity of the sockets.
retval = select(FD_SETSIZE, &readfds, &writefds, NULL, &timeout);
if(retval == -1)
{
di_printf(di, "[FAIL] select() failed: %s.\n", strerror(errno));
return 0;
}
// Receive responses from the RCON server
if (!cb_to_recv || cb_recv < cb_to_recv)
{
if (FD_ISSET(di->socket_to_rcon, &readfds))
{
retval = recv(di->socket_to_rcon, recv_buf, sizeof recv_buf, 0);
if (retval <= 0)
{
if (retval < 0)
{
di_printf(di, "[FAIL] Receive responses from the RCON server failed: %s.\n", strerror(errno));
}
else
{
// If too many of the requests had sent in a very short time, the server closes the connection.
di_printf(di, "[INFO] The RCON server closed the connection.\n");
}
goto OnRconReset;
}
if (retval + cb_recv > sizeof response_buf)
{
// This would hardly happen since 'response_buf' is twice big as 'recv_buf' and 'recv_buf' is 8kb and it's twice big as the maximum response payload size
di_printf(di, "[FAIL] The RCON server returned a packet with wrong size (%d) which was too big to fit the buffer.\n", (int)(retval + cb_recv));
goto OnRconReset;
}
memcpy(&response_buf[cb_recv], recv_buf, retval);
cb_recv += retval;
if (!cb_to_recv && cb_recv >= 4) cb_to_recv = packrecv->length + 4;
if (di->conf_debug) di_printf(di, "[DEBUG] RCON response received: packet size = %zu, received size = %zu\n", cb_to_recv, cb_recv);
}
}
// If a complete response had received, redirect it to the specific client
if(cb_to_recv && cb_recv >= cb_to_recv)
{
size_t cb_payload = cb_to_recv - RCON_HEADER_SIZE;
if (packrecv->type != 0)
{
di_printf(di, "[FAIL] The RCON server returned a packet with unknown type (%d).\n", packrecv->type);
goto OnRconReset;
}
// Redirect the packet to the client which have the same request id
for(i = 0; i < di->client_count; i++)
{
daemon_client_p c = &di->clients[i];
// Check if activity or not
if (c->socket_client == -1) continue;
// Check the request id
if (c->request_id != packrecv->request_id) continue;
// Check if it had redirected the response it already got
if (c->response_received && !c->response_sent) break;
memcpy(c->response, packrecv->payload, cb_payload);
c->response_received = 1;
c->response_sent = 0;
c->response_size = cb_payload;
if (di->conf_debug) di_printf(di, "[DEBUG] RCON response copied to %zu: %s\n", i, c->response);
break;
}
// Check if no client matches
if (i >= di->client_count)
{
if (di->conf_log_rcon) di_printf(di, "[RCON] (Not redirected to client) %s\n", packrecv->payload);
di_printf(di, "[INFO] The RCON server returned a packet with a request id (%d) which doesn't belongs to current clients.\n", packrecv->request_id);
}
cb_recv -= cb_to_recv;
if (cb_recv)
{
memmove(response_buf, &response_buf[cb_to_recv], cb_recv);
if (cb_recv >= 4)
{
cb_to_recv = packrecv->length + 4;
if (di->conf_debug) di_printf(di, "[DEBUG] Remaining %zu bytes of response with packet size %zu to redirect.\n", cb_recv, cb_to_recv);
}
else
{
cb_to_recv = 0;
if (di->conf_debug) di_printf(di, "[DEBUG] Remaining %zu bytes of response to redirect.\n", cb_recv);
}
}
else
{
cb_to_recv = 0;
}
}
if (FD_ISSET(di->socket_to_rcon, &writefds))
{
rcon_ready_to_send = 1;
}
for(i = 0; i < di->client_count; i++)
{
daemon_client_p c = &di->clients[i];
int sock = c->socket_client;
if (sock == -1) continue;
if (!c->buffer_to_receive || c->buffer_received < c->buffer_to_receive)
{
if (FD_ISSET(sock, &readfds))
{
retval = recv(sock, recv_buf, sizeof recv_buf, 0);
// Check if error occurs or the client closes the socket
if (retval <= 0)
{
if (retval < 0)
{
di_printf(di, "[WARN] Receive requests from client %zu failed: %s.\n", i, strerror(errno));
}
else
{
if (di->conf_debug) di_printf(di, "[DEBUG] The client %zu closed the connection.\n", i);
}
c->socket_client = -1;
close(sock);
continue;
}
// Copy the received data to the end of the buffer
if (c->buffer_received + retval <= sizeof c->buffer)
{
memcpy(&c->buffer[c->buffer_received], recv_buf, retval);
c->buffer_received += retval;
}
else
{
di_printf(di, "[WARN] The client %zu had sent too many data (%zu bytes) that could not fit the buffer (capacity of %zu bytes).\n",
i, c->buffer_received + retval, sizeof c->buffer);
c->socket_client = -1;
close(sock);
continue;
}
// The first 4 bytes is the length of client's packet length.
if(c->buffer_received >= 4)
{
uint32_t packet_size = *(uint32_t*)&c->buffer[0];
c->buffer_to_receive = packet_size + 4;
// Check the size, it shouldn't exceed MAX_RCON_REQUEST and shouldn't be zero
if (packet_size > MAX_RCON_REQUEST || !packet_size)
{
di_printf(di, "[WARN] Client %zu sent invalid size of request: '%zu' bytes\n",i , c->buffer_to_receive);
c->socket_client = -1;
close(sock);
continue;
}
if (di->conf_debug) di_printf(di, "[DEBUG] Receiving client request %zu of %zu bytes\n", c->buffer_received - 4, c->buffer_to_receive - 4);
}
}
}
// Send the request to RCON server if not sent
if (c->buffer_to_receive && c->buffer_received >= c->buffer_to_receive)
{
if (!c->buffer_sent)
{
if (rcon_ready_to_send)
{
size_t send_len;
retval = di_send_rcon_packet(di, c->request_id, 2, &c->buffer[4], c->buffer_received - 4, &send_len);
// Check if error occurs or the client closes the socket
if (retval <= 0)
{
if (retval < 0)
{
di_printf(di, "[FAIL] Send request to the RCON server failed: %s.\n", strerror(errno));
}
else
{
di_printf(di, "[INFO] The RCON server closed the connection.\n");
}
goto OnRconReset;
}
c->buffer_sent = 1;
if (di->conf_debug) di_printf(di, "[DEBUG] Position %zu, request sent\n", i);
}
}
else if (c->response_received)
{
if (!c->response_sent)
{
if (FD_ISSET(sock, &writefds))
{
// Send the response back to the client
if (di->conf_response_newline && c->response_size < sizeof c->response)
{
c->response[c->response_size++] = '\n';
}
retval = send(sock, c->response, c->response_size, 0);
// Check if error occurs or the client closes the socket
if (retval <= 0)
{
if (retval < 0)
{
di_printf(di, "[WARN] Sending response back to the client %zu failed: %s.\n", i, strerror(errno));
}
c->socket_client = -1;
close(sock);
continue;
}
if (di->conf_log_rcon) di_printf(di, "[RCON] %s\n", c->response);
if (c->response_size >= MAX_RCON_RESPONSE_PAYLOAD)
{
c->response_time = time(NULL);
c->response_sent = 1;
c->response_received = 0; // Process the fragmentation
if (di->conf_debug) di_printf(di, "[DEBUG] Waiting for further response of client %zu.\n", i);
}
else
{
c->socket_client = -1;
close(sock);
if (di->conf_debug) di_printf(di, "[DEBUG] Closed the connection to the client %zu.\n", i);
continue;
}
}
}
else
{
if (c->response_size < MAX_RCON_RESPONSE_PAYLOAD || time(NULL) - c->response_time >= MAX_RCON_RESPONSE_WAIT)
{
c->socket_client = -1;
close(sock);
if (di->conf_debug) di_printf(di, "[DEBUG] Closed the connection to the client %zu.\n", i);
continue;
}
}
}
}
}
// Process incoming connections
if (FD_ISSET(di->socket_listen, &readfds))
{
char addr_buf[256];
socklen_t addr_len = sizeof addr_buf;
for(i = 0; i < di->client_count; i++)
{
daemon_client_p c = &di->clients[i];
int sock = c->socket_client;
if (sock != -1) continue;
sock = accept(di->socket_listen, (struct sockaddr *)&addr_buf, &addr_len);
if (sock == -1)
{
di_printf(di, "[FAIL] Accept the incoming connection failed: %s.\n", strerror(errno));
}
else
{
if (di->conf_log_rcon)
{
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
if (getnameinfo((struct sockaddr *)&addr_buf, addr_len,
hbuf, sizeof(hbuf), sbuf, sizeof(sbuf),
NI_NUMERICHOST | NI_NUMERICSERV) == 0)
{
di_printf(di, "[INFO] Accepted connection from %s:%s as client %zu.\n", hbuf, sbuf, i);
}
else
{
di_printf(di, "[INFO] Accepted connection from unknown client as %zu.\n", i);
}
}
memset(&di->clients[i], 0, sizeof di->clients[i]);
c->socket_client = sock;
c->request_id = di_new_request_id(di);
}
break;
}
if (i >= di->client_count)
{
di_printf(di, "[WARN] No more room for the new connections from the clients.\n");
}
}
}
OnRconReset:;
}while(di->daemonized && !signal_exit_catch);
return 1;
}
// Move self to run in background
void daemonize()
{
// Process one to two
pid_t process_id = fork();
if (process_id < 0)
{
printf("fork failed!\n");
exit(1);
}
// Parent process suicide
if (process_id > 0)
{
exit(0);
}
// Child process go to background
umask(0);
if (setsid() < 0) exit(1);
fclose(stdin);
fclose(stdout);
fclose(stderr);
signal(SIGCHLD,SIG_IGN);
signal(SIGTSTP,SIG_IGN);
signal(SIGTTOU,SIG_IGN);
signal(SIGTTIN,SIG_IGN);
signal(SIGPIPE,SIG_IGN);
}
// The test code:
// Sometimes 'select()' function doesn't work as man7 says.
// The test shows that the first parameter 'nfds' should be FD_SETSIZE,
// instead of 'Max file descriptor number plus 1'.
// Tested in Linux, FreeBSD, WSL, mingw-w64 in msys2.
/*
static void test_code()
{
int sock_listen, retval, sock_accept;
struct sockaddr_in addr;
socklen_t addr_size = sizeof addr;
struct timeval tv;
fd_set readfds;
printf("RUNNING TEST CODE\n");
sock_listen = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
printf("%d\n", sock_listen);
memset(&addr, 0, sizeof addr);
addr.sin_family = AF_INET;
addr.sin_port = htons(25595);
addr.sin_addr.s_addr = inet_addr("127.0.0.1");
retval = bind(sock_listen, (struct sockaddr*)&addr, sizeof addr);
printf("%d\n", retval);
retval = listen(sock_listen, 256);
printf("%d\n", retval);
for(;;)
{
FD_ZERO(&readfds);
FD_SET(sock_listen, &readfds);
tv.tv_sec = 1;
tv.tv_usec = 0;
retval = select(FD_SETSIZE, &readfds, NULL, NULL, &tv);
printf("%d of %d\n", retval, FD_SETSIZE);
if (FD_ISSET(sock_listen, &readfds))
{
printf("FD_ISSET\n");
break;
}
}
sock_accept = accept(sock_listen, (struct sockaddr*)&addr, &addr_size);
if (sock_accept >= 0)
{
char buf[8192];
if (addr_size == sizeof addr && addr.sin_family == AF_INET)
{
printf("[%s:%d]\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
}
retval = recv(sock_accept, buf, sizeof buf, 0);
printf("%d %s\n", retval, buf);
sprintf(buf, "HTTP/1.1 200 OK\r\n\r\nawdnawvhasdlghvjaselgh\r\n");
retval = send(sock_accept, buf, strlen(buf), 0);
printf("%d\n", retval);
close(sock_accept);
}
close(sock_listen);
exit(0);
}
*/
// The whole program running as the daemon
void run_as_daemon(char *cfg_filepath, char *log_filepath, int do_daemonize)
{
daemon_inst_p di = NULL;
int exit_code = 0;
// test_code();
if(do_daemonize) daemonize();
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
di = di_create(log_filepath);
if(!di)
{
if(!do_daemonize) fprintf(stderr, "[FAIL] Creating daemon instance failed.\n");
exit_code = 2;
goto CleanupExit;
}
di->daemonized = do_daemonize;
if(!di_parse_cfg_file(di, cfg_filepath))
{
exit_code = 1;
goto CleanupExit;
}
if(!di_run(di))
{
exit_code = 1;
goto CleanupExit;
}
exit_code = 0;
CleanupExit:
di_delete(di);
exit(exit_code);
}
// The whole program running as the client of the daemon
void run_as_client(char *daemon_address, int daemon_port, char *exec_command)
{
struct addrinfo hints;
struct addrinfo *result = NULL, *rp;
int s, sfd = -1;
char port_buf[8];
char send_buf[SOCKET_BUFFER_SIZE];
char recv_buf[SOCKET_BUFFER_SIZE];
size_t command_len = strlen(exec_command);
int retval;
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC; // IPv4 or IPv6
hints.ai_socktype = SOCK_STREAM; // Stream socket
hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE; // Numeric port and wildcard IP address
hints.ai_protocol = IPPROTO_TCP; // Only TCP
hints.ai_canonname = NULL;
hints.ai_addr = NULL;
hints.ai_next = NULL;
sprintf(port_buf, "%d", daemon_port);
s = getaddrinfo(daemon_address, port_buf, &hints, &result);
if (s)
{
fprintf(stderr, "Daemon address '%s:%s' not resolvable: %s\n", daemon_address, port_buf, gai_strerror(s));
goto FailExit;
}
for(rp = result; rp; rp = rp->ai_next)
{
sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (sfd == -1) continue;
if (connect(sfd, rp->ai_addr, rp->ai_addrlen) == 0) break;
close(sfd);
}
if (!rp)
{
fprintf(stderr, "Connect to daemon host '%s:%s' failed\n", daemon_address, port_buf);
goto FailExit;
}
freeaddrinfo(result); result = NULL;
*(uint32_t*)&send_buf[0] = command_len;
memcpy(&send_buf[4], exec_command, command_len);
retval = send(sfd, send_buf, command_len + 4, 0);
if (retval < 0)
{
fprintf(stderr, "Send command to daemon host '%s:%s' failed: %s\n", daemon_address, port_buf, strerror(errno));
goto FailExit;
}
if (retval == 0)
{
fprintf(stderr, "Daemon host '%s:%s' had reset the connection\n", daemon_address, port_buf);
goto FailExit;
}
for(;;)
{
retval = recv(sfd, recv_buf, sizeof recv_buf, 0);
if (retval == 0)
{
break;
}
else if (retval < 0)
{
fprintf(stderr, "Receive response from host '%s:%s' failed: %s\n", daemon_address, port_buf, strerror(errno));
}
else
{
fwrite(recv_buf, 1, retval, stdout);
}
}
close(sfd);
exit(0);
FailExit:
if(sfd != -1)
{
close(sfd);
}
if(result) freeaddrinfo(result);
exit(1);
}
void show_help(char* argv0)
{
printf("Usage: %s [-e -h -p] or [-d|-s -c -l]\n", argv0);
printf("Options:\n");
printf(" -e <command> Execute command through an running daemon\n");
printf(" -h <host> Specify daemon host address, dafault is "DEFAULT_DAEMON_HOST"\n");
printf(" -p <port> Specify daemon port, default is %d\n", DEFAULT_DAEMON_PORT);
printf(" -d Run the daemon\n");
printf(" -s Run the daemon but don't daemonize\n");
printf(" -c <path> Set configure file path\n");
printf(" -l <path> Set log file path\n");
}
int main(int argc, char** argv)
{
int run_daemonize = 0;
int run_non_daemonize = 0;
char *cfg_filepath = NULL;
char *log_filepath = NULL;
char *exec_command = NULL;
char *daemon_address = NULL;
int daemon_port = 0;
if(argc <= 1)
{
show_help(argv[0]);
return 1;
}
for(;;)
{
int opt = getopt(argc, argv, "e:h:p:dsc:l:");
if (opt == -1) break;
switch(opt)
{
case 'e':
exec_command = optarg;
break;
case 'h':
daemon_address = optarg;
break;
case 'p':
if(sscanf(optarg, "%d", &daemon_port) != 1)
{
fprintf (stderr, "Invalid port number '%s'.\n", optarg);
return 1;
}
break;
case 'd':
run_daemonize = 1;
break;
case 's':
run_non_daemonize = 1;
break;
case 'c':
cfg_filepath = optarg;
break;
case 'l':
log_filepath = optarg;
break;
case '?':
switch(optopt)
{
case 'e':
case 'c':
case 'h':
case 'p':
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
return 1;
default:
if (isprint (optopt))
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
else
fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt);
return 1;
}
break;
default:
return 1;
}
}
if(run_daemonize && exec_command)
{
fprintf (stderr, "Option -d conflicts with option -e.\n");
return 1;
}
if(run_non_daemonize && exec_command)
{
fprintf (stderr, "Option -s conflicts with option -e.\n");
return 1;
}
if(run_daemonize && run_non_daemonize)
{
fprintf (stderr, "Option -d conflicts with option -s.\n");
return 1;
}
if(run_daemonize || run_non_daemonize)
{
if(daemon_address || daemon_port)
{
fprintf (stderr, "Option -h or option -p should be used with option -e.\n");
return 1;
}
if (!cfg_filepath) cfg_filepath = CFG_FILE;
if (!log_filepath) log_filepath = LOG_FILE;
run_as_daemon(cfg_filepath, log_filepath, run_daemonize);
}
else
{
if (!exec_command)
{
fprintf (stderr, "Must specify -d or -e option.\n");
return 1;
}
if (cfg_filepath || log_filepath)
{
fprintf (stderr, "Option -e conflicts with option -c and -l, the client of the daemon don't need any cfg files and don't write any logs.\n");
return 1;
}
if (!daemon_address) daemon_address = DEFAULT_DAEMON_HOST;
if (!daemon_port) daemon_port = DEFAULT_DAEMON_PORT;
run_as_client(daemon_address, daemon_port, exec_command);
}
return 0;
}
|
the_stack_data/215769278.c | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#define MAX_DATA 512
#define MAX_ROWS 100
struct Address {
int id;
int set;
char name[MAX_DATA];
char email[MAX_DATA];
};
struct Database {
struct Address rows[MAX_ROWS];
};
struct Connection {
FILE *file;
struct Database *db;
};
void die(const char *message)
{
if (errno) {
perror(message);
} else {
printf("ERROR: %s\n", message);
}
exit(1);
}
void Address_print(struct Address *addr)
{
printf("%d %s %s\n", addr->id, addr->name, addr->email);
}
void Database_load(struct Connection *conn)
{
// read the contents of conn->file into conn->db, once, with a fixed byte size equal to the size of the database struct
int rc = fread(conn->db, sizeof(struct Database), 1, conn->file);
if (rc != 1) {
// unable to read the file
die("Failed to load database.");
}
}
struct Connection *Database_open(const char *filename, char mode)
{
struct Connection *conn = malloc(sizeof(struct Connection));
if (!conn) {
die("Memory error when trying to allocate connection.");
}
conn->db = malloc(sizeof(struct Database));
if (!conn->db) {
die("Memory error when trying to allocate database.");
}
if (mode == 'c') {
conn->file = fopen(filename, "w");
} else {
conn->file = fopen(filename, "r+");
if (conn->file) {
Database_load(conn);
}
}
if (!conn->file) {
die("Failed to open the database file.");
}
return conn;
}
void Database_close(struct Connection *conn)
{
if (conn) {
if (conn->file) {
fclose(conn->file);
}
if (conn->db) {
free(conn->db);
}
free(conn);
}
}
void Database_write(struct Connection *conn)
{
rewind(conn->file);
int rc = fwrite(conn->db, sizeof(struct Database), 1, conn->file);
if (rc != 1) {
die("Failed to write database to disk.");
}
// flush to disk
rc = fflush(conn->file);
if (rc == -1) {
die("Cannot flush database to disk.");
}
}
// fill the database with empty elements
void Database_create(struct Connection *conn)
{
int i = 0;
for (i = 0; i < MAX_ROWS; i++) {
// make a prototype to initialize it
struct Address addr = {.id = i, .set = 0};
// assign it
conn->db->rows[i] = addr;
}
}
void Database_set(struct Connection *conn, int id, const char *name,
const char *email)
{
struct Address *addr = &conn->db->rows[id];
if (addr->set) {
die("Index already set, delete it first.");
}
addr->set = 1;
// strncpy is bad, it won't null-terminate if size of input is greater than max data
char *res = strncpy(addr->name, name, MAX_DATA);
if (!res) {
die("Name copy failed.");
}
if (sizeof(name) >= MAX_DATA) {
addr->name[MAX_DATA - 1] = '\0';
}
res = strncpy(addr->email, email, MAX_DATA);
if (!res) {
die("Email copy failed.");
}
if (sizeof(email) >= MAX_DATA) {
addr->email[MAX_DATA - 1] = '\0';
}
}
void Database_get(struct Connection *conn, int id)
{
struct Address *addr = &conn->db->rows[id];
if (addr->set) {
Address_print(addr);
} else {
die("ID is not set.");
}
}
void Database_delete(struct Connection *conn, int id)
{
struct Address addr = {.id = id, .set = 0};
conn->db->rows[id] = addr;
}
void Database_list(struct Connection *conn)
{
int i = 0;
struct Database *db = conn->db;
for (i = 0; i < MAX_ROWS; i++) {
struct Address *cur = &db->rows[i];
if (cur->set) {
Address_print(cur);
}
}
}
int main(int argc, char *argv[])
{
if (argc < 3) {
die("USAGE: ex17 <dbfile> <action> [action params...]");
}
char *filename = argv[1];
char action = argv[2][0];
struct Connection *conn = Database_open(filename, action);
int id = 0;
if (argc > 3) {
id = atoi(argv[3]);
}
if (id >= MAX_ROWS) {
die("There's not that many records in the database.");
}
switch (action) {
case 'c':
Database_create(conn);
Database_write(conn);
break;
case 'g':
if (argc != 4) {
die("Need an ID to get.");
}
Database_get(conn, id);
break;
case 's':
if (argc != 6) {
die("Need id, name, email to set.");
}
Database_set(conn, id, argv[4], argv[5]);
Database_write(conn);
break;
case 'd':
if (argc != 4) {
die("Need an ID to delete.");
}
Database_delete(conn, id);
Database_write(conn);
break;
case 'l':
Database_list(conn);
break;
default:
die("Invalid action, only create, get, set, delete, and list are allowed.");
break;
}
Database_close(conn);
return 0;
}
|
the_stack_data/125141557.c | #include <stdlib.h>
unsigned short * seed48(unsigned short seed16v[3])
{
return seed16v;
}
/*
XOPEN(4)
*/
|
the_stack_data/58707.c | /*Exercise 3 - Repetition
Write a C program to calculate the sum of the numbers from 1 to n.
Where n is a keyboard input.
e.g.
n -> 100
sum = 1+2+3+....+ 99+100 = 5050
n -> 1-
sum = 1+2+3+...+10 = 55 */
#include <stdio.h>
int main() {
int number, sum = 0, i;
printf("Enter number: ");
scanf("%d", &number);
for(i = 0;i <= number;i++)
{
sum = sum + i;
}
printf("Sum of numbers = %d", sum);
return 0;
}
|
the_stack_data/451963.c | int main() {
// variable declarations
int lock;
int x;
int y;
// pre-conditions
(x = y);
(lock = 1);
// loop body
while ((x != y)) {
{
if ( unknown() ) {
{
(lock = 1);
(x = y);
}
} else {
{
(lock = 0);
(x = y);
(y = (y + 1));
}
}
}
}
// post-condition
assert( (lock == 1) );
}
|
the_stack_data/18887048.c | /* f2c.h -- Standard Fortran to C header file */
/** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
- From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
#ifndef F2C_INCLUDE
#define F2C_INCLUDE
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <complex.h>
#ifdef complex
#undef complex
#endif
#ifdef I
#undef I
#endif
#if defined(_WIN64)
typedef long long BLASLONG;
typedef unsigned long long BLASULONG;
#else
typedef long BLASLONG;
typedef unsigned long BLASULONG;
#endif
#ifdef LAPACK_ILP64
typedef BLASLONG blasint;
#if defined(_WIN64)
#define blasabs(x) llabs(x)
#else
#define blasabs(x) labs(x)
#endif
#else
typedef int blasint;
#define blasabs(x) abs(x)
#endif
typedef blasint integer;
typedef unsigned int uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
#define pCf(z) (*_pCf(z))
#define pCd(z) (*_pCd(z))
typedef int logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
#define TRUE_ (1)
#define FALSE_ (0)
/* Extern is for use with -E */
#ifndef Extern
#define Extern extern
#endif
/* I/O stuff */
typedef int flag;
typedef int ftnlen;
typedef int ftnint;
/*external read, write*/
typedef struct
{ flag cierr;
ftnint ciunit;
flag ciend;
char *cifmt;
ftnint cirec;
} cilist;
/*internal read, write*/
typedef struct
{ flag icierr;
char *iciunit;
flag iciend;
char *icifmt;
ftnint icirlen;
ftnint icirnum;
} icilist;
/*open*/
typedef struct
{ flag oerr;
ftnint ounit;
char *ofnm;
ftnlen ofnmlen;
char *osta;
char *oacc;
char *ofm;
ftnint orl;
char *oblnk;
} olist;
/*close*/
typedef struct
{ flag cerr;
ftnint cunit;
char *csta;
} cllist;
/*rewind, backspace, endfile*/
typedef struct
{ flag aerr;
ftnint aunit;
} alist;
/* inquire */
typedef struct
{ flag inerr;
ftnint inunit;
char *infile;
ftnlen infilen;
ftnint *inex; /*parameters in standard's order*/
ftnint *inopen;
ftnint *innum;
ftnint *innamed;
char *inname;
ftnlen innamlen;
char *inacc;
ftnlen inacclen;
char *inseq;
ftnlen inseqlen;
char *indir;
ftnlen indirlen;
char *infmt;
ftnlen infmtlen;
char *inform;
ftnint informlen;
char *inunf;
ftnlen inunflen;
ftnint *inrecl;
ftnint *innrec;
char *inblank;
ftnlen inblanklen;
} inlist;
#define VOID void
union Multitype { /* for multiple entry points */
integer1 g;
shortint h;
integer i;
/* longint j; */
real r;
doublereal d;
complex c;
doublecomplex z;
};
typedef union Multitype Multitype;
struct Vardesc { /* for Namelist */
char *name;
char *addr;
ftnlen *dims;
int type;
};
typedef struct Vardesc Vardesc;
struct Namelist {
char *name;
Vardesc **vars;
int nvars;
};
typedef struct Namelist Namelist;
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define dabs(x) (fabs(x))
#define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
#define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
#define dmin(a,b) (f2cmin(a,b))
#define dmax(a,b) (f2cmax(a,b))
#define bit_test(a,b) ((a) >> (b) & 1)
#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
#define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
#define abort_() { sig_die("Fortran abort routine called", 1); }
#define c_abs(z) (cabsf(Cf(z)))
#define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
#define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
#define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
#define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
#define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
#define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
//#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
#define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
#define d_abs(x) (fabs(*(x)))
#define d_acos(x) (acos(*(x)))
#define d_asin(x) (asin(*(x)))
#define d_atan(x) (atan(*(x)))
#define d_atn2(x, y) (atan2(*(x),*(y)))
#define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
#define r_cnjg(R, Z) { pCf(R) = conj(Cf(Z)); }
#define d_cos(x) (cos(*(x)))
#define d_cosh(x) (cosh(*(x)))
#define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
#define d_exp(x) (exp(*(x)))
#define d_imag(z) (cimag(Cd(z)))
#define r_imag(z) (cimag(Cf(z)))
#define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define d_log(x) (log(*(x)))
#define d_mod(x, y) (fmod(*(x), *(y)))
#define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
#define d_nint(x) u_nint(*(x))
#define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
#define d_sign(a,b) u_sign(*(a),*(b))
#define r_sign(a,b) u_sign(*(a),*(b))
#define d_sin(x) (sin(*(x)))
#define d_sinh(x) (sinh(*(x)))
#define d_sqrt(x) (sqrt(*(x)))
#define d_tan(x) (tan(*(x)))
#define d_tanh(x) (tanh(*(x)))
#define i_abs(x) abs(*(x))
#define i_dnnt(x) ((integer)u_nint(*(x)))
#define i_len(s, n) (n)
#define i_nint(x) ((integer)u_nint(*(x)))
#define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
#define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
#define pow_si(B,E) spow_ui(*(B),*(E))
#define pow_ri(B,E) spow_ui(*(B),*(E))
#define pow_di(B,E) dpow_ui(*(B),*(E))
#define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
#define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
#define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
#define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
#define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
#define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
#define sig_die(s, kill) { exit(1); }
#define s_stop(s, n) {exit(0);}
static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
#define z_abs(z) (cabs(Cd(z)))
#define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
#define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
#define myexit_() break;
#define mycycle() continue;
#define myceiling(w) {ceil(w)}
#define myhuge(w) {HUGE_VAL}
//#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
#define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
/* procedure parameter types for -A and -C++ */
#define F2C_proc_par_types 1
#ifdef __cplusplus
typedef logical (*L_fp)(...);
#else
typedef logical (*L_fp)();
#endif
static float spow_ui(float x, integer n) {
float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static double dpow_ui(double x, integer n) {
double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static _Complex float cpow_ui(_Complex float x, integer n) {
_Complex float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static _Complex double zpow_ui(_Complex double x, integer n) {
_Complex double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static integer pow_ii(integer x, integer n) {
integer pow; unsigned long int u;
if (n <= 0) {
if (n == 0 || x == 1) pow = 1;
else if (x != -1) pow = x == 0 ? 1/x : 0;
else n = -n;
}
if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
u = n;
for(pow = 1; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static integer dmaxloc_(double *w, integer s, integer e, integer *n)
{
double m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static integer smaxloc_(float *w, integer s, integer e, integer *n)
{
float m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i]) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i]) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
/* -- translated by f2c (version 20000121).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
/* Table of constant values */
static integer c__1 = 1;
static integer c_n1 = -1;
/* > \brief \b CUNGTR */
/* =========== DOCUMENTATION =========== */
/* Online html documentation available at */
/* http://www.netlib.org/lapack/explore-html/ */
/* > \htmlonly */
/* > Download CUNGTR + dependencies */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cungtr.
f"> */
/* > [TGZ]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cungtr.
f"> */
/* > [ZIP]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cungtr.
f"> */
/* > [TXT]</a> */
/* > \endhtmlonly */
/* Definition: */
/* =========== */
/* SUBROUTINE CUNGTR( UPLO, N, A, LDA, TAU, WORK, LWORK, INFO ) */
/* CHARACTER UPLO */
/* INTEGER INFO, LDA, LWORK, N */
/* COMPLEX A( LDA, * ), TAU( * ), WORK( * ) */
/* > \par Purpose: */
/* ============= */
/* > */
/* > \verbatim */
/* > */
/* > CUNGTR generates a complex unitary matrix Q which is defined as the */
/* > product of n-1 elementary reflectors of order N, as returned by */
/* > CHETRD: */
/* > */
/* > if UPLO = 'U', Q = H(n-1) . . . H(2) H(1), */
/* > */
/* > if UPLO = 'L', Q = H(1) H(2) . . . H(n-1). */
/* > \endverbatim */
/* Arguments: */
/* ========== */
/* > \param[in] UPLO */
/* > \verbatim */
/* > UPLO is CHARACTER*1 */
/* > = 'U': Upper triangle of A contains elementary reflectors */
/* > from CHETRD; */
/* > = 'L': Lower triangle of A contains elementary reflectors */
/* > from CHETRD. */
/* > \endverbatim */
/* > */
/* > \param[in] N */
/* > \verbatim */
/* > N is INTEGER */
/* > The order of the matrix Q. N >= 0. */
/* > \endverbatim */
/* > */
/* > \param[in,out] A */
/* > \verbatim */
/* > A is COMPLEX array, dimension (LDA,N) */
/* > On entry, the vectors which define the elementary reflectors, */
/* > as returned by CHETRD. */
/* > On exit, the N-by-N unitary matrix Q. */
/* > \endverbatim */
/* > */
/* > \param[in] LDA */
/* > \verbatim */
/* > LDA is INTEGER */
/* > The leading dimension of the array A. LDA >= N. */
/* > \endverbatim */
/* > */
/* > \param[in] TAU */
/* > \verbatim */
/* > TAU is COMPLEX array, dimension (N-1) */
/* > TAU(i) must contain the scalar factor of the elementary */
/* > reflector H(i), as returned by CHETRD. */
/* > \endverbatim */
/* > */
/* > \param[out] WORK */
/* > \verbatim */
/* > WORK is COMPLEX array, dimension (MAX(1,LWORK)) */
/* > On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */
/* > \endverbatim */
/* > */
/* > \param[in] LWORK */
/* > \verbatim */
/* > LWORK is INTEGER */
/* > The dimension of the array WORK. LWORK >= N-1. */
/* > For optimum performance LWORK >= (N-1)*NB, where NB is */
/* > the optimal blocksize. */
/* > */
/* > If LWORK = -1, then a workspace query is assumed; the routine */
/* > only calculates the optimal size of the WORK array, returns */
/* > this value as the first entry of the WORK array, and no error */
/* > message related to LWORK is issued by XERBLA. */
/* > \endverbatim */
/* > */
/* > \param[out] INFO */
/* > \verbatim */
/* > INFO is INTEGER */
/* > = 0: successful exit */
/* > < 0: if INFO = -i, the i-th argument had an illegal value */
/* > \endverbatim */
/* Authors: */
/* ======== */
/* > \author Univ. of Tennessee */
/* > \author Univ. of California Berkeley */
/* > \author Univ. of Colorado Denver */
/* > \author NAG Ltd. */
/* > \date December 2016 */
/* > \ingroup complexOTHERcomputational */
/* ===================================================================== */
/* Subroutine */ int cungtr_(char *uplo, integer *n, complex *a, integer *lda,
complex *tau, complex *work, integer *lwork, integer *info)
{
/* System generated locals */
integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
/* Local variables */
integer i__, j;
extern logical lsame_(char *, char *);
integer iinfo;
logical upper;
integer nb;
extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
integer *, integer *, ftnlen, ftnlen);
extern /* Subroutine */ int cungql_(integer *, integer *, integer *,
complex *, integer *, complex *, complex *, integer *, integer *),
cungqr_(integer *, integer *, integer *, complex *, integer *,
complex *, complex *, integer *, integer *);
integer lwkopt;
logical lquery;
/* -- LAPACK computational routine (version 3.7.0) -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
/* December 2016 */
/* ===================================================================== */
/* Test the input arguments */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1 * 1;
a -= a_offset;
--tau;
--work;
/* Function Body */
*info = 0;
lquery = *lwork == -1;
upper = lsame_(uplo, "U");
if (! upper && ! lsame_(uplo, "L")) {
*info = -1;
} else if (*n < 0) {
*info = -2;
} else if (*lda < f2cmax(1,*n)) {
*info = -4;
} else /* if(complicated condition) */ {
/* Computing MAX */
i__1 = 1, i__2 = *n - 1;
if (*lwork < f2cmax(i__1,i__2) && ! lquery) {
*info = -7;
}
}
if (*info == 0) {
if (upper) {
i__1 = *n - 1;
i__2 = *n - 1;
i__3 = *n - 1;
nb = ilaenv_(&c__1, "CUNGQL", " ", &i__1, &i__2, &i__3, &c_n1, (
ftnlen)6, (ftnlen)1);
} else {
i__1 = *n - 1;
i__2 = *n - 1;
i__3 = *n - 1;
nb = ilaenv_(&c__1, "CUNGQR", " ", &i__1, &i__2, &i__3, &c_n1, (
ftnlen)6, (ftnlen)1);
}
/* Computing MAX */
i__1 = 1, i__2 = *n - 1;
lwkopt = f2cmax(i__1,i__2) * nb;
work[1].r = (real) lwkopt, work[1].i = 0.f;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("CUNGTR", &i__1, (ftnlen)6);
return 0;
} else if (lquery) {
return 0;
}
/* Quick return if possible */
if (*n == 0) {
work[1].r = 1.f, work[1].i = 0.f;
return 0;
}
if (upper) {
/* Q was determined by a call to CHETRD with UPLO = 'U' */
/* Shift the vectors which define the elementary reflectors one */
/* column to the left, and set the last row and column of Q to */
/* those of the unit matrix */
i__1 = *n - 1;
for (j = 1; j <= i__1; ++j) {
i__2 = j - 1;
for (i__ = 1; i__ <= i__2; ++i__) {
i__3 = i__ + j * a_dim1;
i__4 = i__ + (j + 1) * a_dim1;
a[i__3].r = a[i__4].r, a[i__3].i = a[i__4].i;
/* L10: */
}
i__2 = *n + j * a_dim1;
a[i__2].r = 0.f, a[i__2].i = 0.f;
/* L20: */
}
i__1 = *n - 1;
for (i__ = 1; i__ <= i__1; ++i__) {
i__2 = i__ + *n * a_dim1;
a[i__2].r = 0.f, a[i__2].i = 0.f;
/* L30: */
}
i__1 = *n + *n * a_dim1;
a[i__1].r = 1.f, a[i__1].i = 0.f;
/* Generate Q(1:n-1,1:n-1) */
i__1 = *n - 1;
i__2 = *n - 1;
i__3 = *n - 1;
cungql_(&i__1, &i__2, &i__3, &a[a_offset], lda, &tau[1], &work[1],
lwork, &iinfo);
} else {
/* Q was determined by a call to CHETRD with UPLO = 'L'. */
/* Shift the vectors which define the elementary reflectors one */
/* column to the right, and set the first row and column of Q to */
/* those of the unit matrix */
for (j = *n; j >= 2; --j) {
i__1 = j * a_dim1 + 1;
a[i__1].r = 0.f, a[i__1].i = 0.f;
i__1 = *n;
for (i__ = j + 1; i__ <= i__1; ++i__) {
i__2 = i__ + j * a_dim1;
i__3 = i__ + (j - 1) * a_dim1;
a[i__2].r = a[i__3].r, a[i__2].i = a[i__3].i;
/* L40: */
}
/* L50: */
}
i__1 = a_dim1 + 1;
a[i__1].r = 1.f, a[i__1].i = 0.f;
i__1 = *n;
for (i__ = 2; i__ <= i__1; ++i__) {
i__2 = i__ + a_dim1;
a[i__2].r = 0.f, a[i__2].i = 0.f;
/* L60: */
}
if (*n > 1) {
/* Generate Q(2:n,2:n) */
i__1 = *n - 1;
i__2 = *n - 1;
i__3 = *n - 1;
cungqr_(&i__1, &i__2, &i__3, &a[(a_dim1 << 1) + 2], lda, &tau[1],
&work[1], lwork, &iinfo);
}
}
work[1].r = (real) lwkopt, work[1].i = 0.f;
return 0;
/* End of CUNGTR */
} /* cungtr_ */
|
the_stack_data/243894233.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
void ch(int* p)
{
*p = *p *2;
}
struct bo {
int x;
int y;
};
int main()
{
//LAB CODE
/* PARTEA 1
int x, *a, b, *c;
x = 23;
a = &x;
b = *a;
c = a;
printf("%d %d %d\n", x,*a, *c);
printf("%x %x %x %x %x\n", &x,&a, &b, &c, a, c);
*/
/*
int *p, x;
p = (int*) malloc(sizeof(int)); //malloc returns void*
//scanf("%d", &x); //in mod normal, trb adresa variabilei, dar p e
// //deja o adresa
scanf("%d", p);
ch(p); ch(&x);
printf("%d\n", *p);
*/
/* PARTEA 3
int x[3], *p;
x[0] = 1; x[1] = 7; x[2] = 5;
p = &(x[0]);
printf("%d\n", *p);
p = p + 1; // x[1]
printf("%d\n", *p);
p = p + 100; //segm fault
*/
/*
struct bo a, *p; //trb neaparat sa pui si bo
p = &a;
(*p).x = 7;
p->y = 2;
printf("%d %d\n", p->x, p->y);
*/
/*
char h[10] = "sirul";
h[9] = 'a';
printf("%s\n", h);
int i;
for(i = 0; i < 10; i++)
printf("%d\n", h[i]);
*/
return 0;
} |
the_stack_data/1588.c | // This is just a check to see if I remembered any C at all.
// Please see license file in github.com/cbasoft/Testing to
// get the licensing info for this file.
/////////////////////////////////////////////////////////////
#include <stdio.h>
int main() {
// Variables.
// Change a "1" to a "2" to force it through the error block.
int $check1 = 1;
int $check2 = 1;
// Main block goes from here.
if ($check1 == $check2) {
printf("Random check.\n\"Assuming\" all goes to plan. That is and if it works.\n");
getchar();
return(0);
}
// Our error block.
else {
printf("Just pushing for an error code.\n");
getchar();
return(1);
}
}
|
the_stack_data/530354.c | // KASAN: slab-out-of-bounds Read in vsscanf (2)
// https://syzkaller.appspot.com/bug?id=a22c6092d003d6fe1122
// status:6
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
uint64_t r[1] = {0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
intptr_t res = 0;
memcpy((void*)0x20000180, "/sys/fs/smackfs/cipso2\000", 23);
res = syscall(__NR_openat, 0xffffffffffffff9cul, 0x20000180ul, 2ul, 0ul);
if (res != -1)
r[0] = res;
memcpy((void*)0x20000040, "mountstats!", 11);
*(uint8_t*)0x2000004b = 0x20;
sprintf((char*)0x2000004c, "%020llu", (long long)0x7c);
*(uint8_t*)0x20000060 = 0x20;
sprintf((char*)0x20000061, "%020llu", (long long)0);
*(uint8_t*)0x20000075 = 0x20;
*(uint8_t*)0x20000076 = 0;
syscall(__NR_write, r[0], 0x20000040ul, 0x37ul);
return 0;
}
|
the_stack_data/1088950.c | #include <stdio.h>
/*
*
* expand : expand(s1, s2) that expands shorthand notations like a-z in the string
* s1 into the equivalent complete list abc...xyz in s2. Allow for letters of either case
* and digits and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. Arrange that a
* leading or trailing - is taken literally
*
*/
void expand(char s1[], char s2[]);
int main()
{
char s1[] = "a-z";
char s2[30];
expand(s1, s2);
printf("The expanded %s is %s\n", s1, s2);
return 0; //return SUCCESS
}
void expand(char s1[], char s2[])
{
char c;
int i, j;
i = j = 0;
while ((c = s1[i++]) != '\0') /* fetch a char from s1[] */
{
if (s1[i] == '-' && s1[i + 1] >= c) {
i++;
while (c < s1[i])
{
s2[j++] = c++;
}
} else {
s2[j++] = c;
}
}
s2[j] = '\0';
}
|
the_stack_data/757640.c | /*
* (c) 2018-2019 Hadrien Barral
* SPDX-License-Identifier: Apache-2.0
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
uint64_t shellcode(void);
__attribute__((weak))
uint64_t func2(const char *in, void **array, int offset) {
char name[300];
strcpy(name, in); /* Blatant SO incoming */
name[sizeof(name)-1] = '\0';
array[offset] = name;
return strlen(name);
}
__attribute__((weak))
uint64_t func1(const char *bad, int size) {
uint8_t arr[992];
if(size < 972) {
memset(arr, size, sizeof(arr));
return func1(bad, size+1);
}
return func2(bad, (void **)arr, -1);
}
int main(void) {
puts("Hello world from the buggy program on HifiveU board.");
puts("Waiting for input...");
char *bad = NULL; size_t n;
ssize_t status = __getline(&bad, &n, stdin);
if(status == -1) {
fprintf(stderr, "getline failed\n");
exit(1);
}
//printf("line:%s\n", bad);
puts("Processing data...");
uint64_t ret = func1(bad, 0);
free(bad);
printf("Exiting from shellcode (%#lx).\n", ret);
return 0;
}
|
the_stack_data/93887105.c | #include <wchar.h>
wchar_t * wcscat(wchar_t * restrict s1, const wchar_t * restrict s2)
{
wcscpy(s1 + wcslen(s1), s2);
return s1;
}
/*
STDC(199409)
*/
|
the_stack_data/154830251.c | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
int * nums;
nums = (int *)malloc(sizeof(int) * 5);//为前面的指针动态分配了20个字节的空间
// 等价于: int nums[5]
// 为指针动态分配空间后,指针就变成了数组
for (i=0;i<5;i++)
{
printf("请输入第%d个元素:", i+1);
scanf("%d", nums + 1);
}
printf("数组元素为:\n");
for (i=0; i<5; i++)
{
printf("%d\t", *(nums + i));
}
free(nums);// 释放动态分配的内存
nums = NULL;
} |
the_stack_data/211080095.c | #include <stdio.h>
#include <string.h>
typedef char * String;
int smallest_word_index(String s[], int n) {
String smallest = s[0];
int smallest_idx = 0;
for (int i = 1; i < n; i++) {
if (strcmp(smallest, s[i]) > 0) {
smallest = s[i];
smallest_idx = i;
}
}
return smallest_idx;
}
String *smallest_word_address(String s[], int n) {
String *smallest = &s[0];
for (int i = 1; i < n; i++) {
if (strcmp(*smallest, s[i]) > 0) {
smallest = &s[i];
}
}
return smallest;
}
int main() {
char *dict[] = { "ciao", "mondo", "come", "funziona", "bene", "il", "programma" };
int lun = 7;
printf("%d\n", smallest_word_index(dict, lun));
printf("%s\n", *smallest_word_address(dict, lun));
return 0;
}
|
the_stack_data/145453895.c | // KASAN: stack-out-of-bounds in update_curr
// https://syzkaller.appspot.com/bug?id=6cd9d6248621846a45e71d1004230ddd217fee57
// status:dup
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <arpa/inet.h>
#include <dirent.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include <pthread.h>
#include <sched.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include <linux/futex.h>
#include <linux/if_addr.h>
#include <linux/if_ether.h>
#include <linux/if_link.h>
#include <linux/if_tun.h>
#include <linux/in6.h>
#include <linux/ip.h>
#include <linux/neighbour.h>
#include <linux/net.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/tcp.h>
#include <linux/veth.h>
unsigned long long procid;
static __thread int skip_segv;
static __thread jmp_buf segv_env;
static void segv_handler(int sig, siginfo_t* info, void* ctx)
{
uintptr_t addr = (uintptr_t)info->si_addr;
const uintptr_t prog_start = 1 << 20;
const uintptr_t prog_end = 100 << 20;
if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED) &&
(addr < prog_start || addr > prog_end)) {
_longjmp(segv_env, 1);
}
exit(sig);
}
static void install_segv_handler(void)
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_IGN;
syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8);
syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8);
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = segv_handler;
sa.sa_flags = SA_NODEFER | SA_SIGINFO;
sigaction(SIGSEGV, &sa, NULL);
sigaction(SIGBUS, &sa, NULL);
}
#define NONFAILING(...) \
{ \
__atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \
if (_setjmp(segv_env) == 0) { \
__VA_ARGS__; \
} \
__atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \
}
static void sleep_ms(uint64_t ms)
{
usleep(ms * 1000);
}
static uint64_t current_time_ms(void)
{
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts))
exit(1);
return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
}
static void use_temporary_dir(void)
{
char tmpdir_template[] = "./syzkaller.XXXXXX";
char* tmpdir = mkdtemp(tmpdir_template);
if (!tmpdir)
exit(1);
if (chmod(tmpdir, 0777))
exit(1);
if (chdir(tmpdir))
exit(1);
}
static void thread_start(void* (*fn)(void*), void* arg)
{
pthread_t th;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 128 << 10);
if (pthread_create(&th, &attr, fn, arg))
exit(1);
pthread_attr_destroy(&attr);
}
typedef struct {
int state;
} event_t;
static void event_init(event_t* ev)
{
ev->state = 0;
}
static void event_reset(event_t* ev)
{
ev->state = 0;
}
static void event_set(event_t* ev)
{
if (ev->state)
exit(1);
__atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE);
syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG);
}
static void event_wait(event_t* ev)
{
while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0);
}
static int event_isset(event_t* ev)
{
return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE);
}
static int event_timedwait(event_t* ev, uint64_t timeout)
{
uint64_t start = current_time_ms();
uint64_t now = start;
for (;;) {
uint64_t remain = timeout - (now - start);
struct timespec ts;
ts.tv_sec = remain / 1000;
ts.tv_nsec = (remain % 1000) * 1000 * 1000;
syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts);
if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED))
return 1;
now = current_time_ms();
if (now - start > timeout)
return 0;
}
}
static bool write_file(const char* file, const char* what, ...)
{
char buf[1024];
va_list args;
va_start(args, what);
vsnprintf(buf, sizeof(buf), what, args);
va_end(args);
buf[sizeof(buf) - 1] = 0;
int len = strlen(buf);
int fd = open(file, O_WRONLY | O_CLOEXEC);
if (fd == -1)
return false;
if (write(fd, buf, len) != len) {
int err = errno;
close(fd);
errno = err;
return false;
}
close(fd);
return true;
}
static struct {
char* pos;
int nesting;
struct nlattr* nested[8];
char buf[1024];
} nlmsg;
static void netlink_init(int typ, int flags, const void* data, int size)
{
memset(&nlmsg, 0, sizeof(nlmsg));
struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg.buf;
hdr->nlmsg_type = typ;
hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags;
memcpy(hdr + 1, data, size);
nlmsg.pos = (char*)(hdr + 1) + NLMSG_ALIGN(size);
}
static void netlink_attr(int typ, const void* data, int size)
{
struct nlattr* attr = (struct nlattr*)nlmsg.pos;
attr->nla_len = sizeof(*attr) + size;
attr->nla_type = typ;
memcpy(attr + 1, data, size);
nlmsg.pos += NLMSG_ALIGN(attr->nla_len);
}
static void netlink_nest(int typ)
{
struct nlattr* attr = (struct nlattr*)nlmsg.pos;
attr->nla_type = typ;
nlmsg.pos += sizeof(*attr);
nlmsg.nested[nlmsg.nesting++] = attr;
}
static void netlink_done(void)
{
struct nlattr* attr = nlmsg.nested[--nlmsg.nesting];
attr->nla_len = nlmsg.pos - (char*)attr;
}
static int netlink_send(int sock)
{
if (nlmsg.pos > nlmsg.buf + sizeof(nlmsg.buf) || nlmsg.nesting)
exit(1);
struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg.buf;
hdr->nlmsg_len = nlmsg.pos - nlmsg.buf;
struct sockaddr_nl addr;
memset(&addr, 0, sizeof(addr));
addr.nl_family = AF_NETLINK;
unsigned n = sendto(sock, nlmsg.buf, hdr->nlmsg_len, 0,
(struct sockaddr*)&addr, sizeof(addr));
if (n != hdr->nlmsg_len)
exit(1);
n = recv(sock, nlmsg.buf, sizeof(nlmsg.buf), 0);
if (n < sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr))
exit(1);
if (hdr->nlmsg_type != NLMSG_ERROR)
exit(1);
return -((struct nlmsgerr*)(hdr + 1))->error;
}
static void netlink_add_device_impl(const char* type, const char* name)
{
struct ifinfomsg hdr;
memset(&hdr, 0, sizeof(hdr));
netlink_init(RTM_NEWLINK, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr));
if (name)
netlink_attr(IFLA_IFNAME, name, strlen(name));
netlink_nest(IFLA_LINKINFO);
netlink_attr(IFLA_INFO_KIND, type, strlen(type));
}
static void netlink_add_device(int sock, const char* type, const char* name)
{
netlink_add_device_impl(type, name);
netlink_done();
int err = netlink_send(sock);
(void)err;
}
static void netlink_add_veth(int sock, const char* name, const char* peer)
{
netlink_add_device_impl("veth", name);
netlink_nest(IFLA_INFO_DATA);
netlink_nest(VETH_INFO_PEER);
nlmsg.pos += sizeof(struct ifinfomsg);
netlink_attr(IFLA_IFNAME, peer, strlen(peer));
netlink_done();
netlink_done();
netlink_done();
int err = netlink_send(sock);
(void)err;
}
static void netlink_add_hsr(int sock, const char* name, const char* slave1,
const char* slave2)
{
netlink_add_device_impl("hsr", name);
netlink_nest(IFLA_INFO_DATA);
int ifindex1 = if_nametoindex(slave1);
netlink_attr(IFLA_HSR_SLAVE1, &ifindex1, sizeof(ifindex1));
int ifindex2 = if_nametoindex(slave2);
netlink_attr(IFLA_HSR_SLAVE2, &ifindex2, sizeof(ifindex2));
netlink_done();
netlink_done();
int err = netlink_send(sock);
(void)err;
}
static void netlink_device_change(int sock, const char* name, bool up,
const char* master, const void* mac,
int macsize)
{
struct ifinfomsg hdr;
memset(&hdr, 0, sizeof(hdr));
if (up)
hdr.ifi_flags = hdr.ifi_change = IFF_UP;
netlink_init(RTM_NEWLINK, 0, &hdr, sizeof(hdr));
netlink_attr(IFLA_IFNAME, name, strlen(name));
if (master) {
int ifindex = if_nametoindex(master);
netlink_attr(IFLA_MASTER, &ifindex, sizeof(ifindex));
}
if (macsize)
netlink_attr(IFLA_ADDRESS, mac, macsize);
int err = netlink_send(sock);
(void)err;
}
static int netlink_add_addr(int sock, const char* dev, const void* addr,
int addrsize)
{
struct ifaddrmsg hdr;
memset(&hdr, 0, sizeof(hdr));
hdr.ifa_family = addrsize == 4 ? AF_INET : AF_INET6;
hdr.ifa_prefixlen = addrsize == 4 ? 24 : 120;
hdr.ifa_scope = RT_SCOPE_UNIVERSE;
hdr.ifa_index = if_nametoindex(dev);
netlink_init(RTM_NEWADDR, NLM_F_CREATE | NLM_F_REPLACE, &hdr, sizeof(hdr));
netlink_attr(IFA_LOCAL, addr, addrsize);
netlink_attr(IFA_ADDRESS, addr, addrsize);
return netlink_send(sock);
}
static void netlink_add_addr4(int sock, const char* dev, const char* addr)
{
struct in_addr in_addr;
inet_pton(AF_INET, addr, &in_addr);
int err = netlink_add_addr(sock, dev, &in_addr, sizeof(in_addr));
(void)err;
}
static void netlink_add_addr6(int sock, const char* dev, const char* addr)
{
struct in6_addr in6_addr;
inet_pton(AF_INET6, addr, &in6_addr);
int err = netlink_add_addr(sock, dev, &in6_addr, sizeof(in6_addr));
(void)err;
}
static void netlink_add_neigh(int sock, const char* name, const void* addr,
int addrsize, const void* mac, int macsize)
{
struct ndmsg hdr;
memset(&hdr, 0, sizeof(hdr));
hdr.ndm_family = addrsize == 4 ? AF_INET : AF_INET6;
hdr.ndm_ifindex = if_nametoindex(name);
hdr.ndm_state = NUD_PERMANENT;
netlink_init(RTM_NEWNEIGH, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr));
netlink_attr(NDA_DST, addr, addrsize);
netlink_attr(NDA_LLADDR, mac, macsize);
int err = netlink_send(sock);
(void)err;
}
static int tunfd = -1;
static int tun_frags_enabled;
#define SYZ_TUN_MAX_PACKET_SIZE 1000
#define TUN_IFACE "syz_tun"
#define LOCAL_MAC 0xaaaaaaaaaaaa
#define REMOTE_MAC 0xaaaaaaaaaabb
#define LOCAL_IPV4 "172.20.20.170"
#define REMOTE_IPV4 "172.20.20.187"
#define LOCAL_IPV6 "fe80::aa"
#define REMOTE_IPV6 "fe80::bb"
#define IFF_NAPI 0x0010
#define IFF_NAPI_FRAGS 0x0020
static void initialize_tun(void)
{
tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK);
if (tunfd == -1) {
printf("tun: can't open /dev/net/tun: please enable CONFIG_TUN=y\n");
printf("otherwise fuzzing or reproducing might not work as intended\n");
return;
}
const int kTunFd = 240;
if (dup2(tunfd, kTunFd) < 0)
exit(1);
close(tunfd);
tunfd = kTunFd;
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, TUN_IFACE, IFNAMSIZ);
ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_NAPI | IFF_NAPI_FRAGS;
if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) {
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0)
exit(1);
}
if (ioctl(tunfd, TUNGETIFF, (void*)&ifr) < 0)
exit(1);
tun_frags_enabled = (ifr.ifr_flags & IFF_NAPI_FRAGS) != 0;
char sysctl[64];
sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/accept_dad", TUN_IFACE);
write_file(sysctl, "0");
sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/router_solicitations", TUN_IFACE);
write_file(sysctl, "0");
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sock == -1)
exit(1);
netlink_add_addr4(sock, TUN_IFACE, LOCAL_IPV4);
netlink_add_addr6(sock, TUN_IFACE, LOCAL_IPV6);
uint64_t macaddr = REMOTE_MAC;
struct in_addr in_addr;
inet_pton(AF_INET, REMOTE_IPV4, &in_addr);
netlink_add_neigh(sock, TUN_IFACE, &in_addr, sizeof(in_addr), &macaddr,
ETH_ALEN);
struct in6_addr in6_addr;
inet_pton(AF_INET6, REMOTE_IPV6, &in6_addr);
netlink_add_neigh(sock, TUN_IFACE, &in6_addr, sizeof(in6_addr), &macaddr,
ETH_ALEN);
macaddr = LOCAL_MAC;
netlink_device_change(sock, TUN_IFACE, true, 0, &macaddr, ETH_ALEN);
close(sock);
}
#define DEV_IPV4 "172.20.20.%d"
#define DEV_IPV6 "fe80::%02hx"
#define DEV_MAC 0x00aaaaaaaaaa
static void initialize_netdevices(void)
{
char netdevsim[16];
sprintf(netdevsim, "netdevsim%d", (int)procid);
struct {
const char* type;
const char* dev;
} devtypes[] = {
{"ip6gretap", "ip6gretap0"}, {"bridge", "bridge0"},
{"vcan", "vcan0"}, {"bond", "bond0"},
{"team", "team0"}, {"dummy", "dummy0"},
{"nlmon", "nlmon0"}, {"caif", "caif0"},
{"batadv", "batadv0"}, {"vxcan", "vxcan1"},
{"netdevsim", netdevsim}, {"veth", 0},
};
const char* devmasters[] = {"bridge", "bond", "team"};
struct {
const char* name;
int macsize;
bool noipv6;
} devices[] = {
{"lo", ETH_ALEN},
{"sit0", 0},
{"bridge0", ETH_ALEN},
{"vcan0", 0, true},
{"tunl0", 0},
{"gre0", 0},
{"gretap0", ETH_ALEN},
{"ip_vti0", 0},
{"ip6_vti0", 0},
{"ip6tnl0", 0},
{"ip6gre0", 0},
{"ip6gretap0", ETH_ALEN},
{"erspan0", ETH_ALEN},
{"bond0", ETH_ALEN},
{"veth0", ETH_ALEN},
{"veth1", ETH_ALEN},
{"team0", ETH_ALEN},
{"veth0_to_bridge", ETH_ALEN},
{"veth1_to_bridge", ETH_ALEN},
{"veth0_to_bond", ETH_ALEN},
{"veth1_to_bond", ETH_ALEN},
{"veth0_to_team", ETH_ALEN},
{"veth1_to_team", ETH_ALEN},
{"veth0_to_hsr", ETH_ALEN},
{"veth1_to_hsr", ETH_ALEN},
{"hsr0", 0},
{"dummy0", ETH_ALEN},
{"nlmon0", 0},
{"vxcan1", 0, true},
{"caif0", ETH_ALEN},
{"batadv0", ETH_ALEN},
{netdevsim, ETH_ALEN},
};
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sock == -1)
exit(1);
unsigned i;
for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++)
netlink_add_device(sock, devtypes[i].type, devtypes[i].dev);
for (i = 0; i < sizeof(devmasters) / (sizeof(devmasters[0])); i++) {
char master[32], slave0[32], veth0[32], slave1[32], veth1[32];
sprintf(slave0, "%s_slave_0", devmasters[i]);
sprintf(veth0, "veth0_to_%s", devmasters[i]);
netlink_add_veth(sock, slave0, veth0);
sprintf(slave1, "%s_slave_1", devmasters[i]);
sprintf(veth1, "veth1_to_%s", devmasters[i]);
netlink_add_veth(sock, slave1, veth1);
sprintf(master, "%s0", devmasters[i]);
netlink_device_change(sock, slave0, false, master, 0, 0);
netlink_device_change(sock, slave1, false, master, 0, 0);
}
netlink_device_change(sock, "bridge_slave_0", true, 0, 0, 0);
netlink_device_change(sock, "bridge_slave_1", true, 0, 0, 0);
netlink_add_veth(sock, "hsr_slave_0", "veth0_to_hsr");
netlink_add_veth(sock, "hsr_slave_1", "veth1_to_hsr");
netlink_add_hsr(sock, "hsr0", "hsr_slave_0", "hsr_slave_1");
netlink_device_change(sock, "hsr_slave_0", true, 0, 0, 0);
netlink_device_change(sock, "hsr_slave_1", true, 0, 0, 0);
for (i = 0; i < sizeof(devices) / (sizeof(devices[0])); i++) {
char addr[32];
sprintf(addr, DEV_IPV4, i + 10);
netlink_add_addr4(sock, devices[i].name, addr);
if (!devices[i].noipv6) {
sprintf(addr, DEV_IPV6, i + 10);
netlink_add_addr6(sock, devices[i].name, addr);
}
uint64_t macaddr = DEV_MAC + ((i + 10ull) << 40);
netlink_device_change(sock, devices[i].name, true, 0, &macaddr,
devices[i].macsize);
}
close(sock);
}
static void initialize_netdevices_init(void)
{
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sock == -1)
exit(1);
struct {
const char* type;
int macsize;
bool noipv6;
bool noup;
} devtypes[] = {
{"nr", 7, true},
{"rose", 5, true, true},
};
unsigned i;
for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++) {
char dev[32], addr[32];
sprintf(dev, "%s%d", devtypes[i].type, (int)procid);
sprintf(addr, "172.30.%d.%d", i, (int)procid + 1);
netlink_add_addr4(sock, dev, addr);
if (!devtypes[i].noipv6) {
sprintf(addr, "fe88::%02hx:%02hx", i, (int)procid + 1);
netlink_add_addr6(sock, dev, addr);
}
int macsize = devtypes[i].macsize;
uint64_t macaddr = 0xbbbbbb +
((unsigned long long)i << (8 * (macsize - 2))) +
(procid << (8 * (macsize - 1)));
netlink_device_change(sock, dev, !devtypes[i].noup, 0, &macaddr, macsize);
}
close(sock);
}
static int read_tun(char* data, int size)
{
if (tunfd < 0)
return -1;
int rv = read(tunfd, data, size);
if (rv < 0) {
if (errno == EAGAIN)
return -1;
if (errno == EBADFD)
return -1;
exit(1);
}
return rv;
}
static void flush_tun()
{
char data[SYZ_TUN_MAX_PACKET_SIZE];
while (read_tun(&data[0], sizeof(data)) != -1) {
}
}
#define XT_TABLE_SIZE 1536
#define XT_MAX_ENTRIES 10
struct xt_counters {
uint64_t pcnt, bcnt;
};
struct ipt_getinfo {
char name[32];
unsigned int valid_hooks;
unsigned int hook_entry[5];
unsigned int underflow[5];
unsigned int num_entries;
unsigned int size;
};
struct ipt_get_entries {
char name[32];
unsigned int size;
void* entrytable[XT_TABLE_SIZE / sizeof(void*)];
};
struct ipt_replace {
char name[32];
unsigned int valid_hooks;
unsigned int num_entries;
unsigned int size;
unsigned int hook_entry[5];
unsigned int underflow[5];
unsigned int num_counters;
struct xt_counters* counters;
char entrytable[XT_TABLE_SIZE];
};
struct ipt_table_desc {
const char* name;
struct ipt_getinfo info;
struct ipt_replace replace;
};
static struct ipt_table_desc ipv4_tables[] = {
{.name = "filter"}, {.name = "nat"}, {.name = "mangle"},
{.name = "raw"}, {.name = "security"},
};
static struct ipt_table_desc ipv6_tables[] = {
{.name = "filter"}, {.name = "nat"}, {.name = "mangle"},
{.name = "raw"}, {.name = "security"},
};
#define IPT_BASE_CTL 64
#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
#define IPT_SO_GET_INFO (IPT_BASE_CTL)
#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1)
struct arpt_getinfo {
char name[32];
unsigned int valid_hooks;
unsigned int hook_entry[3];
unsigned int underflow[3];
unsigned int num_entries;
unsigned int size;
};
struct arpt_get_entries {
char name[32];
unsigned int size;
void* entrytable[XT_TABLE_SIZE / sizeof(void*)];
};
struct arpt_replace {
char name[32];
unsigned int valid_hooks;
unsigned int num_entries;
unsigned int size;
unsigned int hook_entry[3];
unsigned int underflow[3];
unsigned int num_counters;
struct xt_counters* counters;
char entrytable[XT_TABLE_SIZE];
};
struct arpt_table_desc {
const char* name;
struct arpt_getinfo info;
struct arpt_replace replace;
};
static struct arpt_table_desc arpt_tables[] = {
{.name = "filter"},
};
#define ARPT_BASE_CTL 96
#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL)
#define ARPT_SO_GET_INFO (ARPT_BASE_CTL)
#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1)
static void checkpoint_iptables(struct ipt_table_desc* tables, int num_tables,
int family, int level)
{
struct ipt_get_entries entries;
socklen_t optlen;
int fd, i;
fd = socket(family, SOCK_STREAM, IPPROTO_TCP);
if (fd == -1) {
switch (errno) {
case EAFNOSUPPORT:
case ENOPROTOOPT:
return;
}
exit(1);
}
for (i = 0; i < num_tables; i++) {
struct ipt_table_desc* table = &tables[i];
strcpy(table->info.name, table->name);
strcpy(table->replace.name, table->name);
optlen = sizeof(table->info);
if (getsockopt(fd, level, IPT_SO_GET_INFO, &table->info, &optlen)) {
switch (errno) {
case EPERM:
case ENOENT:
case ENOPROTOOPT:
continue;
}
exit(1);
}
if (table->info.size > sizeof(table->replace.entrytable))
exit(1);
if (table->info.num_entries > XT_MAX_ENTRIES)
exit(1);
memset(&entries, 0, sizeof(entries));
strcpy(entries.name, table->name);
entries.size = table->info.size;
optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size;
if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen))
exit(1);
table->replace.valid_hooks = table->info.valid_hooks;
table->replace.num_entries = table->info.num_entries;
table->replace.size = table->info.size;
memcpy(table->replace.hook_entry, table->info.hook_entry,
sizeof(table->replace.hook_entry));
memcpy(table->replace.underflow, table->info.underflow,
sizeof(table->replace.underflow));
memcpy(table->replace.entrytable, entries.entrytable, table->info.size);
}
close(fd);
}
static void reset_iptables(struct ipt_table_desc* tables, int num_tables,
int family, int level)
{
struct xt_counters counters[XT_MAX_ENTRIES];
struct ipt_get_entries entries;
struct ipt_getinfo info;
socklen_t optlen;
int fd, i;
fd = socket(family, SOCK_STREAM, IPPROTO_TCP);
if (fd == -1) {
switch (errno) {
case EAFNOSUPPORT:
case ENOPROTOOPT:
return;
}
exit(1);
}
for (i = 0; i < num_tables; i++) {
struct ipt_table_desc* table = &tables[i];
if (table->info.valid_hooks == 0)
continue;
memset(&info, 0, sizeof(info));
strcpy(info.name, table->name);
optlen = sizeof(info);
if (getsockopt(fd, level, IPT_SO_GET_INFO, &info, &optlen))
exit(1);
if (memcmp(&table->info, &info, sizeof(table->info)) == 0) {
memset(&entries, 0, sizeof(entries));
strcpy(entries.name, table->name);
entries.size = table->info.size;
optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size;
if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen))
exit(1);
if (memcmp(table->replace.entrytable, entries.entrytable,
table->info.size) == 0)
continue;
}
table->replace.num_counters = info.num_entries;
table->replace.counters = counters;
optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) +
table->replace.size;
if (setsockopt(fd, level, IPT_SO_SET_REPLACE, &table->replace, optlen))
exit(1);
}
close(fd);
}
static void checkpoint_arptables(void)
{
struct arpt_get_entries entries;
socklen_t optlen;
unsigned i;
int fd;
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd == -1) {
switch (errno) {
case EAFNOSUPPORT:
case ENOPROTOOPT:
return;
}
exit(1);
}
for (i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) {
struct arpt_table_desc* table = &arpt_tables[i];
strcpy(table->info.name, table->name);
strcpy(table->replace.name, table->name);
optlen = sizeof(table->info);
if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &table->info, &optlen)) {
switch (errno) {
case EPERM:
case ENOENT:
case ENOPROTOOPT:
continue;
}
exit(1);
}
if (table->info.size > sizeof(table->replace.entrytable))
exit(1);
if (table->info.num_entries > XT_MAX_ENTRIES)
exit(1);
memset(&entries, 0, sizeof(entries));
strcpy(entries.name, table->name);
entries.size = table->info.size;
optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size;
if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen))
exit(1);
table->replace.valid_hooks = table->info.valid_hooks;
table->replace.num_entries = table->info.num_entries;
table->replace.size = table->info.size;
memcpy(table->replace.hook_entry, table->info.hook_entry,
sizeof(table->replace.hook_entry));
memcpy(table->replace.underflow, table->info.underflow,
sizeof(table->replace.underflow));
memcpy(table->replace.entrytable, entries.entrytable, table->info.size);
}
close(fd);
}
static void reset_arptables()
{
struct xt_counters counters[XT_MAX_ENTRIES];
struct arpt_get_entries entries;
struct arpt_getinfo info;
socklen_t optlen;
unsigned i;
int fd;
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd == -1) {
switch (errno) {
case EAFNOSUPPORT:
case ENOPROTOOPT:
return;
}
exit(1);
}
for (i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) {
struct arpt_table_desc* table = &arpt_tables[i];
if (table->info.valid_hooks == 0)
continue;
memset(&info, 0, sizeof(info));
strcpy(info.name, table->name);
optlen = sizeof(info);
if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &info, &optlen))
exit(1);
if (memcmp(&table->info, &info, sizeof(table->info)) == 0) {
memset(&entries, 0, sizeof(entries));
strcpy(entries.name, table->name);
entries.size = table->info.size;
optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size;
if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen))
exit(1);
if (memcmp(table->replace.entrytable, entries.entrytable,
table->info.size) == 0)
continue;
} else {
}
table->replace.num_counters = info.num_entries;
table->replace.counters = counters;
optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) +
table->replace.size;
if (setsockopt(fd, SOL_IP, ARPT_SO_SET_REPLACE, &table->replace, optlen))
exit(1);
}
close(fd);
}
#define NF_BR_NUMHOOKS 6
#define EBT_TABLE_MAXNAMELEN 32
#define EBT_CHAIN_MAXNAMELEN 32
#define EBT_BASE_CTL 128
#define EBT_SO_SET_ENTRIES (EBT_BASE_CTL)
#define EBT_SO_GET_INFO (EBT_BASE_CTL)
#define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO + 1)
#define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES + 1)
#define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO + 1)
struct ebt_replace {
char name[EBT_TABLE_MAXNAMELEN];
unsigned int valid_hooks;
unsigned int nentries;
unsigned int entries_size;
struct ebt_entries* hook_entry[NF_BR_NUMHOOKS];
unsigned int num_counters;
struct ebt_counter* counters;
char* entries;
};
struct ebt_entries {
unsigned int distinguisher;
char name[EBT_CHAIN_MAXNAMELEN];
unsigned int counter_offset;
int policy;
unsigned int nentries;
char data[0] __attribute__((aligned(__alignof__(struct ebt_replace))));
};
struct ebt_table_desc {
const char* name;
struct ebt_replace replace;
char entrytable[XT_TABLE_SIZE];
};
static struct ebt_table_desc ebt_tables[] = {
{.name = "filter"},
{.name = "nat"},
{.name = "broute"},
};
static void checkpoint_ebtables(void)
{
socklen_t optlen;
unsigned i;
int fd;
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd == -1) {
switch (errno) {
case EAFNOSUPPORT:
case ENOPROTOOPT:
return;
}
exit(1);
}
for (i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) {
struct ebt_table_desc* table = &ebt_tables[i];
strcpy(table->replace.name, table->name);
optlen = sizeof(table->replace);
if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_INFO, &table->replace,
&optlen)) {
switch (errno) {
case EPERM:
case ENOENT:
case ENOPROTOOPT:
continue;
}
exit(1);
}
if (table->replace.entries_size > sizeof(table->entrytable))
exit(1);
table->replace.num_counters = 0;
table->replace.entries = table->entrytable;
optlen = sizeof(table->replace) + table->replace.entries_size;
if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_ENTRIES, &table->replace,
&optlen))
exit(1);
}
close(fd);
}
static void reset_ebtables()
{
struct ebt_replace replace;
char entrytable[XT_TABLE_SIZE];
socklen_t optlen;
unsigned i, j, h;
int fd;
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd == -1) {
switch (errno) {
case EAFNOSUPPORT:
case ENOPROTOOPT:
return;
}
exit(1);
}
for (i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) {
struct ebt_table_desc* table = &ebt_tables[i];
if (table->replace.valid_hooks == 0)
continue;
memset(&replace, 0, sizeof(replace));
strcpy(replace.name, table->name);
optlen = sizeof(replace);
if (getsockopt(fd, SOL_IP, EBT_SO_GET_INFO, &replace, &optlen))
exit(1);
replace.num_counters = 0;
table->replace.entries = 0;
for (h = 0; h < NF_BR_NUMHOOKS; h++)
table->replace.hook_entry[h] = 0;
if (memcmp(&table->replace, &replace, sizeof(table->replace)) == 0) {
memset(&entrytable, 0, sizeof(entrytable));
replace.entries = entrytable;
optlen = sizeof(replace) + replace.entries_size;
if (getsockopt(fd, SOL_IP, EBT_SO_GET_ENTRIES, &replace, &optlen))
exit(1);
if (memcmp(table->entrytable, entrytable, replace.entries_size) == 0)
continue;
}
for (j = 0, h = 0; h < NF_BR_NUMHOOKS; h++) {
if (table->replace.valid_hooks & (1 << h)) {
table->replace.hook_entry[h] =
(struct ebt_entries*)table->entrytable + j;
j++;
}
}
table->replace.entries = table->entrytable;
optlen = sizeof(table->replace) + table->replace.entries_size;
if (setsockopt(fd, SOL_IP, EBT_SO_SET_ENTRIES, &table->replace, optlen))
exit(1);
}
close(fd);
}
static void checkpoint_net_namespace(void)
{
checkpoint_ebtables();
checkpoint_arptables();
checkpoint_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]),
AF_INET, SOL_IP);
checkpoint_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]),
AF_INET6, SOL_IPV6);
}
static void reset_net_namespace(void)
{
reset_ebtables();
reset_arptables();
reset_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]),
AF_INET, SOL_IP);
reset_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]),
AF_INET6, SOL_IPV6);
}
static void setup_cgroups()
{
if (mkdir("/syzcgroup", 0777)) {
}
if (mkdir("/syzcgroup/unified", 0777)) {
}
if (mount("none", "/syzcgroup/unified", "cgroup2", 0, NULL)) {
}
if (chmod("/syzcgroup/unified", 0777)) {
}
write_file("/syzcgroup/unified/cgroup.subtree_control",
"+cpu +memory +io +pids +rdma");
if (mkdir("/syzcgroup/cpu", 0777)) {
}
if (mount("none", "/syzcgroup/cpu", "cgroup", 0,
"cpuset,cpuacct,perf_event,hugetlb")) {
}
write_file("/syzcgroup/cpu/cgroup.clone_children", "1");
if (chmod("/syzcgroup/cpu", 0777)) {
}
if (mkdir("/syzcgroup/net", 0777)) {
}
if (mount("none", "/syzcgroup/net", "cgroup", 0,
"net_cls,net_prio,devices,freezer")) {
}
if (chmod("/syzcgroup/net", 0777)) {
}
}
static void setup_binfmt_misc()
{
if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0)) {
}
write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:\x01::./file0:");
write_file("/proc/sys/fs/binfmt_misc/register",
":syz1:M:1:\x02::./file0:POC");
}
static void setup_common()
{
if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) {
}
setup_cgroups();
setup_binfmt_misc();
}
static void loop();
static void sandbox_common()
{
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
setpgrp();
setsid();
struct rlimit rlim;
rlim.rlim_cur = rlim.rlim_max = 200 << 20;
setrlimit(RLIMIT_AS, &rlim);
rlim.rlim_cur = rlim.rlim_max = 32 << 20;
setrlimit(RLIMIT_MEMLOCK, &rlim);
rlim.rlim_cur = rlim.rlim_max = 136 << 20;
setrlimit(RLIMIT_FSIZE, &rlim);
rlim.rlim_cur = rlim.rlim_max = 1 << 20;
setrlimit(RLIMIT_STACK, &rlim);
rlim.rlim_cur = rlim.rlim_max = 0;
setrlimit(RLIMIT_CORE, &rlim);
rlim.rlim_cur = rlim.rlim_max = 256;
setrlimit(RLIMIT_NOFILE, &rlim);
if (unshare(CLONE_NEWNS)) {
}
if (unshare(CLONE_NEWIPC)) {
}
if (unshare(0x02000000)) {
}
if (unshare(CLONE_NEWUTS)) {
}
if (unshare(CLONE_SYSVSEM)) {
}
typedef struct {
const char* name;
const char* value;
} sysctl_t;
static const sysctl_t sysctls[] = {
{"/proc/sys/kernel/shmmax", "16777216"},
{"/proc/sys/kernel/shmall", "536870912"},
{"/proc/sys/kernel/shmmni", "1024"},
{"/proc/sys/kernel/msgmax", "8192"},
{"/proc/sys/kernel/msgmni", "1024"},
{"/proc/sys/kernel/msgmnb", "1024"},
{"/proc/sys/kernel/sem", "1024 1048576 500 1024"},
};
unsigned i;
for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++)
write_file(sysctls[i].name, sysctls[i].value);
}
int wait_for_loop(int pid)
{
if (pid < 0)
exit(1);
int status = 0;
while (waitpid(-1, &status, __WALL) != pid) {
}
return WEXITSTATUS(status);
}
static int do_sandbox_none(void)
{
if (unshare(CLONE_NEWPID)) {
}
int pid = fork();
if (pid != 0)
return wait_for_loop(pid);
setup_common();
sandbox_common();
initialize_netdevices_init();
if (unshare(CLONE_NEWNET)) {
}
initialize_tun();
initialize_netdevices();
loop();
exit(1);
}
#define FS_IOC_SETFLAGS _IOW('f', 2, long)
static void remove_dir(const char* dir)
{
DIR* dp;
struct dirent* ep;
int iter = 0;
retry:
while (umount2(dir, MNT_DETACH) == 0) {
}
dp = opendir(dir);
if (dp == NULL) {
if (errno == EMFILE) {
exit(1);
}
exit(1);
}
while ((ep = readdir(dp))) {
if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0)
continue;
char filename[FILENAME_MAX];
snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name);
while (umount2(filename, MNT_DETACH) == 0) {
}
struct stat st;
if (lstat(filename, &st))
exit(1);
if (S_ISDIR(st.st_mode)) {
remove_dir(filename);
continue;
}
int i;
for (i = 0;; i++) {
if (unlink(filename) == 0)
break;
if (errno == EPERM) {
int fd = open(filename, O_RDONLY);
if (fd != -1) {
long flags = 0;
if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0)
close(fd);
continue;
}
}
if (errno == EROFS) {
break;
}
if (errno != EBUSY || i > 100)
exit(1);
if (umount2(filename, MNT_DETACH))
exit(1);
}
}
closedir(dp);
int i;
for (i = 0;; i++) {
if (rmdir(dir) == 0)
break;
if (i < 100) {
if (errno == EPERM) {
int fd = open(dir, O_RDONLY);
if (fd != -1) {
long flags = 0;
if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0)
close(fd);
continue;
}
}
if (errno == EROFS) {
break;
}
if (errno == EBUSY) {
if (umount2(dir, MNT_DETACH))
exit(1);
continue;
}
if (errno == ENOTEMPTY) {
if (iter < 100) {
iter++;
goto retry;
}
}
}
exit(1);
}
}
static void kill_and_wait(int pid, int* status)
{
kill(-pid, SIGKILL);
kill(pid, SIGKILL);
int i;
for (i = 0; i < 100; i++) {
if (waitpid(-1, status, WNOHANG | __WALL) == pid)
return;
usleep(1000);
}
DIR* dir = opendir("/sys/fs/fuse/connections");
if (dir) {
for (;;) {
struct dirent* ent = readdir(dir);
if (!ent)
break;
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
continue;
char abort[300];
snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort",
ent->d_name);
int fd = open(abort, O_WRONLY);
if (fd == -1) {
continue;
}
if (write(fd, abort, 1) < 0) {
}
close(fd);
}
closedir(dir);
} else {
}
while (waitpid(-1, status, __WALL) != pid) {
}
}
#define SYZ_HAVE_SETUP_LOOP 1
static void setup_loop()
{
int pid = getpid();
char cgroupdir[64];
char file[128];
snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid);
if (mkdir(cgroupdir, 0777)) {
}
snprintf(file, sizeof(file), "%s/pids.max", cgroupdir);
write_file(file, "32");
snprintf(file, sizeof(file), "%s/memory.low", cgroupdir);
write_file(file, "%d", 298 << 20);
snprintf(file, sizeof(file), "%s/memory.high", cgroupdir);
write_file(file, "%d", 299 << 20);
snprintf(file, sizeof(file), "%s/memory.max", cgroupdir);
write_file(file, "%d", 300 << 20);
snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir);
write_file(file, "%d", pid);
snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid);
if (mkdir(cgroupdir, 0777)) {
}
snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir);
write_file(file, "%d", pid);
snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid);
if (mkdir(cgroupdir, 0777)) {
}
snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir);
write_file(file, "%d", pid);
checkpoint_net_namespace();
}
#define SYZ_HAVE_RESET_LOOP 1
static void reset_loop()
{
reset_net_namespace();
}
#define SYZ_HAVE_SETUP_TEST 1
static void setup_test()
{
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
setpgrp();
char cgroupdir[64];
snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid);
if (symlink(cgroupdir, "./cgroup")) {
}
snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid);
if (symlink(cgroupdir, "./cgroup.cpu")) {
}
snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid);
if (symlink(cgroupdir, "./cgroup.net")) {
}
write_file("/proc/self/oom_score_adj", "1000");
flush_tun();
}
#define SYZ_HAVE_RESET_TEST 1
static void reset_test()
{
int fd;
for (fd = 3; fd < 30; fd++)
close(fd);
}
struct thread_t {
int created, call;
event_t ready, done;
};
static struct thread_t threads[16];
static void execute_call(int call);
static int running;
static void* thr(void* arg)
{
struct thread_t* th = (struct thread_t*)arg;
for (;;) {
event_wait(&th->ready);
event_reset(&th->ready);
execute_call(th->call);
__atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED);
event_set(&th->done);
}
return 0;
}
static void execute_one(void)
{
int i, call, thread;
int collide = 0;
again:
for (call = 0; call < 6; call++) {
for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0]));
thread++) {
struct thread_t* th = &threads[thread];
if (!th->created) {
th->created = 1;
event_init(&th->ready);
event_init(&th->done);
event_set(&th->done);
thread_start(thr, th);
}
if (!event_isset(&th->done))
continue;
event_reset(&th->done);
th->call = call;
__atomic_fetch_add(&running, 1, __ATOMIC_RELAXED);
event_set(&th->ready);
if (collide && (call % 2) == 0)
break;
event_timedwait(&th->done, 45);
break;
}
}
for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++)
sleep_ms(1);
if (!collide) {
collide = 1;
goto again;
}
}
static void execute_one(void);
#define WAIT_FLAGS __WALL
static void loop(void)
{
setup_loop();
int iter;
for (iter = 0;; iter++) {
char cwdbuf[32];
sprintf(cwdbuf, "./%d", iter);
if (mkdir(cwdbuf, 0777))
exit(1);
reset_loop();
int pid = fork();
if (pid < 0)
exit(1);
if (pid == 0) {
if (chdir(cwdbuf))
exit(1);
setup_test();
execute_one();
reset_test();
exit(0);
}
int status = 0;
uint64_t start = current_time_ms();
for (;;) {
if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
break;
sleep_ms(1);
if (current_time_ms() - start < 5 * 1000)
continue;
kill_and_wait(pid, &status);
break;
}
remove_dir(cwdbuf);
}
}
uint64_t r[1] = {0xffffffffffffffff};
void execute_call(int call)
{
long res;
switch (call) {
case 0:
syscall(__NR_socket, 0xf, 3, 2);
break;
case 1:
res = syscall(__NR_socket, 0xa, 2, 0);
if (res != -1)
r[0] = res;
break;
case 2:
NONFAILING(*(uint16_t*)0x20000200 = 0xa);
NONFAILING(*(uint16_t*)0x20000202 = htobe16(0));
NONFAILING(*(uint32_t*)0x20000204 = 0);
NONFAILING(*(uint8_t*)0x20000208 = 0xfe);
NONFAILING(*(uint8_t*)0x20000209 = 0x80);
NONFAILING(*(uint8_t*)0x2000020a = 0);
NONFAILING(*(uint8_t*)0x2000020b = 0);
NONFAILING(*(uint8_t*)0x2000020c = 0);
NONFAILING(*(uint8_t*)0x2000020d = 0);
NONFAILING(*(uint8_t*)0x2000020e = 0);
NONFAILING(*(uint8_t*)0x2000020f = 0);
NONFAILING(*(uint8_t*)0x20000210 = 0);
NONFAILING(*(uint8_t*)0x20000211 = 0);
NONFAILING(*(uint8_t*)0x20000212 = 0);
NONFAILING(*(uint8_t*)0x20000213 = 0);
NONFAILING(*(uint8_t*)0x20000214 = 0);
NONFAILING(*(uint8_t*)0x20000215 = 0);
NONFAILING(*(uint8_t*)0x20000216 = 0);
NONFAILING(*(uint8_t*)0x20000217 = 0x13);
NONFAILING(*(uint32_t*)0x20000218 = 1);
syscall(__NR_connect, r[0], 0x20000200, 0x1c);
break;
case 3:
syscall(__NR_setsockopt, r[0], 0x29, 0x23, 0, 0);
break;
case 4:
NONFAILING(*(uint16_t*)0x20000140 = 0xa);
NONFAILING(*(uint16_t*)0x20000142 = htobe16(-1));
NONFAILING(*(uint32_t*)0x20000144 = 0);
NONFAILING(*(uint8_t*)0x20000148 = 0);
NONFAILING(*(uint8_t*)0x20000149 = 0);
NONFAILING(*(uint8_t*)0x2000014a = 0);
NONFAILING(*(uint8_t*)0x2000014b = 0);
NONFAILING(*(uint8_t*)0x2000014c = 0);
NONFAILING(*(uint8_t*)0x2000014d = 0);
NONFAILING(*(uint8_t*)0x2000014e = 0);
NONFAILING(*(uint8_t*)0x2000014f = 0);
NONFAILING(*(uint8_t*)0x20000150 = 0);
NONFAILING(*(uint8_t*)0x20000151 = 0);
NONFAILING(*(uint8_t*)0x20000152 = -1);
NONFAILING(*(uint8_t*)0x20000153 = -1);
NONFAILING(*(uint8_t*)0x20000154 = 0xac);
NONFAILING(*(uint8_t*)0x20000155 = 0x14);
NONFAILING(*(uint8_t*)0x20000156 = 0x14);
NONFAILING(*(uint8_t*)0x20000157 = 0x18);
NONFAILING(*(uint32_t*)0x20000158 = 0);
syscall(__NR_connect, r[0], 0x20000140, 0x1c);
break;
case 5:
syscall(__NR_sendmmsg, r[0], 0x20000240, 0x5c3, 0);
break;
}
}
int main(void)
{
syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
install_segv_handler();
for (procid = 0; procid < 6; procid++) {
if (fork() == 0) {
use_temporary_dir();
do_sandbox_none();
}
}
sleep(1000000);
return 0;
}
|
the_stack_data/61285.c | /* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
Contributed by Paul Eggert ([email protected]).
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to [email protected].
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Define this to have a standalone program to test this implementation of
mktime. */
/* #define DEBUG 1 */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/* Assume that leap seconds are possible, unless told otherwise.
If the host has a `zic' command with a `-L leapsecondfilename' option,
then it supports leap seconds; otherwise it probably doesn't. */
#ifndef LEAP_SECONDS_POSSIBLE
#define LEAP_SECONDS_POSSIBLE 1
#endif
#include <sys/types.h> /* Some systems define `time_t' here. */
#include <time.h>
#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS
#include <limits.h>
#endif
#if DEBUG
#include <stdio.h>
#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS
#include <stdlib.h>
#endif
/* Make it work even if the system's libc has its own mktime routine. */
#define mktime my_mktime
#endif /* DEBUG */
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#else
#define __P(args) ()
#endif /* GCC. */
#endif /* Not __P. */
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
#ifndef INT_MIN
#define INT_MIN (~0 << (sizeof (int) * CHAR_BIT - 1))
#endif
#ifndef INT_MAX
#define INT_MAX (~0 - INT_MIN)
#endif
#ifndef TIME_T_MIN
#define TIME_T_MIN (0 < (time_t) -1 ? (time_t) 0 \
: ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))
#endif
#ifndef TIME_T_MAX
#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
#endif
#define TM_YEAR_BASE 1900
#define EPOCH_YEAR 1970
#ifndef __isleap
/* Nonzero if YEAR is a leap year (every 4 years,
except every 100th isn't, and every 400th is). */
#define __isleap(year) \
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
#endif
/* How many days come before each month (0-12). */
const unsigned short int __mon_yday[2][13] =
{
/* Normal years. */
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
/* Leap years. */
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
};
static time_t ydhms_tm_diff __P ((int, int, int, int, int, const struct tm *));
time_t __mktime_internal __P ((struct tm *,
struct tm *(*) (const time_t *, struct tm *),
time_t *));
#if ! HAVE_LOCALTIME_R && ! defined (localtime_r)
#ifdef _LIBC
#define localtime_r __localtime_r
#else
/* Approximate localtime_r as best we can in its absence. */
#define localtime_r my_localtime_r
static struct tm *localtime_r __P ((const time_t *, struct tm *));
static struct tm *
localtime_r (t, tp)
const time_t *t;
struct tm *tp;
{
struct tm *l = localtime (t);
if (! l)
return 0;
*tp = *l;
return tp;
}
#endif /* ! _LIBC */
#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
/* Yield the difference between (YEAR-YDAY HOUR:MIN:SEC) and (*TP),
measured in seconds, ignoring leap seconds.
YEAR uses the same numbering as TM->tm_year.
All values are in range, except possibly YEAR.
If overflow occurs, yield the low order bits of the correct answer. */
static time_t
ydhms_tm_diff (year, yday, hour, min, sec, tp)
int year, yday, hour, min, sec;
const struct tm *tp;
{
time_t ay = year + (time_t) (TM_YEAR_BASE - 1);
time_t by = tp->tm_year + (time_t) (TM_YEAR_BASE - 1);
time_t intervening_leap_days =
(ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
time_t years = ay - by;
time_t days = (365 * years + intervening_leap_days
+ (yday - tp->tm_yday));
return (60 * (60 * (24 * days + (hour - tp->tm_hour))
+ (min - tp->tm_min))
+ (sec - tp->tm_sec));
}
/* Convert *TP to a time_t value. */
time_t
mktime (tp)
struct tm *tp;
{
static time_t localtime_offset;
return __mktime_internal (tp, localtime_r, &localtime_offset);
}
/* Convert *TP to a time_t value, inverting
the monotonic and mostly-unit-linear conversion function CONVERT.
Use *OFFSET to keep track of a guess at the offset of the result,
compared to what the result would be for UTC without leap seconds.
If *OFFSET's guess is correct, only one CONVERT call is needed. */
time_t
__mktime_internal (tp, convert, offset)
struct tm *tp;
struct tm *(*convert) __P ((const time_t *, struct tm *));
time_t *offset;
{
time_t t, dt, t0;
struct tm tm;
/* The maximum number of probes (calls to CONVERT) should be enough
to handle any combinations of time zone rule changes, solar time,
and leap seconds. Posix.1 prohibits leap seconds, but some hosts
have them anyway. */
int remaining_probes = 4;
/* Time requested. Copy it in case CONVERT modifies *TP; this can
occur if TP is localtime's returned value and CONVERT is localtime. */
int sec = tp->tm_sec;
int min = tp->tm_min;
int hour = tp->tm_hour;
int mday = tp->tm_mday;
int mon = tp->tm_mon;
int year_requested = tp->tm_year;
int isdst = tp->tm_isdst;
/* Ensure that mon is in range, and set year accordingly. */
int mon_remainder = mon % 12;
int negative_mon_remainder = mon_remainder < 0;
int mon_years = mon / 12 - negative_mon_remainder;
int year = year_requested + mon_years;
/* The other values need not be in range:
the remaining code handles minor overflows correctly,
assuming int and time_t arithmetic wraps around.
Major overflows are caught at the end. */
/* Calculate day of year from year, month, and day of month.
The result need not be in range. */
int yday = ((__mon_yday[__isleap (year + TM_YEAR_BASE)]
[mon_remainder + 12 * negative_mon_remainder])
+ mday - 1);
#if LEAP_SECONDS_POSSIBLE
/* Handle out-of-range seconds specially,
since ydhms_tm_diff assumes every minute has 60 seconds. */
int sec_requested = sec;
if (sec < 0)
sec = 0;
if (59 < sec)
sec = 59;
#endif
/* Invert CONVERT by probing. First assume the same offset as last time.
Then repeatedly use the error to improve the guess. */
tm.tm_year = EPOCH_YEAR - TM_YEAR_BASE;
tm.tm_yday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
t0 = ydhms_tm_diff (year, yday, hour, min, sec, &tm);
for (t = t0 + *offset;
(dt = ydhms_tm_diff (year, yday, hour, min, sec, (*convert) (&t, &tm)));
t += dt)
if (--remaining_probes == 0)
return -1;
/* Check whether tm.tm_isdst has the requested value, if any. */
if (0 <= isdst && 0 <= tm.tm_isdst)
{
int dst_diff = (isdst != 0) - (tm.tm_isdst != 0);
if (dst_diff)
{
/* Move two hours in the direction indicated by the disagreement,
probe some more, and switch to a new time if found.
The largest known fallback due to daylight savings is two hours:
once, in Newfoundland, 1988-10-30 02:00 -> 00:00. */
time_t ot = t - 2 * 60 * 60 * dst_diff;
while (--remaining_probes != 0)
{
struct tm otm;
if (! (dt = ydhms_tm_diff (year, yday, hour, min, sec,
(*convert) (&ot, &otm))))
{
t = ot;
tm = otm;
break;
}
if ((ot += dt) == t)
break; /* Avoid a redundant probe. */
}
}
}
*offset = t - t0;
#if LEAP_SECONDS_POSSIBLE
if (sec_requested != tm.tm_sec)
{
/* Adjust time to reflect the tm_sec requested, not the normalized value.
Also, repair any damage from a false match due to a leap second. */
t += sec_requested - sec + (sec == 0 && tm.tm_sec == 60);
(*convert) (&t, &tm);
}
#endif
if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3)
{
/* time_t isn't large enough to rule out overflows in ydhms_tm_diff,
so check for major overflows. A gross check suffices,
since if t has overflowed, it is off by a multiple of
TIME_T_MAX - TIME_T_MIN + 1. So ignore any component of
the difference that is bounded by a small value. */
double dyear = (double) year_requested + mon_years - tm.tm_year;
double dday = 366 * dyear + mday;
double dsec = 60 * (60 * (24 * dday + hour) + min) + sec_requested;
if (TIME_T_MAX / 3 - TIME_T_MIN / 3 < (dsec < 0 ? - dsec : dsec))
return -1;
}
*tp = tm;
return t;
}
#ifdef weak_alias
weak_alias (mktime, timelocal)
#endif
#if DEBUG
static int
not_equal_tm (a, b)
struct tm *a;
struct tm *b;
{
return ((a->tm_sec ^ b->tm_sec)
| (a->tm_min ^ b->tm_min)
| (a->tm_hour ^ b->tm_hour)
| (a->tm_mday ^ b->tm_mday)
| (a->tm_mon ^ b->tm_mon)
| (a->tm_year ^ b->tm_year)
| (a->tm_mday ^ b->tm_mday)
| (a->tm_yday ^ b->tm_yday)
| (a->tm_isdst ^ b->tm_isdst));
}
static void
print_tm (tp)
struct tm *tp;
{
printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec,
tp->tm_yday, tp->tm_wday, tp->tm_isdst);
}
static int
check_result (tk, tmk, tl, tml)
time_t tk;
struct tm tmk;
time_t tl;
struct tm tml;
{
if (tk != tl || not_equal_tm (&tmk, &tml))
{
printf ("mktime (");
print_tm (&tmk);
printf (")\nyields (");
print_tm (&tml);
printf (") == %ld, should be %ld\n", (long) tl, (long) tk);
return 1;
}
return 0;
}
int
main (argc, argv)
int argc;
char **argv;
{
int status = 0;
struct tm tm, tmk, tml;
time_t tk, tl;
char trailer;
if ((argc == 3 || argc == 4)
&& (sscanf (argv[1], "%d-%d-%d%c",
&tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
== 3)
&& (sscanf (argv[2], "%d:%d:%d%c",
&tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
== 3))
{
tm.tm_year -= TM_YEAR_BASE;
tm.tm_mon--;
tm.tm_isdst = argc == 3 ? -1 : atoi (argv[3]);
tmk = tm;
tl = mktime (&tmk);
tml = *localtime (&tl);
printf ("mktime returns %ld == ", (long) tl);
print_tm (&tmk);
printf ("\n");
status = check_result (tl, tmk, tl, tml);
}
else if (argc == 4 || (argc == 5 && strcmp (argv[4], "-") == 0))
{
time_t from = atol (argv[1]);
time_t by = atol (argv[2]);
time_t to = atol (argv[3]);
if (argc == 4)
for (tl = from; tl <= to; tl += by)
{
tml = *localtime (&tl);
tmk = tml;
tk = mktime (&tmk);
status |= check_result (tk, tmk, tl, tml);
}
else
for (tl = from; tl <= to; tl += by)
{
/* Null benchmark. */
tml = *localtime (&tl);
tmk = tml;
tk = tl;
status |= check_result (tk, tmk, tl, tml);
}
}
else
printf ("Usage:\
\t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
\t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
\t%s FROM BY TO - # Do not test those values (for benchmark).\n",
argv[0], argv[0], argv[0]);
return status;
}
#endif /* DEBUG */
/*
Local Variables:
compile-command: "gcc -DDEBUG=1 -Wall -O -g mktime.c -o mktime"
End:
*/
|
the_stack_data/126703126.c | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
void __VERIFIER_assert(int cond) { if(!(cond)) { ERROR: __VERIFIER_error(); } }
#define N 100
int main( ) {
int a[N];
int i = 0;
int x;
int y;
while ( i < N ) {
int k = i;
int s = i + 1;
while ( k < N ) {
if ( a[k] > a[s] ) {
s = k;
}
k = k+1;
}
if ( s != i ) {
int tmp = a[s];
a[s] = a[i];
a[i] = tmp;
}
for ( x = 0 ; x < i ; x++ ) {
for ( y = x + 1 ; y < i ; y++ ) {
__VERIFIER_assert( a[x] <= a[y] );
}
}
for ( x = i+1 ; x < N ; x ++ ) {
__VERIFIER_assert( a[x] >= a[i] );
}
i = i+1;
}
for ( x = 0 ; x < N ; x++ ) {
for ( y = x + 1 ; y < N ; y++ ) {
__VERIFIER_assert( a[x] <= a[y] );
}
}
return 0;
}
|
the_stack_data/122014449.c | unsigned int my_sizeof(void input);
Armstrong();
Fibbonacci();
Little_Big_endian();
Swap_nibble();
swap_array();
|
the_stack_data/168894385.c | /* original parser id follows */
/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define YYCHECK "yyyymmdd"
#define YYEMPTY (-1)
#define yyclearin (yychar = YYEMPTY)
#define yyerrok (yyerrflag = 0)
#define YYRECOVERING() (yyerrflag != 0)
#define YYENOMEM (-2)
#define YYEOF 0
#undef YYBTYACC
#define YYBTYACC 0
#define YYDEBUGSTR YYPREFIX "debug"
#ifndef yyparse
#define yyparse empty_parse
#endif /* yyparse */
#ifndef yylex
#define yylex empty_lex
#endif /* yylex */
#ifndef yyerror
#define yyerror empty_error
#endif /* yyerror */
#ifndef yychar
#define yychar empty_char
#endif /* yychar */
#ifndef yyval
#define yyval empty_val
#endif /* yyval */
#ifndef yylval
#define yylval empty_lval
#endif /* yylval */
#ifndef yydebug
#define yydebug empty_debug
#endif /* yydebug */
#ifndef yynerrs
#define yynerrs empty_nerrs
#endif /* yynerrs */
#ifndef yyerrflag
#define yyerrflag empty_errflag
#endif /* yyerrflag */
#ifndef yylhs
#define yylhs empty_lhs
#endif /* yylhs */
#ifndef yylen
#define yylen empty_len
#endif /* yylen */
#ifndef yydefred
#define yydefred empty_defred
#endif /* yydefred */
#ifndef yystos
#define yystos empty_stos
#endif /* yystos */
#ifndef yydgoto
#define yydgoto empty_dgoto
#endif /* yydgoto */
#ifndef yysindex
#define yysindex empty_sindex
#endif /* yysindex */
#ifndef yyrindex
#define yyrindex empty_rindex
#endif /* yyrindex */
#ifndef yygindex
#define yygindex empty_gindex
#endif /* yygindex */
#ifndef yytable
#define yytable empty_table
#endif /* yytable */
#ifndef yycheck
#define yycheck empty_check
#endif /* yycheck */
#ifndef yyname
#define yyname empty_name
#endif /* yyname */
#ifndef yyrule
#define yyrule empty_rule
#endif /* yyrule */
#if YYBTYACC
#ifndef yycindex
#define yycindex empty_cindex
#endif /* yycindex */
#ifndef yyctable
#define yyctable empty_ctable
#endif /* yyctable */
#endif /* YYBTYACC */
#define YYPREFIX "empty_"
#define YYPURE 0
#line 2 "empty.y"
#ifdef YYBISON
#define YYLEX_DECL() yylex(void)
#define YYERROR_DECL() yyerror(const char *s)
static int YYLEX_DECL();
static void YYERROR_DECL();
#endif
#line 128 "empty.tab.c"
#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
/* Default: YYSTYPE is the semantic value type. */
typedef int YYSTYPE;
# define YYSTYPE_IS_DECLARED 1
#endif
/* compatibility with bison */
#ifdef YYPARSE_PARAM
/* compatibility with FreeBSD */
# ifdef YYPARSE_PARAM_TYPE
# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
# else
# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
# endif
#else
# define YYPARSE_DECL() yyparse(void)
#endif
/* Parameters sent to lex. */
#ifdef YYLEX_PARAM
# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
# define YYLEX yylex(YYLEX_PARAM)
#else
# define YYLEX_DECL() yylex(void)
# define YYLEX yylex()
#endif
/* Parameters sent to yyerror. */
#ifndef YYERROR_DECL
#define YYERROR_DECL() yyerror(const char *s)
#endif
#ifndef YYERROR_CALL
#define YYERROR_CALL(msg) yyerror(msg)
#endif
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
static const YYINT empty_lhs[] = { -1,
0,
};
static const YYINT empty_len[] = { 2,
0,
};
static const YYINT empty_defred[] = { 1,
0,
};
#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
static const YYINT empty_stos[] = { 0,
258,
};
#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
static const YYINT empty_dgoto[] = { 1,
};
static const YYINT empty_sindex[] = { 0,
0,
};
static const YYINT empty_rindex[] = { 0,
0,
};
#if YYBTYACC
static const YYINT empty_cindex[] = { 0,
0,
};
#endif
static const YYINT empty_gindex[] = { 0,
};
#define YYTABLESIZE 0
static const YYINT empty_table[] = { 0,
};
static const YYINT empty_check[] = { -1,
};
#if YYBTYACC
static const YYINT empty_ctable[] = { -1,
};
#endif
#define YYFINAL 1
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 256
#define YYUNDFTOKEN 259
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
#if YYDEBUG
static const char *const empty_name[] = {
"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","start",
"illegal-symbol",
};
static const char *const empty_rule[] = {
"$accept : start",
"start :",
};
#endif
int yydebug;
int yynerrs;
int yyerrflag;
int yychar;
YYSTYPE yyval;
YYSTYPE yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyloc; /* position returned by actions */
YYLTYPE yylloc; /* position from the lexer */
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
#ifndef YYLLOC_DEFAULT
#define YYLLOC_DEFAULT(loc, rhs, n) \
do \
{ \
if (n == 0) \
{ \
(loc).first_line = ((rhs)[-1]).last_line; \
(loc).first_column = ((rhs)[-1]).last_column; \
(loc).last_line = ((rhs)[-1]).last_line; \
(loc).last_column = ((rhs)[-1]).last_column; \
} \
else \
{ \
(loc).first_line = ((rhs)[ 0 ]).first_line; \
(loc).first_column = ((rhs)[ 0 ]).first_column; \
(loc).last_line = ((rhs)[n-1]).last_line; \
(loc).last_column = ((rhs)[n-1]).last_column; \
} \
} while (0)
#endif /* YYLLOC_DEFAULT */
#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
#if YYBTYACC
#ifndef YYLVQUEUEGROWTH
#define YYLVQUEUEGROWTH 32
#endif
#endif /* YYBTYACC */
/* define the initial stack-sizes */
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 10000
#define YYMAXDEPTH 10000
#endif
#endif
#ifndef YYINITSTACKSIZE
#define YYINITSTACKSIZE 200
#endif
typedef struct {
unsigned stacksize;
YYINT *s_base;
YYINT *s_mark;
YYINT *s_last;
YYSTYPE *l_base;
YYSTYPE *l_mark;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE *p_base;
YYLTYPE *p_mark;
#endif
} YYSTACKDATA;
#if YYBTYACC
struct YYParseState_s
{
struct YYParseState_s *save; /* Previously saved parser state */
YYSTACKDATA yystack; /* saved parser stack */
int state; /* saved parser state */
int errflag; /* saved error recovery status */
int lexeme; /* saved index of the conflict lexeme in the lexical queue */
YYINT ctry; /* saved index in yyctable[] for this conflict */
};
typedef struct YYParseState_s YYParseState;
#endif /* YYBTYACC */
/* variables for the parser stack */
static YYSTACKDATA yystack;
#if YYBTYACC
/* Current parser state */
static YYParseState *yyps = 0;
/* yypath != NULL: do the full parse, starting at *yypath parser state. */
static YYParseState *yypath = 0;
/* Base of the lexical value queue */
static YYSTYPE *yylvals = 0;
/* Current position at lexical value queue */
static YYSTYPE *yylvp = 0;
/* End position of lexical value queue */
static YYSTYPE *yylve = 0;
/* The last allocated position at the lexical value queue */
static YYSTYPE *yylvlim = 0;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* Base of the lexical position queue */
static YYLTYPE *yylpsns = 0;
/* Current position at lexical position queue */
static YYLTYPE *yylpp = 0;
/* End position of lexical position queue */
static YYLTYPE *yylpe = 0;
/* The last allocated position at the lexical position queue */
static YYLTYPE *yylplim = 0;
#endif
/* Current position at lexical token queue */
static YYINT *yylexp = 0;
static YYINT *yylexemes = 0;
#endif /* YYBTYACC */
#line 13 "empty.y"
#include <stdio.h>
static int
YYLEX_DECL() {
return -1;
}
static void
YYERROR_DECL() {
printf("%s\n",s);
}
#line 370 "empty.tab.c"
/* For use in generated program */
#define yydepth (int)(yystack.s_mark - yystack.s_base)
#if YYBTYACC
#define yytrial (yyps->save)
#endif /* YYBTYACC */
#if YYDEBUG
#include <stdio.h> /* needed for printf */
#endif
#include <stdlib.h> /* needed for malloc, etc */
#include <string.h> /* needed for memset */
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack(YYSTACKDATA *data)
{
int i;
unsigned newsize;
YYINT *newss;
YYSTYPE *newvs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE *newps;
#endif
if ((newsize = data->stacksize) == 0)
newsize = YYINITSTACKSIZE;
else if (newsize >= YYMAXDEPTH)
return YYENOMEM;
else if ((newsize *= 2) > YYMAXDEPTH)
newsize = YYMAXDEPTH;
i = (int) (data->s_mark - data->s_base);
newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return YYENOMEM;
data->s_base = newss;
data->s_mark = newss + i;
newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
if (newvs == 0)
return YYENOMEM;
data->l_base = newvs;
data->l_mark = newvs + i;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
if (newps == 0)
return YYENOMEM;
data->p_base = newps;
data->p_mark = newps + i;
#endif
data->stacksize = newsize;
data->s_last = data->s_base + newsize - 1;
#if YYDEBUG
if (yydebug)
fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
#endif
return 0;
}
#if YYPURE || defined(YY_NO_LEAKS)
static void yyfreestack(YYSTACKDATA *data)
{
free(data->s_base);
free(data->l_base);
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
free(data->p_base);
#endif
memset(data, 0, sizeof(*data));
}
#else
#define yyfreestack(data) /* nothing */
#endif /* YYPURE || defined(YY_NO_LEAKS) */
#if YYBTYACC
static YYParseState *
yyNewState(unsigned size)
{
YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
if (p == NULL) return NULL;
p->yystack.stacksize = size;
if (size == 0)
{
p->yystack.s_base = NULL;
p->yystack.l_base = NULL;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
p->yystack.p_base = NULL;
#endif
return p;
}
p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
if (p->yystack.s_base == NULL) return NULL;
p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
if (p->yystack.l_base == NULL) return NULL;
memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
if (p->yystack.p_base == NULL) return NULL;
memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
#endif
return p;
}
static void
yyFreeState(YYParseState *p)
{
yyfreestack(&p->yystack);
free(p);
}
#endif /* YYBTYACC */
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
#if YYBTYACC
#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
#define YYVALID_NESTED do { if (yyps->save && \
yyps->save->save == 0) goto yyvalid; } while(0)
#endif /* YYBTYACC */
int
YYPARSE_DECL()
{
int yym, yyn, yystate, yyresult;
#if YYBTYACC
int yynewerrflag;
YYParseState *yyerrctx = NULL;
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
#endif
#if YYDEBUG
const char *yys;
if ((yys = getenv("YYDEBUG")) != 0)
{
yyn = *yys;
if (yyn >= '0' && yyn <= '9')
yydebug = yyn - '0';
}
if (yydebug)
fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
#endif
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
#endif
#if YYBTYACC
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
yyps->save = 0;
#endif /* YYBTYACC */
yym = 0;
yyn = 0;
yynerrs = 0;
yyerrflag = 0;
yychar = YYEMPTY;
yystate = 0;
#if YYPURE
memset(&yystack, 0, sizeof(yystack));
#endif
if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
yystack.s_mark = yystack.s_base;
yystack.l_mark = yystack.l_base;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark = yystack.p_base;
#endif
yystate = 0;
*yystack.s_mark = 0;
yyloop:
if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
if (yychar < 0)
{
#if YYBTYACC
do {
if (yylvp < yylve)
{
/* we're currently re-reading tokens */
yylval = *yylvp++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylloc = *yylpp++;
#endif
yychar = *yylexp++;
break;
}
if (yyps->save)
{
/* in trial mode; save scanner results for future parse attempts */
if (yylvp == yylvlim)
{ /* Enlarge lexical value queue */
size_t p = (size_t) (yylvp - yylvals);
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylpp = yylpe = yylpsns + p;
yylplim = yylpsns + s;
#endif
yylexp = yylexemes + p;
}
*yylexp = (YYINT) YYLEX;
*yylvp++ = yylval;
yylve++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*yylpp++ = yylloc;
yylpe++;
#endif
yychar = *yylexp++;
break;
}
/* normal operation, no conflict encountered */
#endif /* YYBTYACC */
yychar = YYLEX;
#if YYBTYACC
} while (0);
#endif /* YYBTYACC */
if (yychar < 0) yychar = YYEOF;
#if YYDEBUG
if (yydebug)
{
if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
YYDEBUGSTR, yydepth, yystate, yychar, yys);
#ifdef YYSTYPE_TOSTRING
#if YYBTYACC
if (!yytrial)
#endif /* YYBTYACC */
fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
#endif
fputc('\n', stderr);
}
#endif
}
#if YYBTYACC
/* Do we have a conflict? */
if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
{
YYINT ctry;
if (yypath)
{
YYParseState *save;
#if YYDEBUG
if (yydebug)
fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
YYDEBUGSTR, yydepth, yystate);
#endif
/* Switch to the next conflict context */
save = yypath;
yypath = save->save;
save->save = NULL;
ctry = save->ctry;
if (save->state != yystate) YYABORT;
yyFreeState(save);
}
else
{
/* Unresolved conflict - start/continue trial parse */
YYParseState *save;
#if YYDEBUG
if (yydebug)
{
fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
if (yyps->save)
fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
else
fputs("Starting trial parse.\n", stderr);
}
#endif
save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
if (save == NULL) goto yyenomem;
save->save = yyps->save;
save->state = yystate;
save->errflag = yyerrflag;
save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
ctry = yytable[yyn];
if (yyctable[ctry] == -1)
{
#if YYDEBUG
if (yydebug && yychar >= YYEOF)
fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
#endif
ctry++;
}
save->ctry = ctry;
if (yyps->save == NULL)
{
/* If this is a first conflict in the stack, start saving lexemes */
if (!yylexemes)
{
yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
if (yylexemes == NULL) goto yyenomem;
yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
if (yylvals == NULL) goto yyenomem;
yylvlim = yylvals + YYLVQUEUEGROWTH;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
if (yylpsns == NULL) goto yyenomem;
yylplim = yylpsns + YYLVQUEUEGROWTH;
#endif
}
if (yylvp == yylve)
{
yylvp = yylve = yylvals;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylpp = yylpe = yylpsns;
#endif
yylexp = yylexemes;
if (yychar >= YYEOF)
{
*yylve++ = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*yylpe++ = yylloc;
#endif
*yylexp = (YYINT) yychar;
yychar = YYEMPTY;
}
}
}
if (yychar >= YYEOF)
{
yylvp--;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylpp--;
#endif
yylexp--;
yychar = YYEMPTY;
}
save->lexeme = (int) (yylvp - yylvals);
yyps->save = save;
}
if (yytable[yyn] == ctry)
{
#if YYDEBUG
if (yydebug)
fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
#endif
if (yychar < 0)
{
yylvp++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylpp++;
#endif
yylexp++;
}
if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
goto yyoverflow;
yystate = yyctable[ctry];
*++yystack.s_mark = (YYINT) yystate;
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*++yystack.p_mark = yylloc;
#endif
yychar = YYEMPTY;
if (yyerrflag > 0) --yyerrflag;
goto yyloop;
}
else
{
yyn = yyctable[ctry];
goto yyreduce;
}
} /* End of code dealing with conflicts */
#endif /* YYBTYACC */
if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
{
#if YYDEBUG
if (yydebug)
fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
#endif
if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
yystate = yytable[yyn];
*++yystack.s_mark = yytable[yyn];
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*++yystack.p_mark = yylloc;
#endif
yychar = YYEMPTY;
if (yyerrflag > 0) --yyerrflag;
goto yyloop;
}
if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
{
yyn = yytable[yyn];
goto yyreduce;
}
if (yyerrflag != 0) goto yyinrecovery;
#if YYBTYACC
yynewerrflag = 1;
goto yyerrhandler;
goto yyerrlab; /* redundant goto avoids 'unused label' warning */
yyerrlab:
/* explicit YYERROR from an action -- pop the rhs of the rule reduced
* before looking for error recovery */
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
yystack.l_mark -= yym;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark -= yym;
#endif
yynewerrflag = 0;
yyerrhandler:
while (yyps->save)
{
int ctry;
YYParseState *save = yyps->save;
#if YYDEBUG
if (yydebug)
fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
YYDEBUGSTR, yydepth, yystate, yyps->save->state,
(int)(yylvp - yylvals - yyps->save->lexeme));
#endif
/* Memorize most forward-looking error state in case it's really an error. */
if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
{
/* Free old saved error context state */
if (yyerrctx) yyFreeState(yyerrctx);
/* Create and fill out new saved error context state */
yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
if (yyerrctx == NULL) goto yyenomem;
yyerrctx->save = yyps->save;
yyerrctx->state = yystate;
yyerrctx->errflag = yyerrflag;
yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
yyerrctx->lexeme = (int) (yylvp - yylvals);
}
yylvp = yylvals + save->lexeme;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylpp = yylpsns + save->lexeme;
#endif
yylexp = yylexemes + save->lexeme;
yychar = YYEMPTY;
yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
ctry = ++save->ctry;
yystate = save->state;
/* We tried shift, try reduce now */
if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
yyps->save = save->save;
save->save = NULL;
yyFreeState(save);
/* Nothing left on the stack -- error */
if (!yyps->save)
{
#if YYDEBUG
if (yydebug)
fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
YYPREFIX, yydepth);
#endif
/* Restore state as it was in the most forward-advanced error */
yylvp = yylvals + yyerrctx->lexeme;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylpp = yylpsns + yyerrctx->lexeme;
#endif
yylexp = yylexemes + yyerrctx->lexeme;
yychar = yylexp[-1];
yylval = yylvp[-1];
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylloc = yylpp[-1];
#endif
yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
yystate = yyerrctx->state;
yyFreeState(yyerrctx);
yyerrctx = NULL;
}
yynewerrflag = 1;
}
if (yynewerrflag == 0) goto yyinrecovery;
#endif /* YYBTYACC */
YYERROR_CALL("syntax error");
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
#endif
#if !YYBTYACC
goto yyerrlab; /* redundant goto avoids 'unused label' warning */
yyerrlab:
#endif
++yynerrs;
yyinrecovery:
if (yyerrflag < 3)
{
yyerrflag = 3;
for (;;)
{
if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
{
#if YYDEBUG
if (yydebug)
fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
#endif
if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
yystate = yytable[yyn];
*++yystack.s_mark = yytable[yyn];
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* lookahead position is error end position */
yyerror_loc_range[1] = yylloc;
YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
*++yystack.p_mark = yyloc;
#endif
goto yyloop;
}
else
{
#if YYDEBUG
if (yydebug)
fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
YYDEBUGSTR, yydepth, *yystack.s_mark);
#endif
if (yystack.s_mark <= yystack.s_base) goto yyabort;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* the current TOS position is the error start position */
yyerror_loc_range[0] = *yystack.p_mark;
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
if (!yytrial)
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYDESTRUCT_CALL("error: discarding state",
yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
#else
YYDESTRUCT_CALL("error: discarding state",
yystos[*yystack.s_mark], yystack.l_mark);
#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
#endif /* defined(YYDESTRUCT_CALL) */
--yystack.s_mark;
--yystack.l_mark;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
--yystack.p_mark;
#endif
}
}
}
else
{
if (yychar == YYEOF) goto yyabort;
#if YYDEBUG
if (yydebug)
{
if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
YYDEBUGSTR, yydepth, yystate, yychar, yys);
}
#endif
#if defined(YYDESTRUCT_CALL)
#if YYBTYACC
if (!yytrial)
#endif /* YYBTYACC */
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
#else
YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
#endif /* defined(YYDESTRUCT_CALL) */
yychar = YYEMPTY;
goto yyloop;
}
yyreduce:
yym = yylen[yyn];
#if YYDEBUG
if (yydebug)
{
fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
#ifdef YYSTYPE_TOSTRING
#if YYBTYACC
if (!yytrial)
#endif /* YYBTYACC */
if (yym > 0)
{
int i;
fputc('<', stderr);
for (i = yym; i > 0; i--)
{
if (i != yym) fputs(", ", stderr);
fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
yystack.l_mark[1-i]), stderr);
}
fputc('>', stderr);
}
#endif
fputc('\n', stderr);
}
#endif
if (yym > 0)
yyval = yystack.l_mark[1-yym];
else
memset(&yyval, 0, sizeof yyval);
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
/* Perform position reduction */
memset(&yyloc, 0, sizeof(yyloc));
#if YYBTYACC
if (!yytrial)
#endif /* YYBTYACC */
{
YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
/* just in case YYERROR is invoked within the action, save
the start of the rhs as the error start position */
yyerror_loc_range[0] = yystack.p_mark[1-yym];
}
#endif
switch (yyn)
{
default:
break;
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
yystack.l_mark -= yym;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark -= yym;
#endif
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
#if YYDEBUG
if (yydebug)
{
fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
#ifdef YYSTYPE_TOSTRING
#if YYBTYACC
if (!yytrial)
#endif /* YYBTYACC */
fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
#endif
fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
}
#endif
yystate = YYFINAL;
*++yystack.s_mark = YYFINAL;
*++yystack.l_mark = yyval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*++yystack.p_mark = yyloc;
#endif
if (yychar < 0)
{
#if YYBTYACC
do {
if (yylvp < yylve)
{
/* we're currently re-reading tokens */
yylval = *yylvp++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylloc = *yylpp++;
#endif
yychar = *yylexp++;
break;
}
if (yyps->save)
{
/* in trial mode; save scanner results for future parse attempts */
if (yylvp == yylvlim)
{ /* Enlarge lexical value queue */
size_t p = (size_t) (yylvp - yylvals);
size_t s = (size_t) (yylvlim - yylvals);
s += YYLVQUEUEGROWTH;
if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
goto yyenomem;
if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
goto yyenomem;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
goto yyenomem;
#endif
yylvp = yylve = yylvals + p;
yylvlim = yylvals + s;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylpp = yylpe = yylpsns + p;
yylplim = yylpsns + s;
#endif
yylexp = yylexemes + p;
}
*yylexp = (YYINT) YYLEX;
*yylvp++ = yylval;
yylve++;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*yylpp++ = yylloc;
yylpe++;
#endif
yychar = *yylexp++;
break;
}
/* normal operation, no conflict encountered */
#endif /* YYBTYACC */
yychar = YYLEX;
#if YYBTYACC
} while (0);
#endif /* YYBTYACC */
if (yychar < 0) yychar = YYEOF;
#if YYDEBUG
if (yydebug)
{
if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
}
#endif
}
if (yychar == YYEOF) goto yyaccept;
goto yyloop;
}
if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
yystate = yytable[yyn];
else
yystate = yydgoto[yym];
#if YYDEBUG
if (yydebug)
{
fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
#ifdef YYSTYPE_TOSTRING
#if YYBTYACC
if (!yytrial)
#endif /* YYBTYACC */
fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
#endif
fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
}
#endif
if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
*++yystack.s_mark = (YYINT) yystate;
*++yystack.l_mark = yyval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*++yystack.p_mark = yyloc;
#endif
goto yyloop;
#if YYBTYACC
/* Reduction declares that this path is valid. Set yypath and do a full parse */
yyvalid:
if (yypath) YYABORT;
while (yyps->save)
{
YYParseState *save = yyps->save;
yyps->save = save->save;
save->save = yypath;
yypath = save;
}
#if YYDEBUG
if (yydebug)
fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
#endif
if (yyerrctx)
{
yyFreeState(yyerrctx);
yyerrctx = NULL;
}
yylvp = yylvals + yypath->lexeme;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yylpp = yylpsns + yypath->lexeme;
#endif
yylexp = yylexemes + yypath->lexeme;
yychar = YYEMPTY;
yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
#endif
yystate = yypath->state;
goto yyloop;
#endif /* YYBTYACC */
yyoverflow:
YYERROR_CALL("yacc stack overflow");
#if YYBTYACC
goto yyabort_nomem;
yyenomem:
YYERROR_CALL("memory exhausted");
yyabort_nomem:
#endif /* YYBTYACC */
yyresult = 2;
goto yyreturn;
yyabort:
yyresult = 1;
goto yyreturn;
yyaccept:
#if YYBTYACC
if (yyps->save) goto yyvalid;
#endif /* YYBTYACC */
yyresult = 0;
yyreturn:
#if defined(YYDESTRUCT_CALL)
if (yychar != YYEOF && yychar != YYEMPTY)
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
#else
YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
{
YYSTYPE *pv;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE *pp;
for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
YYDESTRUCT_CALL("cleanup: discarding state",
yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
#else
for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
YYDESTRUCT_CALL("cleanup: discarding state",
yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
}
#endif /* defined(YYDESTRUCT_CALL) */
#if YYBTYACC
if (yyerrctx)
{
yyFreeState(yyerrctx);
yyerrctx = NULL;
}
while (yyps)
{
YYParseState *save = yyps;
yyps = save->save;
save->save = NULL;
yyFreeState(save);
}
while (yypath)
{
YYParseState *save = yypath;
yypath = save->save;
save->save = NULL;
yyFreeState(save);
}
#endif /* YYBTYACC */
yyfreestack(&yystack);
return (yyresult);
}
|
the_stack_data/706980.c | #include<stdio.h>
#include<stdlib.h>
struct Slide
{
double condition;
double nSamples;
};
struct Scrap
{
struct Slide *slidesS2B;
struct Slide *slidesB2S;
int atS2B;
int atB2S;
struct Scrap* next;
};
struct Road
{
struct Scrap *scraps;
int first;
double nSamplesS2B;
double nSamplesB2S;
};
struct RoadList
{
struct Road *aRoad;
int rId;
int direction;
double nSamples;
struct RoadList *next;
};
struct RoadList * sort_road_by_trace(struct Road *roads)
{
struct RoadList *rtList = NULL, *newp, *bRoad, *dRoad;
int i;
for(i=0;i<35000; i++) {
if(roads[i].nSamplesS2B != 0) {
newp = (struct RoadList*)malloc(sizeof(struct RoadList));
if(newp == NULL) {
printf("No memory available!\n");
exit(-1);
}
newp->rId = i;
newp->aRoad = roads+i;
newp->direction = 0;
newp->nSamples = roads[i].nSamplesS2B;
newp->next = NULL;
if (rtList == NULL) {
rtList = newp;
} else {
bRoad = rtList;
while(bRoad->next!=NULL && bRoad->nSamples >= newp->nSamples) {
dRoad = bRoad;
bRoad = bRoad->next;
}
if(bRoad->nSamples < newp->nSamples) {
newp->next = bRoad;
if(bRoad == rtList) {
rtList = newp;
} else {
dRoad->next = newp;
}
} else {
newp->next = bRoad->next;
bRoad->next = newp;
}
}
}
if(roads[i].nSamplesB2S != 0) {
newp = (struct RoadList*)malloc(sizeof(struct RoadList));
if(newp == NULL) {
printf("No memory available!\n");
exit(-1);
}
newp->rId = i;
newp->aRoad = roads+i;
newp->direction = 1;
newp->nSamples = roads[i].nSamplesB2S;
newp->next = NULL;
if (rtList == NULL) {
rtList = newp;
} else {
bRoad = rtList;
while(bRoad->next!=NULL && bRoad->nSamples >= newp->nSamples) {
dRoad = bRoad;
bRoad = bRoad->next;
}
if(bRoad->nSamples < newp->nSamples) {
newp->next = bRoad;
if(bRoad == rtList) {
rtList = newp;
} else {
dRoad->next = newp;
}
} else {
newp->next = bRoad->next;
bRoad->next = newp;
}
}
}
}
return rtList;
}
int main(int argc, char**argv)
{
FILE *fdump;
struct Road *roads, *whichRoad, *lastRoad;
int i, j, rId, rDi, atS2B, atB2S, at, nSlides, first=1, files, nRoads, count;
char *buffer, *line, *p, *q;
struct RoadList *roadlist=NULL, *bRoad;
struct Scrap *newp, *whichScrap;
int lower=-1, upper=-1;
if(argc < 4) {
printf("Usage: %s nSlides nRoads dumpfile1 dumpfile2 ...\n", argv[0]);
exit(0);
}
nSlides=atoi(argv[1]);
nRoads=atoi(argv[2]);
files = argc-3;
buffer = (char*)malloc(32*(nSlides+1));
line = (char*)malloc(256);
roads = (struct Road*)malloc(sizeof(struct Road)*35000);
for (i=0; i<35000; i++) {
roads[i].scraps = NULL;
roads[i].first = 1;
roads[i].nSamplesS2B = 0;
roads[i].nSamplesB2S = 0;
}
argc -=3;
argv +=3;
whichRoad = NULL;
while(argc!=0) {
if((fdump=fopen(argv[0], "r"))==NULL) {
printf("Cannot open %s to read!\n", argv[0]);
exit(-1);
} else {
for (i=0;i<10;i++) {
fgets(line, 256, fdump);
}
while (fgetc(fdump)!=EOF)
{
fseek(fdump, -1, SEEK_CUR);
fgets(buffer, 32*(nSlides+1), fdump);
p = strtok(buffer, " ");
if(atoi(p)==0) {
lastRoad = whichRoad;
if(lastRoad!=NULL)
lastRoad->first = 0;
p = strtok(NULL, " ");
rId = atoi(p);
p = strtok(NULL, " ");
rDi = atoi(p);
whichRoad = roads+rId;
whichScrap = whichRoad->scraps;
} else {
if(whichRoad->first) {
newp = (struct Scrap*)malloc(sizeof(struct Scrap));
newp->slidesS2B = (struct Slide*)malloc(sizeof(struct Slide)*nSlides*files);
newp->slidesB2S = (struct Slide*)malloc(sizeof(struct Slide)*nSlides*files);
for (j=0;j<nSlides*files;j++) {
newp->slidesS2B[j].condition = -1;
newp->slidesS2B[j].nSamples = 0;
newp->slidesB2S[j].condition = -1;
newp->slidesB2S[j].nSamples = 0;
}
newp->atS2B = (files-argc)*nSlides;
newp->atB2S = (files-argc)*nSlides;
if (whichRoad->scraps == NULL) {
whichRoad->scraps = newp;
} else {
whichScrap->next = newp;
}
whichScrap = newp;
}
while(1){
p = strtok(NULL, " ");
q = strtok(NULL, " ");
if(p[0]=='\n')
break;
if(rDi==0) {
at=whichScrap->atS2B;
whichScrap->slidesS2B[at].condition = atof(p);
whichScrap->slidesS2B[at].nSamples = atof(q);
whichScrap->atS2B ++;
if(whichScrap->slidesS2B[at].condition != -1)
roads[rId].nSamplesS2B += whichScrap->slidesS2B[at].nSamples;
} else {
at = whichScrap->atB2S;
whichScrap->slidesB2S[at].condition = atof(p);
whichScrap->slidesB2S[at].nSamples = atof(q);
whichScrap->atB2S ++;
if(whichScrap->slidesB2S[at].condition != -1)
roads[rId].nSamplesB2S += whichScrap->slidesB2S[at].nSamples;
}
}
if(!whichRoad->first)
whichScrap = whichScrap->next;
}
}
}
argc -= 1;
argv += 1;
}
roadlist = sort_road_by_trace(roads);
bRoad = roadlist;
while(bRoad!=NULL) {
printf("%d\t", bRoad->rId);
bRoad = bRoad->next;
}
printf("\n");
for(i=0;i<nSlides*files;i++) {
bRoad = roadlist;
count = nRoads;
while ((count==-1||count>0)&&bRoad != NULL) {
if(bRoad->direction ==0) {
whichScrap = bRoad->aRoad->scraps;
while(whichScrap!=NULL) {
if((whichScrap->slidesS2B)[i].condition==-1)
printf("NaN\t");
else
printf("%0.2lf\t", (whichScrap->slidesS2B)[i].condition);
whichScrap = whichScrap->next;
}
}
if(bRoad->direction ==1) {
whichScrap = bRoad->aRoad->scraps;
while(whichScrap!=NULL) {
if((whichScrap->slidesB2S)[i].condition==-1)
printf("NaN\t");
else
printf("%0.2lf\t", (whichScrap->slidesB2S)[i].condition);
whichScrap = whichScrap->next;
}
}
bRoad = bRoad->next;
if(count!=-1)
count --;
}
printf("\n");
}
for (i = 0; i< 35000; i++) {
whichScrap = roads[i].scraps;
while(whichScrap!=NULL) {
free(whichScrap->slidesS2B);
free(whichScrap->slidesB2S);
whichScrap = whichScrap->next;
}
}
free(roads);
free(buffer);
free(line);
bRoad = roadlist;
while(bRoad != NULL) {
roadlist = bRoad->next;
free(bRoad);
bRoad = roadlist;
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.