浏览代码

test/misc/code: removed trailing spaces

Daniel-Constantin Mierla 1 年之前
父节点
当前提交
4b10338c23

+ 12 - 12
test/misc/code/atomic_test.c

@@ -2,18 +2,18 @@
  *
  *
  *  simple atomic ops testing program
  *  simple atomic ops testing program
  *  (no parallel stuff, just see if the opcodes are "legal")
  *  (no parallel stuff, just see if the opcodes are "legal")
- * 
+ *
  *  Compile with: gcc -Wall -O3 -D__CPU_i386  on x86 machines
  *  Compile with: gcc -Wall -O3 -D__CPU_i386  on x86 machines
  *                gcc -Wall -O3 -D__CPU_x86_64 on amd64 machines
  *                gcc -Wall -O3 -D__CPU_x86_64 on amd64 machines
  *                gcc -mips2 -Wall -O2 -D__CPU_mips2  on mips machines
  *                gcc -mips2 -Wall -O2 -D__CPU_mips2  on mips machines
  *                gcc -m64 -Wall -O2 -D__CPU_mips64 on mips64 machines
  *                gcc -m64 -Wall -O2 -D__CPU_mips64 on mips64 machines
  *                gcc -O3 -Wall -D__CPU_ppc on powerpc machines
  *                gcc -O3 -Wall -D__CPU_ppc on powerpc machines
  *                gcc -m64 -O3 -Wall -D__CPU_ppc64 on powerpc machines
  *                gcc -m64 -O3 -Wall -D__CPU_ppc64 on powerpc machines
- *                gcc -m64 -O3 -Wall -D__CPU_sparc64 -DSPARC64_MODE on 
+ *                gcc -m64 -O3 -Wall -D__CPU_sparc64 -DSPARC64_MODE on
  *                                                   ultrasparc machines
  *                                                   ultrasparc machines
  *  -- andrei
  *  -- andrei
  *
  *
- *  
+ *
  */
  */
 
 
 #include <stdio.h>
 #include <stdio.h>
@@ -22,7 +22,7 @@
 
 
 #include "../atomic_ops.h"
 #include "../atomic_ops.h"
 
 
-#ifdef ATOMIC_OPS_USE_LOCK 
+#ifdef ATOMIC_OPS_USE_LOCK
 /* hack to make lock work */
 /* hack to make lock work */
 #include "../lock_ops.h"
 #include "../lock_ops.h"
 
 
@@ -44,13 +44,13 @@ int main(int argc, char** argv)
 		goto error;
 		goto error;
 	}
 	}
 #endif
 #endif
-	
+
 #ifdef NOSMP
 #ifdef NOSMP
 	printf("no-smp mode\n");
 	printf("no-smp mode\n");
 #else
 #else
 	printf("smp mode\n");
 	printf("smp mode\n");
 #endif
 #endif
-	
+
 	printf("starting memory barrier opcode tests...\n");
 	printf("starting memory barrier opcode tests...\n");
 	membar();
 	membar();
 	printf(" membar() .............................. ok\n");
 	printf(" membar() .............................. ok\n");
@@ -58,9 +58,9 @@ int main(int argc, char** argv)
 	printf(" membar_write() ........................ ok\n");
 	printf(" membar_write() ........................ ok\n");
 	membar_read();
 	membar_read();
 	printf(" membar_read() ......................... ok\n");
 	printf(" membar_read() ......................... ok\n");
-	
+
 	printf("\nstarting atomic ops basic tests...\n");
 	printf("\nstarting atomic ops basic tests...\n");
-	
+
 	mb_atomic_set(&v, 1);
 	mb_atomic_set(&v, 1);
 	printf(" atomic_set, v should be 1 ............. %2d\n", mb_atomic_get(&v));
 	printf(" atomic_set, v should be 1 ............. %2d\n", mb_atomic_get(&v));
 	mb_atomic_inc(&v);
 	mb_atomic_inc(&v);
@@ -68,7 +68,7 @@ int main(int argc, char** argv)
 	r=mb_atomic_inc_and_test(&v);
 	r=mb_atomic_inc_and_test(&v);
 	printf(" atomic_inc_and_test, v should be  3 ... %2d\n", mb_atomic_get(&v));
 	printf(" atomic_inc_and_test, v should be  3 ... %2d\n", mb_atomic_get(&v));
 	printf("                      r should be  0 ... %2d\n", r);
 	printf("                      r should be  0 ... %2d\n", r);
-	
+
 	mb_atomic_dec(&v);
 	mb_atomic_dec(&v);
 	printf(" atomic_dec, v should be 2 ............. %2d\n", mb_atomic_get(&v));
 	printf(" atomic_dec, v should be 2 ............. %2d\n", mb_atomic_get(&v));
 	r=mb_atomic_dec_and_test(&v);
 	r=mb_atomic_dec_and_test(&v);
@@ -80,16 +80,16 @@ int main(int argc, char** argv)
 	r=mb_atomic_dec_and_test(&v);
 	r=mb_atomic_dec_and_test(&v);
 	printf(" atomic_dec_and_test, v should be -1 ... %2d\n", mb_atomic_get(&v));
 	printf(" atomic_dec_and_test, v should be -1 ... %2d\n", mb_atomic_get(&v));
 	printf("                      r should be  0 ... %2d\n", r);
 	printf("                      r should be  0 ... %2d\n", r);
-	
+
 	mb_atomic_and(&v, 2);
 	mb_atomic_and(&v, 2);
 	printf(" atomic_and, v should be 2 ............. %2d\n", mb_atomic_get(&v));
 	printf(" atomic_and, v should be 2 ............. %2d\n", mb_atomic_get(&v));
-	
+
 	mb_atomic_or(&v, 5);
 	mb_atomic_or(&v, 5);
 	r=mb_atomic_get_and_set(&v, 0);
 	r=mb_atomic_get_and_set(&v, 0);
 	printf(" atomic_or,  v should be 7 ............. %2d\n", r);
 	printf(" atomic_or,  v should be 7 ............. %2d\n", r);
 	printf(" atomic_get_and_set, v should be 0 ..... %2d\n", mb_atomic_get(&v));
 	printf(" atomic_get_and_set, v should be 0 ..... %2d\n", mb_atomic_get(&v));
 
 
-	
+
 	printf("\ndone.\n");
 	printf("\ndone.\n");
 #ifdef ATOMIC_OPS_USE_LOCK
 #ifdef ATOMIC_OPS_USE_LOCK
 	lock_destroy(_atomic_lock);
 	lock_destroy(_atomic_lock);

+ 18 - 18
test/misc/code/atomic_test2.c

@@ -13,24 +13,24 @@
  *           __CPU_xxx - use __CPU_xxx code
  *           __CPU_xxx - use __CPU_xxx code
  *           SPARC64_MODE - compile for a sparc 64 in 64 bit mode (gcc -m64
  *           SPARC64_MODE - compile for a sparc 64 in 64 bit mode (gcc -m64
  *                          must be used on solaris in this case)
  *                          must be used on solaris in this case)
- *  Example:  
+ *  Example:
  *    gcc -Wall -O3 -D__CPU_i386 -DNOSMP -DMEMBAR -DTYPE=long atomic_test2.c
  *    gcc -Wall -O3 -D__CPU_i386 -DNOSMP -DMEMBAR -DTYPE=long atomic_test2.c
- * 
+ *
  *  Compile with: gcc -Wall -O3 -D__CPU_i386  ... on x86 machines
  *  Compile with: gcc -Wall -O3 -D__CPU_i386  ... on x86 machines
  *                gcc -Wall -O3 -D__CPU_x86_64 ... on amd64 machines
  *                gcc -Wall -O3 -D__CPU_x86_64 ... on amd64 machines
  *                gcc -mips2 -Wall -O2 -D__CPU_mips2  ... on mips machines
  *                gcc -mips2 -Wall -O2 -D__CPU_mips2  ... on mips machines
  *                gcc -m64 -Wall -O2 -D__CPU_mips64 ... on mips64 machines
  *                gcc -m64 -Wall -O2 -D__CPU_mips64 ... on mips64 machines
  *                gcc -O3 -Wall -D__CPU_ppc ... on powerpc machines
  *                gcc -O3 -Wall -D__CPU_ppc ... on powerpc machines
  *                gcc -m64 -O3 -Wall -D__CPU_ppc64 ... on powerpc machines
  *                gcc -m64 -O3 -Wall -D__CPU_ppc64 ... on powerpc machines
- *                gcc -m64 -O3 -Wall -D__CPU_sparc64 -DSPARC64_MODE ... on 
+ *                gcc -m64 -O3 -Wall -D__CPU_sparc64 -DSPARC64_MODE ... on
  *                                                   ultrasparc machines
  *                                                   ultrasparc machines
- *                gcc -mcpu=v9 -O3 -Wall -D__CPU_sparc64  ... for 32 bit code 
- *                                                   (sparc32plus) on 
+ *                gcc -mcpu=v9 -O3 -Wall -D__CPU_sparc64  ... for 32 bit code
+ *                                                   (sparc32plus) on
  *                                                   ultrasparc machines
  *                                                   ultrasparc machines
  *                gcc -O3 -Wall -D__CPU_sparc ... on sparc v8 machines
  *                gcc -O3 -Wall -D__CPU_sparc ... on sparc v8 machines
  *  -- andrei
  *  -- andrei
  *
  *
- *  
+ *
  */
  */
 
 
 #include <stdio.h>
 #include <stdio.h>
@@ -165,12 +165,12 @@ int main(int argc, char** argv)
 {
 {
 	ATOMIC_TYPE var;
 	ATOMIC_TYPE var;
 	VALUE_TYPE r;
 	VALUE_TYPE r;
-	
+
 	ATOMIC_TYPE* v;
 	ATOMIC_TYPE* v;
-	
+
 	v=&var;
 	v=&var;
-	
-	
+
+
 #ifdef MEMBAR_USES_LOCK
 #ifdef MEMBAR_USES_LOCK
 	__membar_lock=&dummy_membar_lock;
 	__membar_lock=&dummy_membar_lock;
 	if (lock_init(__membar_lock)==0){
 	if (lock_init(__membar_lock)==0){
@@ -199,9 +199,9 @@ int main(int argc, char** argv)
 		goto error;
 		goto error;
 	}
 	}
 #endif
 #endif
-	
+
 	printf("%s\n", flags);
 	printf("%s\n", flags);
-	
+
 	printf("starting memory barrier opcode tests...\n");
 	printf("starting memory barrier opcode tests...\n");
 	membar();
 	membar();
 	printf(" membar() .............................. ok\n");
 	printf(" membar() .............................. ok\n");
@@ -227,9 +227,9 @@ int main(int argc, char** argv)
 	printf(" membar_write_atomic_op() .............. ok\n");
 	printf(" membar_write_atomic_op() .............. ok\n");
 	membar_write_atomic_setget();
 	membar_write_atomic_setget();
 	printf(" membar_write_atomic_setget() .......... ok\n");
 	printf(" membar_write_atomic_setget() .......... ok\n");
-	
+
 	printf("\nstarting atomic ops basic tests...\n");
 	printf("\nstarting atomic ops basic tests...\n");
-	
+
 	VERIFY(at_set(v, 1), 1);
 	VERIFY(at_set(v, 1), 1);
 	printf(" atomic_set, v should be 1 ............. %2d\n", (int)at_get(v));
 	printf(" atomic_set, v should be 1 ............. %2d\n", (int)at_get(v));
 	VERIFY(at_inc(v), 2);
 	VERIFY(at_inc(v), 2);
@@ -237,7 +237,7 @@ int main(int argc, char** argv)
 	VERIFY(r=at_inc_and_test(v), 3);
 	VERIFY(r=at_inc_and_test(v), 3);
 	printf(" atomic_inc_and_test, v should be  3 ... %2d\n", (int)at_get(v));
 	printf(" atomic_inc_and_test, v should be  3 ... %2d\n", (int)at_get(v));
 	printf("                      r should be  0 ... %2d\n", (int)r);
 	printf("                      r should be  0 ... %2d\n", (int)r);
-	
+
 	VERIFY(at_dec(v), 2);
 	VERIFY(at_dec(v), 2);
 	printf(" atomic_dec, v should be 2 ............. %2d\n", (int)at_get(v));
 	printf(" atomic_dec, v should be 2 ............. %2d\n", (int)at_get(v));
 	VERIFY(r=at_dec_and_test(v), 1);
 	VERIFY(r=at_dec_and_test(v), 1);
@@ -249,10 +249,10 @@ int main(int argc, char** argv)
 	VERIFY(r=at_dec_and_test(v), -1);
 	VERIFY(r=at_dec_and_test(v), -1);
 	printf(" atomic_dec_and_test, v should be -1 ... %2d\n", (int)at_get(v));
 	printf(" atomic_dec_and_test, v should be -1 ... %2d\n", (int)at_get(v));
 	printf("                      r should be  0 ... %2d\n", (int)r);
 	printf("                      r should be  0 ... %2d\n", (int)r);
-	
+
 	VERIFY(at_and(v, 2), 2);
 	VERIFY(at_and(v, 2), 2);
 	printf(" atomic_and, v should be 2 ............. %2d\n", (int)at_get(v));
 	printf(" atomic_and, v should be 2 ............. %2d\n", (int)at_get(v));
-	
+
 	VERIFY(at_or(v, 5), 7);
 	VERIFY(at_or(v, 5), 7);
 	printf(" atomic_or,  v should be 7 ............. %2d\n", (int)at_get(v));
 	printf(" atomic_or,  v should be 7 ............. %2d\n", (int)at_get(v));
 	VERIFY(r=at_get_and_set(v, 0), 0);
 	VERIFY(r=at_get_and_set(v, 0), 0);
@@ -274,7 +274,7 @@ int main(int argc, char** argv)
 	printf(" atomic_add, v should be -1 ............ %2d\n", (int)at_get(v));
 	printf(" atomic_add, v should be -1 ............ %2d\n", (int)at_get(v));
 	printf("             r should be -1 ............ %2d\n", (int)r);
 	printf("             r should be -1 ............ %2d\n", (int)r);
 
 
-	
+
 	printf("\ndone.\n");
 	printf("\ndone.\n");
 #ifdef MEMBAR_USES_LOCK
 #ifdef MEMBAR_USES_LOCK
 	lock_destroy(__membar_lock);
 	lock_destroy(__membar_lock);

+ 5 - 5
test/misc/code/auto.c

@@ -16,8 +16,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -72,9 +72,9 @@ int main(int argc, char** argv)
 			fprintf(stderr, " no parameters\n");
 			fprintf(stderr, " no parameters\n");
 			exit(-1);
 			exit(-1);
 	}
 	}
-	
+
 	for (i=0;i<10000000;i++){
 	for (i=0;i<10000000;i++){
-		
+
 	for(t=argv[1];*t;t++){
 	for(t=argv[1];*t;t++){
 		switch(*t){
 		switch(*t){
 			case 'V':
 			case 'V':
@@ -415,7 +415,7 @@ int main(int argc, char** argv)
 								break;
 								break;
 							case UNKNOWN_HEADER:
 							case UNKNOWN_HEADER:
 							default:
 							default:
-								/*printf("found unknown header, state=%d\n", 
+								/*printf("found unknown header, state=%d\n",
 											state);*/
 											state);*/
 								err=1;
 								err=1;
 								state=INITIAL;
 								state=INITIAL;

+ 11 - 11
test/misc/code/basex.c

@@ -76,9 +76,9 @@
 #define QUOTEME(x) #x
 #define QUOTEME(x) #x
 
 
 static char* id="$Id$";
 static char* id="$Id$";
-static char* version="basex test 0.1 " 
+static char* version="basex test 0.1 "
 "BASE" QUOTE_MACRO(BASEX)  ": " QUOTE_MACRO(B_ENC) ", " QUOTE_MACRO(B_DEC) ""
 "BASE" QUOTE_MACRO(BASEX)  ": " QUOTE_MACRO(B_ENC) ", " QUOTE_MACRO(B_DEC) ""
-#if defined BASE64_LOOKUP_TABLE 
+#if defined BASE64_LOOKUP_TABLE
 #ifdef BASE64_LOOKUP_LARGE
 #ifdef BASE64_LOOKUP_LARGE
 " (large b64 lookup table)"
 " (large b64 lookup table)"
 #else
 #else
@@ -125,7 +125,7 @@ void dump_profile_info(struct profile_data* pd)
 {
 {
 	printf("profiling for %s (%ld/%ld):  %lld/%lld/%lld (max/avg/last),"
 	printf("profiling for %s (%ld/%ld):  %lld/%lld/%lld (max/avg/last),"
 			" total %lld\n",
 			" total %lld\n",
-			pd->name, pd->entries, pd->exits, pd->max_cycles, 
+			pd->name, pd->entries, pd->exits, pd->max_cycles,
 			pd->entries?pd->total_cycles/pd->entries:0, pd->cycles,
 			pd->entries?pd->total_cycles/pd->entries:0, pd->cycles,
 			pd->total_cycles);
 			pd->total_cycles);
 }
 }
@@ -135,7 +135,7 @@ void dump_profile_info(struct profile_data* pd)
 int seed_prng()
 int seed_prng()
 {
 {
 	int seed, rfd;
 	int seed, rfd;
-	
+
 	if ((rfd=open("/dev/urandom", O_RDONLY))!=-1){
 	if ((rfd=open("/dev/urandom", O_RDONLY))!=-1){
 try_again:
 try_again:
 		if (read(rfd, (void*)&seed, sizeof(seed))==-1){
 		if (read(rfd, (void*)&seed, sizeof(seed))==-1){
@@ -328,26 +328,26 @@ int main(int argc, char** argv)
 	}
 	}
 	dec_buf+=e_offset; /* make sure it's off by e_offset bytes from the
 	dec_buf+=e_offset; /* make sure it's off by e_offset bytes from the
 						  aligned stuff malloc returns */
 						  aligned stuff malloc returns */
-	
-	
+
+
 	seed_prng();
 	seed_prng();
 	/* profile */
 	/* profile */
 	profile_init(&pf1, "encode");
 	profile_init(&pf1, "encode");
 	profile_init(&pf2, "decode");
 	profile_init(&pf2, "decode");
-	
+
 	init_basex();
 	init_basex();
 	if (verbose)
 	if (verbose)
 		printf("starting (loops %d, min size %d, max size %d, offset %d,"
 		printf("starting (loops %d, min size %d, max size %d, offset %d,"
 				", e_offset %d, buffer sizes %d %d %d)\n",
 				", e_offset %d, buffer sizes %d %d %d)\n",
 				loops, min_len, max_len, offset, e_offset, ibuf_len,
 				loops, min_len, max_len, offset, e_offset, ibuf_len,
 				enc_buf_len, dec_buf_len);
 				enc_buf_len, dec_buf_len);
-		
+
 		for (r=0; r<loops; r++){
 		for (r=0; r<loops; r++){
 			if (min_len!=max_len)
 			if (min_len!=max_len)
 				/* test encode/decode random data w/ random length*/
 				/* test encode/decode random data w/ random length*/
 				c_len= min_len+(int)((float)(max_len-min_len+1)*
 				c_len= min_len+(int)((float)(max_len-min_len+1)*
 											(rand()/(RAND_MAX+1.0)));
 											(rand()/(RAND_MAX+1.0)));
-			else 
+			else
 				/* test encode /decode random data w/ fixed length*/
 				/* test encode /decode random data w/ fixed length*/
 				c_len=max_len;
 				c_len=max_len;
 			if (offset==-1)
 			if (offset==-1)
@@ -361,9 +361,9 @@ int main(int argc, char** argv)
 				printf("loop %d, current len %d, offset %d, start %p\n",
 				printf("loop %d, current len %d, offset %d, start %p\n",
 							r, c_len-offs, offs, &ibuf[offs]);
 							r, c_len-offs, offs, &ibuf[offs]);
 			else if ((verbose >1) && (r %10==0)) putchar('.');
 			else if ((verbose >1) && (r %10==0)) putchar('.');
-			
+
 			fill_rand(ibuf, c_len);
 			fill_rand(ibuf, c_len);
-			
+
 			c_len-=offs;
 			c_len-=offs;
 			e_len=B_ENC_LEN(c_len);
 			e_len=B_ENC_LEN(c_len);
 			profile_start(&pf1);
 			profile_start(&pf1);

+ 5 - 5
test/misc/code/bit_scan_test.c

@@ -1,7 +1,7 @@
 /*
 /*
  * test bit_scan operations from bit_scan.h
  * test bit_scan operations from bit_scan.h
  *  (both for correctness  and speed)
  *  (both for correctness  and speed)
- * 
+ *
  * Copyright (C) 2007 iptelorg GmbH
  * Copyright (C) 2007 iptelorg GmbH
  *
  *
  * Permission to use, copy, modify, and distribute this software for any
  * Permission to use, copy, modify, and distribute this software for any
@@ -16,7 +16,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
  */
-/* 
+/*
  * Example gcc command line:
  * Example gcc command line:
  *  gcc -O9 -Wall -DCC_GCC_LIKE_ASM  -D__CPU_x86 bit_scan_test.c ../bit_scan.c
  *  gcc -O9 -Wall -DCC_GCC_LIKE_ASM  -D__CPU_x86 bit_scan_test.c ../bit_scan.c
  *      -o bit_scan_test
  *      -o bit_scan_test
@@ -86,7 +86,7 @@ int main(int argc, char** argv)
 	struct profile_data pdf_32, pdf_64, pdl_32, pdl_64;
 	struct profile_data pdf_32, pdf_64, pdl_32, pdl_64;
 	struct profile_data pdf_long, pdl_long;
 	struct profile_data pdf_long, pdl_long;
 #endif /* NO_PROFILE */
 #endif /* NO_PROFILE */
-	
+
 	profile_init(&pdf1, "first_debruijn32");
 	profile_init(&pdf1, "first_debruijn32");
 	profile_init(&pdf2, "first_slow32");
 	profile_init(&pdf2, "first_slow32");
 #ifdef HAS_BIT_SCAN_ASM
 #ifdef HAS_BIT_SCAN_ASM
@@ -111,7 +111,7 @@ int main(int argc, char** argv)
 	profile_init(&pdl7, "last_asm64");
 	profile_init(&pdl7, "last_asm64");
 #endif
 #endif
 	profile_init(&pdl8, "last_br64");
 	profile_init(&pdl8, "last_br64");
-	
+
 	profile_init(&pdf_32, "scan_forward32");
 	profile_init(&pdf_32, "scan_forward32");
 	profile_init(&pdf_64, "scan_forward64");
 	profile_init(&pdf_64, "scan_forward64");
 	profile_init(&pdl_32, "scan_reverse32");
 	profile_init(&pdl_32, "scan_reverse32");
@@ -195,7 +195,7 @@ int main(int argc, char** argv)
 	PROFILE_PRINT(&pdl7);
 	PROFILE_PRINT(&pdl7);
 #endif
 #endif
 	PROFILE_PRINT(&pdl8);
 	PROFILE_PRINT(&pdl8);
-	
+
 	PROFILE_PRINT(&pdf_32);
 	PROFILE_PRINT(&pdf_32);
 	PROFILE_PRINT(&pdf_64);
 	PROFILE_PRINT(&pdf_64);
 	PROFILE_PRINT(&pdf_long);
 	PROFILE_PRINT(&pdf_long);

+ 10 - 10
test/misc/code/dns_query.c

@@ -5,7 +5,7 @@
  * Compile with:
  * Compile with:
  *  gcc -o dns_query2 dns_query.c ../resolve.o ../dprint.o ../mem/ *.o -lresolv
  *  gcc -o dns_query2 dns_query.c ../resolve.o ../dprint.o ../mem/ *.o -lresolv
  *  (and first compile Kamailio with qm_malloc)
  *  (and first compile Kamailio with qm_malloc)
- * 
+ *
  *
  *
  * Copyright (C) 2001-2003 FhG Fokus
  * Copyright (C) 2001-2003 FhG Fokus
  *
  *
@@ -21,8 +21,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 /*
 /*
@@ -80,7 +80,7 @@ int main(int argc, char** argv)
 	struct a_rdata* ip;
 	struct a_rdata* ip;
 
 
 	name=type_str=0;
 	name=type_str=0;
-	
+
 	opterr=0;
 	opterr=0;
 	while ((c=getopt(argc, argv, "n:t:hV"))!=-1){
 	while ((c=getopt(argc, argv, "n:t:hV"))!=-1){
 		switch(c){
 		switch(c){
@@ -115,7 +115,7 @@ int main(int argc, char** argv)
 				abort();
 				abort();
 		}
 		}
 	}
 	}
-	
+
 	if (name==0){
 	if (name==0){
 		fprintf(stderr, "Missing domain name (-n name)\n");
 		fprintf(stderr, "Missing domain name (-n name)\n");
 		goto error;
 		goto error;
@@ -164,7 +164,7 @@ int main(int argc, char** argv)
 				case T_CNAME:
 				case T_CNAME:
 					printf("CNAME  type= %d class=%d  ttl=%d\n",
 					printf("CNAME  type= %d class=%d  ttl=%d\n",
 							l->type, l->class, l->ttl);
 							l->type, l->class, l->ttl);
-					printf("       name=[%s]\n", 
+					printf("       name=[%s]\n",
 								((struct cname_rdata*)l->rdata)->name);
 								((struct cname_rdata*)l->rdata)->name);
 					break;
 					break;
 				case T_A:
 				case T_A:
@@ -178,7 +178,7 @@ int main(int argc, char** argv)
 					printf("AAAA   type= %d class=%d  ttl=%d\n",
 					printf("AAAA   type= %d class=%d  ttl=%d\n",
 							l->type, l->class, l->ttl);
 							l->type, l->class, l->ttl);
 					printf("        ip6= ");
 					printf("        ip6= ");
-					for(r=0;r<16;r++) 
+					for(r=0;r<16;r++)
 						printf("%x ", ((struct aaaa_rdata*)l->rdata)->ip6[r]);
 						printf("%x ", ((struct aaaa_rdata*)l->rdata)->ip6[r]);
 					printf("\n");
 					printf("\n");
 					break;
 					break;
@@ -189,13 +189,13 @@ int main(int argc, char** argv)
 					printf("       order= %d pref=%d\n",
 					printf("       order= %d pref=%d\n",
 								naptr->order, naptr->pref);
 								naptr->order, naptr->pref);
 					printf("       flags_len= %d,     flags= [%.*s]\n",
 					printf("       flags_len= %d,     flags= [%.*s]\n",
-									naptr->flags_len, 
+									naptr->flags_len,
 									naptr->flags_len, naptr->flags);
 									naptr->flags_len, naptr->flags);
 					printf("       services_len= %d,  services= [%.*s]\n",
 					printf("       services_len= %d,  services= [%.*s]\n",
-									naptr->services_len, 
+									naptr->services_len,
 									naptr->services_len, naptr->services);
 									naptr->services_len, naptr->services);
 					printf("       regexp_len= %d,    regexp= [%.*s]\n",
 					printf("       regexp_len= %d,    regexp= [%.*s]\n",
-									naptr->regexp_len, 
+									naptr->regexp_len,
 									naptr->regexp_len, naptr->regexp);
 									naptr->regexp_len, naptr->regexp);
 					printf("       repl_len= %d,      repl= [%s]\n",
 					printf("       repl_len= %d,      repl= [%s]\n",
 									naptr->repl_len, naptr->repl);
 									naptr->repl_len, naptr->repl);

+ 13 - 13
test/misc/code/endian_test.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2008 iptelorg GmbH
  * Copyright (C) 2008 iptelorg GmbH
  *
  *
  * Permission to use, copy, modify, and distribute this software for any
  * Permission to use, copy, modify, and distribute this software for any
@@ -18,7 +18,7 @@
  *  compile/run with:
  *  compile/run with:
  *  gcc  -Wall endian_test.c ../endianness.c  -o endian_test; ./endian_test
  *  gcc  -Wall endian_test.c ../endianness.c  -o endian_test; ./endian_test
  */
  */
-/* 
+/*
  * History:
  * History:
  * --------
  * --------
  *  2008-06-13  created by andrei
  *  2008-06-13  created by andrei
@@ -33,7 +33,7 @@
  *           BYTE_ORDER == LITTLE_ENDIAN | BIG_ENDIAN
  *           BYTE_ORDER == LITTLE_ENDIAN | BIG_ENDIAN
  * solaris: _LITTLE_ENDIAN | _BIG_ENDIAN
  * solaris: _LITTLE_ENDIAN | _BIG_ENDIAN
  *
  *
- * Note: BIG_ENDIAN, LITTLE_ENDIAN, _BIG_ENDIAN, _LITTLE_ENDIAN cannot be 
+ * Note: BIG_ENDIAN, LITTLE_ENDIAN, _BIG_ENDIAN, _LITTLE_ENDIAN cannot be
  *       used always,  some OSes define both of them for BYTE_ORDER use
  *       used always,  some OSes define both of them for BYTE_ORDER use
  *       (e.g. linux defines both BIG_ENDIAN & LITTLE_ENDIAN, bsds define
  *       (e.g. linux defines both BIG_ENDIAN & LITTLE_ENDIAN, bsds define
  *          _BIG_ENDIAN, _LITTLE_ENDIAN, BIG_ENDIAN, LITTLE_ENDIAN)
  *          _BIG_ENDIAN, _LITTLE_ENDIAN, BIG_ENDIAN, LITTLE_ENDIAN)
@@ -43,14 +43,14 @@
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include "../endianness.h"
 #include "../endianness.h"
-/* 
+/*
  * Tested:
  * Tested:
  * linux:   y
  * linux:   y
  * freebsd: y
  * freebsd: y
  * openbsd:
  * openbsd:
  * netbsd:
  * netbsd:
  * solaris: y
  * solaris: y
- * darwin: 
+ * darwin:
  * cygwin:
  * cygwin:
  *
  *
  * Header files:
  * Header files:
@@ -72,7 +72,7 @@
  *           BYTE_ORDER == LITTLE_ENDIAN | BIG_ENDIAN
  *           BYTE_ORDER == LITTLE_ENDIAN | BIG_ENDIAN
  * solaris: _LITTLE_ENDIAN | _BIG_ENDIAN
  * solaris: _LITTLE_ENDIAN | _BIG_ENDIAN
  *
  *
- * Note: BIG_ENDIAN, LITTLE_ENDIAN, _BIG_ENDIAN, _LITTLE_ENDIAN cannot be 
+ * Note: BIG_ENDIAN, LITTLE_ENDIAN, _BIG_ENDIAN, _LITTLE_ENDIAN cannot be
  *       used always,  some OSes define both of them for BYTE_ORDER use
  *       used always,  some OSes define both of them for BYTE_ORDER use
  *       (e.g. linux defines both BIG_ENDIAN & LITTLE_ENDIAN, bsds define
  *       (e.g. linux defines both BIG_ENDIAN & LITTLE_ENDIAN, bsds define
  *          _BIG_ENDIAN, _LITTLE_ENDIAN, BIG_ENDIAN, LITTLE_ENDIAN)
  *          _BIG_ENDIAN, _LITTLE_ENDIAN, BIG_ENDIAN, LITTLE_ENDIAN)
@@ -81,7 +81,7 @@
  */
  */
 
 
 /* test only */
 /* test only */
-#if defined __BYTE_ORDER && defined __LITTLE_ENDIAN 
+#if defined __BYTE_ORDER && defined __LITTLE_ENDIAN
 #if	__BYTE_ORDER == __LITTLE_ENDIAN
 #if	__BYTE_ORDER == __LITTLE_ENDIAN
 #warning little endian (via __BYTE_ORDER)
 #warning little endian (via __BYTE_ORDER)
 #define __BYTE_ORDER_FOUND
 #define __BYTE_ORDER_FOUND
@@ -103,7 +103,7 @@
 #define _BYTE_ORDER_FOUND
 #define _BYTE_ORDER_FOUND
 #endif
 #endif
 #endif
 #endif
-#if defined _BYTE_ORDER && defined _BIG_ENDIAN 
+#if defined _BYTE_ORDER && defined _BIG_ENDIAN
 #if _BYTE_ORDER == _BIG_ENDIAN
 #if _BYTE_ORDER == _BIG_ENDIAN
 #warning big endian (via _BYTE_ORDER)
 #warning big endian (via _BYTE_ORDER)
 #define _BYTE_ORDER_FOUND
 #define _BYTE_ORDER_FOUND
@@ -113,13 +113,13 @@
 #error _BYTE_ORDER defined, but w/ a strange value
 #error _BYTE_ORDER defined, but w/ a strange value
 #endif
 #endif
 
 
-#if defined BYTE_ORDER && defined LITTLE_ENDIAN 
+#if defined BYTE_ORDER && defined LITTLE_ENDIAN
 #if BYTE_ORDER == LITTLE_ENDIAN
 #if BYTE_ORDER == LITTLE_ENDIAN
 #warning little endian (via BYTE_ORDER)
 #warning little endian (via BYTE_ORDER)
 #define BYTE_ORDER_FOUND
 #define BYTE_ORDER_FOUND
 #endif
 #endif
 #endif
 #endif
-#if defined BYTE_ORDER && defined BIG_ENDIAN 
+#if defined BYTE_ORDER && defined BIG_ENDIAN
 #if BYTE_ORDER == BIG_ENDIAN
 #if BYTE_ORDER == BIG_ENDIAN
 #warning big endian (via BYTE_ORDER)
 #warning big endian (via BYTE_ORDER)
 #define BYTE_ORDER_FOUND
 #define BYTE_ORDER_FOUND
@@ -146,7 +146,7 @@
 int main(int argc, char** argv)
 int main(int argc, char** argv)
 {
 {
 	int ret;
 	int ret;
-	
+
 	ret=0;
 	ret=0;
 	if (endianness_sanity_check()!=0){
 	if (endianness_sanity_check()!=0){
 		printf("ERROR: sanity checks failed\n");
 		printf("ERROR: sanity checks failed\n");
@@ -155,14 +155,14 @@ int main(int argc, char** argv)
 	if (is_little_endian()){
 	if (is_little_endian()){
 #ifdef __IS_LITTLE_ENDIAN
 #ifdef __IS_LITTLE_ENDIAN
 		printf("OK: little endian confirmed\n");
 		printf("OK: little endian confirmed\n");
-#else 
+#else
 		printf("ERROR: macro claims BIG ENDIAN, but it's little\n");
 		printf("ERROR: macro claims BIG ENDIAN, but it's little\n");
 		return -1;
 		return -1;
 #endif
 #endif
 	}else{
 	}else{
 #ifdef __IS_BIG_ENDIAN
 #ifdef __IS_BIG_ENDIAN
 		printf("OK: big endian confirmed\n");
 		printf("OK: big endian confirmed\n");
-#else 
+#else
 		printf("ERROR: macro claims LITTLE ENDIAN, but it's big\n");
 		printf("ERROR: macro claims LITTLE ENDIAN, but it's big\n");
 		return -1;
 		return -1;
 #endif
 #endif

+ 6 - 6
test/misc/code/gethostbyaddr.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
 	unsigned char** h;
 	unsigned char** h;
 
 
 	name=0;
 	name=0;
-	
+
 	opterr=0;
 	opterr=0;
 	while ((c=getopt(argc, argv, "n:hV"))!=-1){
 	while ((c=getopt(argc, argv, "n:hV"))!=-1){
 		switch(c){
 		switch(c){
@@ -78,18 +78,18 @@ int main(int argc, char** argv)
 				abort();
 				abort();
 		}
 		}
 	}
 	}
-	
+
 	if (name==0){
 	if (name==0){
 		fprintf(stderr, "Missing domain name (-n name)\n");
 		fprintf(stderr, "Missing domain name (-n name)\n");
 		goto error;
 		goto error;
 	}
 	}
-	
+
 	he=gethostbyname(name);
 	he=gethostbyname(name);
 	if (he==0){
 	if (he==0){
 			printf("bad address <%s>\n", name);
 			printf("bad address <%s>\n", name);
 			goto error;
 			goto error;
 	}
 	}
-	he=gethostbyaddr(he->h_addr_list[0], he->h_length, he->h_addrtype); 
+	he=gethostbyaddr(he->h_addr_list[0], he->h_length, he->h_addrtype);
 	if (he==0) printf("no answer\n");
 	if (he==0) printf("no answer\n");
 	else{
 	else{
 		printf("h_name=%s\n", he->h_name);
 		printf("h_name=%s\n", he->h_name);

+ 5 - 5
test/misc/code/gethostbyname.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
 	unsigned char** h;
 	unsigned char** h;
 
 
 	name=0;
 	name=0;
-	
+
 	opterr=0;
 	opterr=0;
 	while ((c=getopt(argc, argv, "n:hV"))!=-1){
 	while ((c=getopt(argc, argv, "n:hV"))!=-1){
 		switch(c){
 		switch(c){
@@ -78,12 +78,12 @@ int main(int argc, char** argv)
 				abort();
 				abort();
 		}
 		}
 	}
 	}
-	
+
 	if (name==0){
 	if (name==0){
 		fprintf(stderr, "Missing domain name (-n name)\n");
 		fprintf(stderr, "Missing domain name (-n name)\n");
 		goto error;
 		goto error;
 	}
 	}
-	
+
 	he=gethostbyname(name);
 	he=gethostbyname(name);
 	if (he==0) printf("no answer\n");
 	if (he==0) printf("no answer\n");
 	else{
 	else{

+ 18 - 18
test/misc/code/ifls.c

@@ -15,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
  /*
  /*
@@ -73,7 +73,7 @@ void print_sockaddr(struct sockaddr* sa)
 {
 {
 	unsigned char* buf;
 	unsigned char* buf;
 	int r;
 	int r;
-	
+
 	switch(sa->sa_family){
 	switch(sa->sa_family){
 	case AF_INET:
 	case AF_INET:
 		buf=(char*)&(((struct sockaddr_in*)sa)->sin_addr).s_addr;
 		buf=(char*)&(((struct sockaddr_in*)sa)->sin_addr).s_addr;
@@ -81,14 +81,14 @@ void print_sockaddr(struct sockaddr* sa)
 		break;
 		break;
 	case AF_INET6:
 	case AF_INET6:
 		buf=(((struct sockaddr_in6*)sa)->sin6_addr).s6_addr;
 		buf=(((struct sockaddr_in6*)sa)->sin6_addr).s6_addr;
-		for(r=0; r<16; r++) 
+		for(r=0; r<16; r++)
 			printf("%02x%s", buf[r], ((r%2)&&(r!=15))?":":"" );
 			printf("%02x%s", buf[r], ((r%2)&&(r!=15))?":":"" );
 		printf("\n");
 		printf("\n");
 		break;
 		break;
 	default:
 	default:
 		printf("unknown af %d\n", sa->sa_family);
 		printf("unknown af %d\n", sa->sa_family);
 #ifdef __FreeBSD__
 #ifdef __FreeBSD__
-		for (r=0; r<sa->sa_len; r++) 
+		for (r=0; r<sa->sa_len; r++)
 			printf("%02x ", ((unsigned char*)sa)[r]);
 			printf("%02x ", ((unsigned char*)sa)[r]);
 		printf("\n");
 		printf("\n");
 #endif
 #endif
@@ -101,18 +101,18 @@ int ls_ifflags(char* name, int family , int options)
 {
 {
 	struct ifreq ifr;
 	struct ifreq ifr;
 	int s;
 	int s;
-	
+
 	memset(&ifr, 0, sizeof(ifr)); /* init to 0 (check if filled)*/
 	memset(&ifr, 0, sizeof(ifr)); /* init to 0 (check if filled)*/
 	s=socket(family, SOCK_DGRAM, 0);
 	s=socket(family, SOCK_DGRAM, 0);
 	strncpy(ifr.ifr_name, name, IFNAMSIZ);
 	strncpy(ifr.ifr_name, name, IFNAMSIZ);
-#if 0	
+#if 0
 	if (ioctl(s, SIOCGIFADDR, &ifr)==-1){
 	if (ioctl(s, SIOCGIFADDR, &ifr)==-1){
 		if(errno==EBADF) return 0; /* invalid descriptor => no address*/
 		if(errno==EBADF) return 0; /* invalid descriptor => no address*/
-		fprintf(stderr, "ls_if: ioctl for %s failed: %s\n", name, 
+		fprintf(stderr, "ls_if: ioctl for %s failed: %s\n", name,
 					strerror(errno));
 					strerror(errno));
 		goto error;
 		goto error;
 	};
 	};
-	
+
 	printf("%s:\n", ifr.ifr_name);
 	printf("%s:\n", ifr.ifr_name);
 	printf("        dbg: family=%d", ifr.ifr_addr.sa_family);
 	printf("        dbg: family=%d", ifr.ifr_addr.sa_family);
 #ifdef __FreeBSD__
 #ifdef __FreeBSD__
@@ -124,7 +124,7 @@ int ls_ifflags(char* name, int family , int options)
 		printf("ls_if: OS BUG: SIOCGIFADDR doesn't work!\n");
 		printf("ls_if: OS BUG: SIOCGIFADDR doesn't work!\n");
 		goto error;
 		goto error;
 	}
 	}
-	
+
 	printf("        ");
 	printf("        ");
 	print_sockaddr(&ifr.ifr_addr);
 	print_sockaddr(&ifr.ifr_addr);
 
 
@@ -170,7 +170,7 @@ int ls_ifflags(char* name, int family , int options)
 			}
 			}
 		}
 		}
 	};
 	};
-		
+
 	close(s);
 	close(s);
 	return 0;
 	return 0;
 error:
 error:
@@ -188,7 +188,7 @@ int ls_ifs(char* name, int family, int options)
 	int size;
 	int size;
 	int lastlen;
 	int lastlen;
 	int s;
 	int s;
-	
+
 	/* ipv4 or ipv6 only*/
 	/* ipv4 or ipv6 only*/
 	s=socket(family, SOCK_DGRAM, 0);
 	s=socket(family, SOCK_DGRAM, 0);
 	lastlen=0;
 	lastlen=0;
@@ -210,7 +210,7 @@ int ls_ifs(char* name, int family, int options)
 		/* try a bigger array*/
 		/* try a bigger array*/
 		free(ifc.ifc_req);
 		free(ifc.ifc_req);
 	}
 	}
-	
+
 	last=(char*)ifc.ifc_req+ifc.ifc_len;
 	last=(char*)ifc.ifc_req+ifc.ifc_len;
 	for(ifr=ifc.ifc_req; (char*)ifr<last;
 	for(ifr=ifc.ifc_req; (char*)ifr<last;
 			ifr=(struct ifreq*)((char*)ifr+sizeof(ifr->ifr_name)+
 			ifr=(struct ifreq*)((char*)ifr+sizeof(ifr->ifr_name)+
@@ -266,8 +266,8 @@ int main(int argc, char**argv)
 	int ipv6, ipv4;
 	int ipv6, ipv4;
 	int r;
 	int r;
 	char c;
 	char c;
-	
-	
+
+
 	options=0;
 	options=0;
 	ipv6=ipv4=1;
 	ipv6=ipv4=1;
 	name=0;
 	name=0;
@@ -324,7 +324,7 @@ int main(int argc, char**argv)
 		no=argc-optind;
 		no=argc-optind;
 		name=&argv[optind];
 		name=&argv[optind];
 	}
 	}
-	
+
 	if (no==0){
 	if (no==0){
 		/* list all interfaces */
 		/* list all interfaces */
 		if (ipv4) ls_ifs(0, AF_INET, options);
 		if (ipv4) ls_ifs(0, AF_INET, options);
@@ -335,8 +335,8 @@ int main(int argc, char**argv)
 			if (ipv6) ls_ifs(name[r], AF_INET6, options);
 			if (ipv6) ls_ifs(name[r], AF_INET6, options);
 		}
 		}
 	};
 	};
-	
-	
+
+
 	exit(0);
 	exit(0);
 error:
 error:
 	exit(-1);
 	exit(-1);

+ 5 - 5
test/misc/code/lock_test.c

@@ -1,13 +1,13 @@
 /*
 /*
- * 
+ *
  *  simple locking test program
  *  simple locking test program
  *  (no paralles stuff)
  *  (no paralles stuff)
- * 
+ *
  *  Compile with: gcc -D__CPU_i386 -O3 on x86 machines and
  *  Compile with: gcc -D__CPU_i386 -O3 on x86 machines and
  *                gcc -mips2 -O2 -D__CPU_mips2  on mips machines.
  *                gcc -mips2 -O2 -D__CPU_mips2  on mips machines.
  *  -- andrei
  *  -- andrei
  *
  *
- *  
+ *
  */
  */
 
 
 #include <stdio.h>
 #include <stdio.h>
@@ -19,10 +19,10 @@ int main(int argc, char** argv)
 {
 {
 	fl_lock_t lock;
 	fl_lock_t lock;
 	int r;
 	int r;
-	
+
 	lock=0;
 	lock=0;
 	printf("starting locking basic tests...\n");
 	printf("starting locking basic tests...\n");
-	
+
 	r=try_lock(&lock);
 	r=try_lock(&lock);
 	printf(" try_lock should return 0            ... %d\n", r);
 	printf(" try_lock should return 0            ... %d\n", r);
 	printf("     lock should be 1 now            ... %d\n", lock);
 	printf("     lock should be 1 now            ... %d\n", lock);

+ 5 - 5
test/misc/code/locking/locking_test.c

@@ -20,8 +20,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -174,14 +174,14 @@ int main (int argc, char** argv)
 	int c;
 	int c;
 	int r;
 	int r;
 	char *tmp;
 	char *tmp;
-	
+
 	int count;
 	int count;
 	int verbose;
 	int verbose;
 	char *address;
 	char *address;
 #ifdef SYSV_SEM
 #ifdef SYSV_SEM
 	union semun su;
 	union semun su;
 #endif
 #endif
-	
+
 	/* init */
 	/* init */
 	count=0;
 	count=0;
 	verbose=0;
 	verbose=0;
@@ -228,7 +228,7 @@ int main (int argc, char** argv)
 		}
 		}
 	}
 	}
 
 
-	
+
 	/* check if all the required params are present */
 	/* check if all the required params are present */
 	if(count==0){
 	if(count==0){
 		fprintf(stderr, "Missing count (-c number)\n");
 		fprintf(stderr, "Missing count (-c number)\n");

+ 12 - 12
test/misc/code/mips_lock.c

@@ -2,12 +2,12 @@
  *
  *
  *  simple locking test program
  *  simple locking test program
  *  (no paralles stuff)
  *  (no paralles stuff)
- * 
+ *
  *  Compile with: gcc -D__CPU_i386 -O3 on x86 machines and
  *  Compile with: gcc -D__CPU_i386 -O3 on x86 machines and
  *                gcc -mips2 -O2 -D__CPU_mips  on mips machines.
  *                gcc -mips2 -O2 -D__CPU_mips  on mips machines.
  *  -- andrei
  *  -- andrei
  *
  *
- *  
+ *
  */
  */
 
 
 #include <stdio.h>
 #include <stdio.h>
@@ -19,10 +19,10 @@ typedef volatile int fl_lock_t;
 int tsl(fl_lock_t* lock)
 int tsl(fl_lock_t* lock)
 {
 {
 	long val;
 	long val;
-	
+
 #ifdef __CPU_mips
 #ifdef __CPU_mips
 	long tmp=0;
 	long tmp=0;
-	
+
 	asm volatile(
 	asm volatile(
 		".set noreorder\n\t"
 		".set noreorder\n\t"
 		"1:  ll %1, %2   \n\t"
 		"1:  ll %1, %2   \n\t"
@@ -31,19 +31,19 @@ int tsl(fl_lock_t* lock)
 		"    beqz %0, 1b \n\t"
 		"    beqz %0, 1b \n\t"
 		"    nop \n\t"
 		"    nop \n\t"
 		".set reorder\n\t"
 		".set reorder\n\t"
-		: "=&r" (tmp), "=&r" (val), "=m" (*lock) 
-		: "0" (tmp), "m" (*lock) 
+		: "=&r" (tmp), "=&r" (val), "=m" (*lock)
+		: "0" (tmp), "m" (*lock)
 		: "cc"
 		: "cc"
 	);
 	);
 #elif defined __CPU_i386
 #elif defined __CPU_i386
 	val=1;
 	val=1;
-	asm volatile( 
-		" xchg %b1, %0" : "=q" (val), "=m" (*lock) : "0" (val) 
+	asm volatile(
+		" xchg %b1, %0" : "=q" (val), "=m" (*lock) : "0" (val)
 	);
 	);
 #else
 #else
 #error "cpu type not defined, add -D__CPU_<type> when compiling"
 #error "cpu type not defined, add -D__CPU_<type> when compiling"
 #endif
 #endif
-	
+
 	return val;
 	return val;
 }
 }
 
 
@@ -64,7 +64,7 @@ void release_lock(fl_lock_t* lock)
 #elif defined __CPU_i386
 #elif defined __CPU_i386
 	asm volatile(
 	asm volatile(
 		" movb $0, (%0)" : /*no output*/ : "r"(lock): "memory"
 		" movb $0, (%0)" : /*no output*/ : "r"(lock): "memory"
-	); 
+	);
 #else
 #else
 #error "cpu type not defined, add -D__CPU_<type> when compiling"
 #error "cpu type not defined, add -D__CPU_<type> when compiling"
 #endif
 #endif
@@ -76,10 +76,10 @@ int main(int argc, char** argv)
 {
 {
 	fl_lock_t lock;
 	fl_lock_t lock;
 	int r;
 	int r;
-	
+
 	lock=0;
 	lock=0;
 	printf("starting locking basic tests...\n");
 	printf("starting locking basic tests...\n");
-	
+
 	r=tsl(&lock);
 	r=tsl(&lock);
 	printf(" tsl should return 0                 ... %d\n", r);
 	printf(" tsl should return 0                 ... %d\n", r);
 	printf("     lock should be 1 now            ... %d\n", lock);
 	printf("     lock should be 1 now            ... %d\n", lock);

+ 1 - 1
test/misc/code/p_uri.c

@@ -88,7 +88,7 @@ int main (int argc, char** argv)
 		printf("usage:    %s  uri [, uri...]\n", argv[0]);
 		printf("usage:    %s  uri [, uri...]\n", argv[0]);
 		exit(1);
 		exit(1);
 	}
 	}
-	
+
 	for (r=1; r<argc; r++){
 	for (r=1; r<argc; r++){
 		if (parse_uri(argv[r], strlen(argv[r]), &uri)<0){
 		if (parse_uri(argv[r], strlen(argv[r]), &uri)<0){
 			printf("error: parsing %s\n", argv[r]);
 			printf("error: parsing %s\n", argv[r]);

+ 1 - 1
test/misc/code/parse_to_body.c

@@ -89,7 +89,7 @@ int main (int argc, char** argv)
 		printf("usage:    %s  to_body [, to_body...]\n", argv[0]);
 		printf("usage:    %s  to_body [, to_body...]\n", argv[0]);
 		exit(1);
 		exit(1);
 	}
 	}
-	
+
 	for (r=1; r<argc; r++){
 	for (r=1; r<argc; r++){
 		/*memset(&to_b, 0, sizeof(to_b));*/
 		/*memset(&to_b, 0, sizeof(to_b));*/
 		if (parse_to(argv[r], argv[r]+strlen(argv[r]), &to_b)==0 ||
 		if (parse_to(argv[r], argv[r]+strlen(argv[r]), &to_b)==0 ||

+ 9 - 9
test/misc/code/profile.h

@@ -21,27 +21,27 @@
  *
  *
  * cycles_t get_cpu_cycles() - returns the current cpu cycles counter
  * cycles_t get_cpu_cycles() - returns the current cpu cycles counter
  *
  *
- * void     get_cpu_cycles_uint(unsigned* u1, unsigned* u2) 
- *                            - sets u1 and u2 to the least significant, 
+ * void     get_cpu_cycles_uint(unsigned* u1, unsigned* u2)
+ *                            - sets u1 and u2 to the least significant,
  *                              respective most significant 32 bit word of
  *                              respective most significant 32 bit word of
  *                              the cpu cycles counter
  *                              the cpu cycles counter
  * struct profile_data;            - holds all the profile results
  * struct profile_data;            - holds all the profile results
  *                               (last call cycles, max cycles, total cycles,
  *                               (last call cycles, max cycles, total cycles,
- *                                no. of profile_start calls, no. of 
+ *                                no. of profile_start calls, no. of
  *                                profile_end calls, name use in profile_init)
  *                                profile_end calls, name use in profile_init)
  * void     profile_init(pd, name) - initialize a profile structure
  * void     profile_init(pd, name) - initialize a profile structure
  * void     profile_start(pd)      - starts profiling (call before calling
  * void     profile_start(pd)      - starts profiling (call before calling
  *                               the target function)
  *                               the target function)
  * void     profile_end(pd)        - stops profiling (call after the target
  * void     profile_end(pd)        - stops profiling (call after the target
  *                               function returns)
  *                               function returns)
- * 
+ *
  */
  */
  /*
  /*
  * Config defines:   CC_GCC_LIKE_ASM  - the compiler support gcc style
  * Config defines:   CC_GCC_LIKE_ASM  - the compiler support gcc style
  *                     inline asm,
  *                     inline asm,
  *                  __CPU_x86, __CPU_x86_64, __CPU_sparc64
  *                  __CPU_x86, __CPU_x86_64, __CPU_sparc64
  */
  */
-/* 
+/*
  * History:
  * History:
  * --------
  * --------
  *  2007-06-23  created by andrei
  *  2007-06-23  created by andrei
@@ -60,8 +60,8 @@
  *            (unsigned long long for now)
  *            (unsigned long long for now)
  *
  *
  * cycles_t get_cpu_cycles() - returns the current cpu cycles counter
  * cycles_t get_cpu_cycles() - returns the current cpu cycles counter
- * void     get_cpu_cycles_uint(unsigned* u1, unsigned* u2) 
- *                            - sets u1 and u2 to the least significant, 
+ * void     get_cpu_cycles_uint(unsigned* u1, unsigned* u2)
+ *                            - sets u1 and u2 to the least significant,
  *                              respective most significant 32 bit word of
  *                              respective most significant 32 bit word of
  *                              the cpu cycles counter
  *                              the cpu cycles counter
  */
  */
@@ -119,7 +119,7 @@ inline static cycles_t get_cpu_cycles()
 		cycles_t c;
 		cycles_t c;
 		struct uint_64 u;
 		struct uint_64 u;
 	}r;
 	}r;
-	
+
 	asm volatile("rd %%tick, %0 \n\t"
 	asm volatile("rd %%tick, %0 \n\t"
 				 "srlx %0, 32, %1 \n\t"
 				 "srlx %0, 32, %1 \n\t"
 				: "=r"(r.u.u1), "=r"(r.u.u2));
 				: "=r"(r.u.u1), "=r"(r.u.u2));
@@ -159,7 +159,7 @@ struct profile_data{
 	unsigned long entries; /* no. profile_start calls */
 	unsigned long entries; /* no. profile_start calls */
 	unsigned long exits;   /* no. profile_end calls */
 	unsigned long exits;   /* no. profile_end calls */
 	char * name;
 	char * name;
-	
+
 	/* private stuff */
 	/* private stuff */
 	union profile_cycles init_rdtsc;
 	union profile_cycles init_rdtsc;
 };
 };

+ 8 - 8
test/misc/code/re_test.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 /*
 /*
@@ -64,10 +64,10 @@ int main (int argc, char** argv)
 	regmatch_t pmatch;
 	regmatch_t pmatch;
 	int match;
 	int match;
 	int eflags;
 	int eflags;
-	
+
 	int verbose;
 	int verbose;
 	char *fname;
 	char *fname;
-	
+
 	/* init */
 	/* init */
 	verbose=0;
 	verbose=0;
 	fname=0;
 	fname=0;
@@ -121,7 +121,7 @@ int main (int argc, char** argv)
 	if (optind < argc){
 	if (optind < argc){
 		re_str=argv[optind];
 		re_str=argv[optind];
 	}
 	}
-	
+
 	/* check if all the required params are present */
 	/* check if all the required params are present */
 	if (re_str==0){
 	if (re_str==0){
 		fprintf(stderr, "ERROR: no regular expression specified\n");
 		fprintf(stderr, "ERROR: no regular expression specified\n");
@@ -132,7 +132,7 @@ int main (int argc, char** argv)
 			goto error;
 			goto error;
 		}
 		}
 	}
 	}
-		
+
 	if ((fname!=0 ) &&(strcmp(fname, "-")!=0)){
 	if ((fname!=0 ) &&(strcmp(fname, "-")!=0)){
 		/* open packet file */
 		/* open packet file */
 		fd=open(fname, O_RDONLY);
 		fd=open(fname, O_RDONLY);
@@ -151,7 +151,7 @@ int main (int argc, char** argv)
 	buf[n]=0; /* null terminate it */
 	buf[n]=0; /* null terminate it */
 	if (verbose) printf("read %d bytes from file %s\n", n, fname);
 	if (verbose) printf("read %d bytes from file %s\n", n, fname);
 	if (fd!=0) close(fd); /* we don't want to close stdin */
 	if (fd!=0) close(fd); /* we don't want to close stdin */
-	
+
 	while (regexec(&re, buf, 1, &pmatch, eflags)==0){
 	while (regexec(&re, buf, 1, &pmatch, eflags)==0){
 		eflags|=REG_NOTBOL;
 		eflags|=REG_NOTBOL;
 		match++;
 		match++;
@@ -171,7 +171,7 @@ int main (int argc, char** argv)
 	if (verbose) printf("\n%d matches\n", match);
 	if (verbose) printf("\n%d matches\n", match);
 	if (match) exit(0);
 	if (match) exit(0);
 	else exit(1);
 	else exit(1);
-	
+
 error:
 error:
 	exit(-1);
 	exit(-1);
 }
 }

+ 7 - 7
test/misc/code/resolver_test.c

@@ -14,8 +14,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -57,11 +57,11 @@ int main (int argc, char** argv)
 	int errors;
 	int errors;
 	int r;
 	int r;
 	char *tmp;
 	char *tmp;
-	
+
 	int count;
 	int count;
 	int verbose;
 	int verbose;
 	char *address;
 	char *address;
-	
+
 	/* init */
 	/* init */
 	count=0;
 	count=0;
 	verbose=0;
 	verbose=0;
@@ -110,7 +110,7 @@ int main (int argc, char** argv)
 					abort();
 					abort();
 		}
 		}
 	}
 	}
-	
+
 	/* check if all the required params are present */
 	/* check if all the required params are present */
 	if (address==0){
 	if (address==0){
 		fprintf(stderr, "Missing -a address\n");
 		fprintf(stderr, "Missing -a address\n");
@@ -123,7 +123,7 @@ int main (int argc, char** argv)
 		fprintf(stderr, "Invalid count (-c %d)\n", count);
 		fprintf(stderr, "Invalid count (-c %d)\n", count);
 		exit(-1);
 		exit(-1);
 	}
 	}
-	
+
 
 
 
 
 	/* flood loop */
 	/* flood loop */
@@ -133,7 +133,7 @@ int main (int argc, char** argv)
 		he=gethostbyname(address);
 		he=gethostbyname(address);
 		if (he==0){
 		if (he==0){
 			errors++;
 			errors++;
-			if (verbose>1) 
+			if (verbose>1)
 				putchar('?');
 				putchar('?');
 		}else ok++;
 		}else ok++;
 	}
 	}

+ 12 - 12
test/misc/code/shoot.c

@@ -29,7 +29,7 @@ regex_t* regexp;
 
 
 #define RESIZE		1024
 #define RESIZE		1024
 
 
-/* take either a dot.decimal string of ip address or a 
+/* take either a dot.decimal string of ip address or a
 domain name and returns a NETWORK ordered long int containing
 domain name and returns a NETWORK ordered long int containing
 the address. i chose to internally represent the address as long for speedier
 the address. i chose to internally represent the address as long for speedier
 comparisons.
 comparisons.
@@ -94,7 +94,7 @@ long getaddress(char *host)
 /*
 /*
 shoot:
 shoot:
 takes:
 takes:
-	1. the text message of buff to 
+	1. the text message of buff to
 	2. the address (network ordered byte order)
 	2. the address (network ordered byte order)
 	3. and port (not network byte ordered).
 	3. and port (not network byte ordered).
 
 
@@ -148,15 +148,15 @@ void shoot(char *buff, long address, int lport, int rport )
 	/* should capture: SIP/2.0 100 Trying */
 	/* should capture: SIP/2.0 100 Trying */
 	/* compile("^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", compiledre, &compiledre[RESIZE], '\0'); */
 	/* compile("^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", compiledre, &compiledre[RESIZE], '\0'); */
 	regexp=(regex_t*)malloc(sizeof(regex_t));
 	regexp=(regex_t*)malloc(sizeof(regex_t));
-	regcomp(regexp, "^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", REG_EXTENDED|REG_NOSUB|REG_ICASE); 
-	
+	regcomp(regexp, "^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", REG_EXTENDED|REG_NOSUB|REG_ICASE);
+
 
 
 	/* jku - e */
 	/* jku - e */
 
 
 	addr.sin_addr.s_addr = address;
 	addr.sin_addr.s_addr = address;
 	addr.sin_port = htons((short)rport);
 	addr.sin_port = htons((short)rport);
 	addr.sin_family = AF_INET;
 	addr.sin_family = AF_INET;
-	
+
 	/* we connect as per the RFC 2543 recommendations
 	/* we connect as per the RFC 2543 recommendations
 	modified from sendto/recvfrom */
 	modified from sendto/recvfrom */
 
 
@@ -178,16 +178,16 @@ void shoot(char *buff, long address, int lport, int rport )
 			perror("send failure");
 			perror("send failure");
 			exit( 1 );
 			exit( 1 );
 		}
 		}
-		
+
 
 
 		tv.tv_sec = retryAfter/1000;
 		tv.tv_sec = retryAfter/1000;
 		tv.tv_usec = (retryAfter % 1000) * 1000;
 		tv.tv_usec = (retryAfter % 1000) * 1000;
 
 
 		FD_ZERO(&fd);
 		FD_ZERO(&fd);
-		FD_SET(ssock, &fd); 
+		FD_SET(ssock, &fd);
 
 
 		/* TO-DO: there does appear to be a problem with this select returning a zero
 		/* TO-DO: there does appear to be a problem with this select returning a zero
-		even when there is data pending in the recv queue. 
+		even when there is data pending in the recv queue.
 		please help, someone! */
 		please help, someone! */
 
 
 		ret = select(6, &fd, NULL, NULL, &tv);
 		ret = select(6, &fd, NULL, NULL, &tv);
@@ -230,8 +230,8 @@ void shoot(char *buff, long address, int lport, int rport )
 				puts(" final received; congratulations!\n ");
 				puts(" final received; congratulations!\n ");
 				exit(0);
 				exit(0);
 			}
 			}
-		
-		} 
+
+		}
 		else	{
 		else	{
 			perror("recv error");
 			perror("recv error");
 			exit(2);
 			exit(2);
@@ -299,7 +299,7 @@ int main(int argc, char *argv[])
 
 
 	shoot(buff, address, lport, rport );
 	shoot(buff, address, lport, rport );
 
 
-	/* visual studio closes the debug console as soon as the 
+	/* visual studio closes the debug console as soon as the
 	program terminates. This is to hold the window from collapsing
 	program terminates. This is to hold the window from collapsing
 	Uncomment it if needed.
 	Uncomment it if needed.
 	getchar();*/
 	getchar();*/
@@ -312,7 +312,7 @@ int main(int argc, char *argv[])
 /*
 /*
 shoot will exercise all the types of sip servers.
 shoot will exercise all the types of sip servers.
 it is not to be used to measure round-trips and general connectivity.
 it is not to be used to measure round-trips and general connectivity.
-use ping for that. 
+use ping for that.
 written by farhan on 10th august, 2000.
 written by farhan on 10th august, 2000.
 
 
 TO-DO:
 TO-DO:

+ 13 - 13
test/misc/code/shoot2.c

@@ -34,7 +34,7 @@ regex_t* regexp;
 #define VIA_BEGIN_STR "Via: SIP/2.0/UDP "
 #define VIA_BEGIN_STR "Via: SIP/2.0/UDP "
 #define VIA_BEGIN_STR_LEN 17
 #define VIA_BEGIN_STR_LEN 17
 
 
-/* take either a dot.decimal string of ip address or a 
+/* take either a dot.decimal string of ip address or a
 domain name and returns a NETWORK ordered long int containing
 domain name and returns a NETWORK ordered long int containing
 the address. i chose to internally represent the address as long for speedier
 the address. i chose to internally represent the address as long for speedier
 comparisons.
 comparisons.
@@ -141,7 +141,7 @@ add_via(char *mes)
 /*
 /*
 shoot:
 shoot:
 takes:
 takes:
-	1. the text message of buff to 
+	1. the text message of buff to
 	2. the address (network ordered byte order)
 	2. the address (network ordered byte order)
 	3. and port (not network byte ordered).
 	3. and port (not network byte ordered).
 
 
@@ -195,15 +195,15 @@ void shoot(char *buff, long address, int lport, int rport )
 	/* should capture: SIP/2.0 100 Trying */
 	/* should capture: SIP/2.0 100 Trying */
 	/* compile("^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", compiledre, &compiledre[RESIZE], '\0'); */
 	/* compile("^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", compiledre, &compiledre[RESIZE], '\0'); */
 	regexp=(regex_t*)malloc(sizeof(regex_t));
 	regexp=(regex_t*)malloc(sizeof(regex_t));
-	regcomp(regexp, "^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", REG_EXTENDED|REG_NOSUB|REG_ICASE); 
-	
+	regcomp(regexp, "^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", REG_EXTENDED|REG_NOSUB|REG_ICASE);
+
 
 
 	/* jku - e */
 	/* jku - e */
 
 
 	addr.sin_addr.s_addr = address;
 	addr.sin_addr.s_addr = address;
 	addr.sin_port = htons((short)rport);
 	addr.sin_port = htons((short)rport);
 	addr.sin_family = AF_INET;
 	addr.sin_family = AF_INET;
-	
+
 	/* we connect as per the RFC 2543 recommendations
 	/* we connect as per the RFC 2543 recommendations
 	modified from sendto/recvfrom */
 	modified from sendto/recvfrom */
 
 
@@ -215,7 +215,7 @@ void shoot(char *buff, long address, int lport, int rport )
 	/* jku - e */
 	/* jku - e */
 
 
 	add_via(buff);
 	add_via(buff);
-	
+
 	for (i = 0; i < nretries; i++)
 	for (i = 0; i < nretries; i++)
 	{
 	{
 		puts("/* request */");
 		puts("/* request */");
@@ -227,16 +227,16 @@ void shoot(char *buff, long address, int lport, int rport )
 			perror("send failure");
 			perror("send failure");
 			exit( 1 );
 			exit( 1 );
 		}
 		}
-		
+
 
 
 		tv.tv_sec = retryAfter/1000;
 		tv.tv_sec = retryAfter/1000;
 		tv.tv_usec = (retryAfter % 1000) * 1000;
 		tv.tv_usec = (retryAfter % 1000) * 1000;
 
 
 		FD_ZERO(&fd);
 		FD_ZERO(&fd);
-		FD_SET(ssock, &fd); 
+		FD_SET(ssock, &fd);
 
 
 		/* TO-DO: there does appear to be a problem with this select returning a zero
 		/* TO-DO: there does appear to be a problem with this select returning a zero
-		even when there is data pending in the recv queue. 
+		even when there is data pending in the recv queue.
 		please help, someone! */
 		please help, someone! */
 
 
 		ret = select(6, &fd, NULL, NULL, &tv);
 		ret = select(6, &fd, NULL, NULL, &tv);
@@ -279,8 +279,8 @@ void shoot(char *buff, long address, int lport, int rport )
 				puts(" final received; congratulations!\n ");
 				puts(" final received; congratulations!\n ");
 				exit(0);
 				exit(0);
 			}
 			}
-		
-		} 
+
+		}
 		else	{
 		else	{
 			perror("recv error");
 			perror("recv error");
 			exit(2);
 			exit(2);
@@ -386,7 +386,7 @@ int main(int argc, char *argv[])
 
 
 	shoot(buff, address, lport, rport );
 	shoot(buff, address, lport, rport );
 
 
-	/* visual studio closes the debug console as soon as the 
+	/* visual studio closes the debug console as soon as the
 	program terminates. This is to hold the window from collapsing
 	program terminates. This is to hold the window from collapsing
 	Uncomment it if needed.
 	Uncomment it if needed.
 	getchar();*/
 	getchar();*/
@@ -399,7 +399,7 @@ int main(int argc, char *argv[])
 /*
 /*
 shoot will exercise all the types of sip servers.
 shoot will exercise all the types of sip servers.
 it is not to be used to measure round-trips and general connectivity.
 it is not to be used to measure round-trips and general connectivity.
-use ping for that. 
+use ping for that.
 written by farhan on 10th august, 2000.
 written by farhan on 10th august, 2000.
 
 
 TO-DO:
 TO-DO:

+ 3 - 3
test/misc/code/sock_conn.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -66,7 +66,7 @@ int udp_send()
 		exit(1);
 		exit(1);
 	}
 	}
 
 
-	for (i=0; i<1024*1024*16; i++) 
+	for (i=0; i<1024*1024*16; i++)
 		write( sock, &buffer, 1 );
 		write( sock, &buffer, 1 );
 /*		sendto(sock, &buffer, 1, 0, (struct sockaddr *) &addr, sizeof(addr)); */
 /*		sendto(sock, &buffer, 1, 0, (struct sockaddr *) &addr, sizeof(addr)); */
 
 

+ 3 - 3
test/misc/code/sock_disc.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -60,7 +60,7 @@ int udp_send()
 	addr.sin_port=htons(9);
 	addr.sin_port=htons(9);
 	addr.sin_addr.s_addr= inet_addr("127.0.0.1");
 	addr.sin_addr.s_addr= inet_addr("127.0.0.1");
 
 
-	for (i=0; i<1024*1024*16; i++) 
+	for (i=0; i<1024*1024*16; i++)
 		sendto(sock, &buffer, 1, 0, (struct sockaddr *) &addr, sizeof(addr));
 		sendto(sock, &buffer, 1, 0, (struct sockaddr *) &addr, sizeof(addr));
 
 
 }
 }

+ 5 - 5
test/misc/code/test.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2001-2003 FhG Fokus
  * Copyright (C) 2001-2003 FhG Fokus
  *
  *
  * This file is part of Kamailio, a free SIP server.
  * This file is part of Kamailio, a free SIP server.
@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -45,14 +45,14 @@ int main(char** argv, int argn)
 	int r, len;
 	int r, len;
 
 
 	printf("starting\n");
 	printf("starting\n");
-	
+
 	addr.sin_family=AF_INET;
 	addr.sin_family=AF_INET;
 	addr.sin_port=htons(PORT);
 	addr.sin_port=htons(PORT);
 	addr.sin_addr.s_addr=INADDR_ANY;
 	addr.sin_addr.s_addr=INADDR_ANY;
 	to.sin_family=AF_INET;
 	to.sin_family=AF_INET;
 	to.sin_port=htons(SEND_PORT);
 	to.sin_port=htons(SEND_PORT);
 	to.sin_addr.s_addr=htonl(SEND_ADDR);
 	to.sin_addr.s_addr=htonl(SEND_ADDR);
-		
+
 
 
 	sock=socket(PF_INET, SOCK_DGRAM,0);
 	sock=socket(PF_INET, SOCK_DGRAM,0);
 	if (bind(sock, (struct sockaddr*) &addr, sizeof(struct sockaddr_in))==-1){
 	if (bind(sock, (struct sockaddr*) &addr, sizeof(struct sockaddr_in))==-1){

+ 5 - 5
test/misc/code/udp.c

@@ -27,8 +27,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -127,7 +127,7 @@ void shoot()
 #endif
 #endif
 
 
 
 
-	/* destination socket init here because it could be changed in a 
+	/* destination socket init here because it could be changed in a
 	   case of a redirect */
 	   case of a redirect */
 	addr.sin_addr.s_addr = inet_addr("192.168.99.100");
 	addr.sin_addr.s_addr = inet_addr("192.168.99.100");
 	addr.sin_port = htons((short)888);
 	addr.sin_port = htons((short)888);
@@ -135,7 +135,7 @@ void shoot()
 
 
 	/* if we don't connect, even on Linux, nothing will happen */
 	/* if we don't connect, even on Linux, nothing will happen */
 
 
-#ifdef CONNECTED	
+#ifdef CONNECTED
 	/* we connect as per the RFC 2543 recommendations
 	/* we connect as per the RFC 2543 recommendations
 	   modified from sendto/recvfrom */
 	   modified from sendto/recvfrom */
 	ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
 	ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
@@ -151,7 +151,7 @@ void shoot()
 	}
 	}
 	printf("BSD compat: %d\n", bsd_compat);
 	printf("BSD compat: %d\n", bsd_compat);
 
 
-	/* here we go for the number of nretries which heavily depends on the 
+	/* here we go for the number of nretries which heavily depends on the
 	   mode */
 	   mode */
 	for (i = 0; i <= nretries; i++)
 	for (i = 0; i <= nretries; i++)
 	{
 	{

+ 7 - 7
test/misc/code/udp_flood_disc.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -65,7 +65,7 @@ int main (int argc, char** argv)
 	char* buf[BUF_SIZE];
 	char* buf[BUF_SIZE];
 	struct hostent* he;
 	struct hostent* he;
 	struct sockaddr_in addr;
 	struct sockaddr_in addr;
-	
+
 	int count;
 	int count;
 	int verbose;
 	int verbose;
 	char *fname;
 	char *fname;
@@ -74,7 +74,7 @@ int main (int argc, char** argv)
 #ifdef __linux__
 #ifdef __linux__
 	int optval;
 	int optval;
 #endif
 #endif
-	
+
 	/* init */
 	/* init */
 	count=0;
 	count=0;
 	verbose=0;
 	verbose=0;
@@ -133,7 +133,7 @@ int main (int argc, char** argv)
 					abort();
 					abort();
 		}
 		}
 	}
 	}
-	
+
 	/* check if all the required params are present */
 	/* check if all the required params are present */
 	if (fname==0){
 	if (fname==0){
 		fprintf(stderr, "Missing -f file\n");
 		fprintf(stderr, "Missing -f file\n");
@@ -157,7 +157,7 @@ int main (int argc, char** argv)
 		fprintf(stderr, "Invalid packet count (-c %d)\n", count);
 		fprintf(stderr, "Invalid packet count (-c %d)\n", count);
 		exit(-1);
 		exit(-1);
 	}
 	}
-	
+
 	/* open packet file */
 	/* open packet file */
 	fd=open(fname, O_RDONLY);
 	fd=open(fname, O_RDONLY);
 	if (fd<0){
 	if (fd<0){
@@ -184,7 +184,7 @@ int main (int argc, char** argv)
 	addr.sin_family=he->h_addrtype;
 	addr.sin_family=he->h_addrtype;
 	addr.sin_port=htons(port);
 	addr.sin_port=htons(port);
 	memcpy(&addr.sin_addr.s_addr, he->h_addr_list[0], he->h_length);
 	memcpy(&addr.sin_addr.s_addr, he->h_addr_list[0], he->h_length);
-	
+
 	sock = socket(he->h_addrtype, SOCK_DGRAM, 0);
 	sock = socket(he->h_addrtype, SOCK_DGRAM, 0);
 	if (sock==-1){
 	if (sock==-1){
 		fprintf(stderr, "ERROR: socket: %s\n", strerror(errno));
 		fprintf(stderr, "ERROR: socket: %s\n", strerror(errno));

+ 5 - 5
test/misc/code/udp_test_proxy.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2001-2003 FhG Fokus
  * Copyright (C) 2001-2003 FhG Fokus
  *
  *
  * This file is part of Kamailio, a free SIP server.
  * This file is part of Kamailio, a free SIP server.
@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -76,7 +76,7 @@ int main(int argc, char** argv)
 	src=dst=0;
 	src=dst=0;
 	n=0;
 	n=0;
 	use_diff_ssock=0;
 	use_diff_ssock=0;
-	
+
 	opterr=0;
 	opterr=0;
 	while ((c=getopt(argc,argv, "l:p:d:s:n:2vhV"))!=-1){
 	while ((c=getopt(argc,argv, "l:p:d:s:n:2vhV"))!=-1){
 		switch(c){
 		switch(c){
@@ -197,7 +197,7 @@ int main(int argc, char** argv)
 		s_sock = socket(he->h_addrtype, SOCK_DGRAM, 0);
 		s_sock = socket(he->h_addrtype, SOCK_DGRAM, 0);
 	else
 	else
 		s_sock=sock;
 		s_sock=sock;
-	
+
 	if ((sock==-1)||(s_sock==-1)){
 	if ((sock==-1)||(s_sock==-1)){
 		fprintf(stderr, "ERROR: socket: %s\n", strerror(errno));
 		fprintf(stderr, "ERROR: socket: %s\n", strerror(errno));
 		goto error;
 		goto error;

+ 26 - 26
test/misc/code/via_parse.c

@@ -15,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * 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 
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -25,7 +25,7 @@
 /* parsing:           compact form:
 /* parsing:           compact form:
  */
  */
 
 
-/* 
+/*
  * still TODO/test:
  * still TODO/test:
  *  - parse next via
  *  - parse next via
  *  - return a list of header structs
  *  - return a list of header structs
@@ -74,9 +74,9 @@ enum{	L_VALUE=200,   F_VALUE, P_VALUE, P_STRING,
 #define LOG(lev, fmt, args...) fprintf(stderr, fmt, ## args)
 #define LOG(lev, fmt, args...) fprintf(stderr, fmt, ## args)
 
 
 
 
-/* entry state must be F_PARAM, or saved_state=F_PARAM and 
+/* entry state must be F_PARAM, or saved_state=F_PARAM and
  * state=F_{LF,CR,CRLF}!
  * state=F_{LF,CR,CRLF}!
- * output state = L_PARAM or F_PARAM or END_OF_HEADER 
+ * output state = L_PARAM or F_PARAM or END_OF_HEADER
  * (and saved_state= last state); everything else => error */
  * (and saved_state= last state); everything else => error */
 __inline char* parse_via_param(char* p, int* pstate, int* psaved_state)
 __inline char* parse_via_param(char* p, int* pstate, int* psaved_state)
 {
 {
@@ -86,12 +86,12 @@ __inline char* parse_via_param(char* p, int* pstate, int* psaved_state)
 	int param_type;
 	int param_type;
 	char* param_name;
 	char* param_name;
 	char* param_value;
 	char* param_value;
-	
+
 	state=*pstate;
 	state=*pstate;
 	saved_state=*psaved_state;
 	saved_state=*psaved_state;
 	param_name=param_value=0;
 	param_name=param_value=0;
 	param_type=0;
 	param_type=0;
-	
+
 	for (tmp=p;*tmp;tmp++){
 	for (tmp=p;*tmp;tmp++){
 		switch(*tmp){
 		switch(*tmp){
 			case ' ':
 			case ' ':
@@ -253,7 +253,7 @@ __inline char* parse_via_param(char* p, int* pstate, int* psaved_state)
 						goto endofparam;
 						goto endofparam;
 				}
 				}
 				break;
 				break;
-				
+
 				/* param names */
 				/* param names */
 			case 'h':
 			case 'h':
 			case 'H':
 			case 'H':
@@ -558,7 +558,7 @@ find_value:
 				switch(state){
 				switch(state){
 					case L_VALUE:
 					case L_VALUE:
 					case F_VALUE: /*eat space*/
 					case F_VALUE: /*eat space*/
-						break; 
+						break;
 					case P_VALUE:
 					case P_VALUE:
 						*tmp=0;
 						*tmp=0;
 						state=L_PARAM;
 						state=L_PARAM;
@@ -583,7 +583,7 @@ find_value:
 					case P_STRING:
 					case P_STRING:
 						saved_state=state;
 						saved_state=state;
 						state=F_LF;
 						state=F_LF;
-						break; 
+						break;
 					case P_VALUE:
 					case P_VALUE:
 						*tmp=0;
 						*tmp=0;
 						saved_state=L_PARAM;
 						saved_state=L_PARAM;
@@ -609,7 +609,7 @@ find_value:
 					case P_STRING:
 					case P_STRING:
 						saved_state=state;
 						saved_state=state;
 						state=F_CR;
 						state=F_CR;
-						break; 
+						break;
 					case P_VALUE:
 					case P_VALUE:
 						*tmp=0;
 						*tmp=0;
 						saved_state=L_PARAM;
 						saved_state=L_PARAM;
@@ -664,7 +664,7 @@ find_value:
 						goto error;
 						goto error;
 				}
 				}
 				break;
 				break;
-			
+
 			case '"':
 			case '"':
 				switch(state){
 				switch(state){
 					case F_VALUE:
 					case F_VALUE:
@@ -760,7 +760,7 @@ int main(int argc, char** argv)
 			fprintf(stderr, " no parameters\n");
 			fprintf(stderr, " no parameters\n");
 			exit(-1);
 			exit(-1);
 	}
 	}
-	
+
 	/* parse start of via ( SIP/2.0/UDP    )*/
 	/* parse start of via ( SIP/2.0/UDP    )*/
 	state=F_SIP;
 	state=F_SIP;
 	for(tmp=argv[1];*tmp;tmp++){
 	for(tmp=argv[1];*tmp;tmp++){
@@ -871,7 +871,7 @@ int main(int argc, char** argv)
 						goto error;
 						goto error;
 				}
 				}
 				break;
 				break;
-			
+
 			case '/':
 			case '/':
 				switch(state){
 				switch(state){
 					case FIN_SIP:
 					case FIN_SIP:
@@ -1007,7 +1007,7 @@ int main(int argc, char** argv)
 						goto error;
 						goto error;
 				}
 				}
 				break;
 				break;
-			
+
 			default:
 			default:
 				switch(state){
 				switch(state){
 					case F_PROTO:
 					case F_PROTO:
@@ -1070,7 +1070,7 @@ main_via:
 						break;
 						break;
 					case P_IP6HOST:
 					case P_IP6HOST:
 						*tmp=0; /*mark end of host*/
 						*tmp=0; /*mark end of host*/
-						state=L_PORT; 
+						state=L_PORT;
 						break;
 						break;
 					case F_CRLF:
 					case F_CRLF:
 					case F_LF:
 					case F_LF:
@@ -1170,7 +1170,7 @@ main_via:
 						goto  error;
 						goto  error;
 				}
 				}
 			break;
 			break;
-			
+
 			case ':':
 			case ':':
 				switch(state){
 				switch(state){
 					case F_HOST:
 					case F_HOST:
@@ -1269,7 +1269,7 @@ main_via:
 						break;
 						break;
 					case P_COMMENT: /*everything is allowed in a comment*/
 					case P_COMMENT: /*everything is allowed in a comment*/
 						break;
 						break;
-					
+
 					default:
 					default:
 						LOG(L_CRIT,"BUG: parse_via"
 						LOG(L_CRIT,"BUG: parse_via"
 							" on <%c> state %d\n",
 							" on <%c> state %d\n",
@@ -1304,7 +1304,7 @@ main_via:
 						goto error;
 						goto error;
 					case F_VIA:
 					case F_VIA:
 						/* do  nothing,  eat ","*/
 						/* do  nothing,  eat ","*/
-						break;	
+						break;
 					case F_CRLF:
 					case F_CRLF:
 					case F_LF:
 					case F_LF:
 					case F_CR:
 					case F_CR:
@@ -1460,7 +1460,7 @@ main_via:
 						goto  error;
 						goto  error;
 				}
 				}
 				break;
 				break;
-						
+
 			default:
 			default:
 				switch(state){
 				switch(state){
 					case F_HOST:
 					case F_HOST:
@@ -1535,14 +1535,14 @@ main_via:
 							*tmp, state);
 							*tmp, state);
 						goto error;
 						goto error;
 				}
 				}
-				
-					
-		}			
+
+
+		}
 	}
 	}
 
 
 	printf("end of packet reached, state=%d\n", state);
 	printf("end of packet reached, state=%d\n", state);
 	goto endofpacket; /*end of packet, probably should be goto error*/
 	goto endofpacket; /*end of packet, probably should be goto error*/
-	
+
 endofheader:
 endofheader:
 	state=saved_state;
 	state=saved_state;
 	printf("end of header reached, state=%d\n", state);
 	printf("end of header reached, state=%d\n", state);
@@ -1564,7 +1564,7 @@ endofpacket:
 					" state %d\n", state);
 					" state %d\n", state);
 			goto error;
 			goto error;
 	}
 	}
-		
+
 nextvia:
 nextvia:
 	if (proto) printf("<SIP/2.0/%s>\n", proto);
 	if (proto) printf("<SIP/2.0/%s>\n", proto);
 	if (host) printf("host= <%s>\n", host);
 	if (host) printf("host= <%s>\n", host);
@@ -1573,7 +1573,7 @@ nextvia:
 	if (comment) printf("comment= <%s>\n", comment);
 	if (comment) printf("comment= <%s>\n", comment);
 	if(next_via) printf("next_via= <%s>\n", next_via);
 	if(next_via) printf("next_via= <%s>\n", next_via);
 	printf("rest=<%s>\n", tmp);
 	printf("rest=<%s>\n", tmp);
-	
+
 	exit(0);
 	exit(0);
 
 
 error:
 error: