ソースを参照

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

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

@@ -13,24 +13,24 @@
  *           __CPU_xxx - use __CPU_xxx code
  *           SPARC64_MODE - compile for a sparc 64 in 64 bit mode (gcc -m64
  *                          must be used on solaris in this case)
- *  Example:  
+ *  Example:
  *    gcc -Wall -O3 -D__CPU_i386 -DNOSMP -DMEMBAR -DTYPE=long atomic_test2.c
- * 
+ *
  *  Compile with: gcc -Wall -O3 -D__CPU_i386  ... on x86 machines
  *                gcc -Wall -O3 -D__CPU_x86_64 ... on amd64 machines
  *                gcc -mips2 -Wall -O2 -D__CPU_mips2  ... on mips machines
  *                gcc -m64 -Wall -O2 -D__CPU_mips64 ... on mips64 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_sparc64 -DSPARC64_MODE ... on 
+ *                gcc -m64 -O3 -Wall -D__CPU_sparc64 -DSPARC64_MODE ... on
  *                                                   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
  *                gcc -O3 -Wall -D__CPU_sparc ... on sparc v8 machines
  *  -- andrei
  *
- *  
+ *
  */
 
 #include <stdio.h>
@@ -165,12 +165,12 @@ int main(int argc, char** argv)
 {
 	ATOMIC_TYPE var;
 	VALUE_TYPE r;
-	
+
 	ATOMIC_TYPE* v;
-	
+
 	v=&var;
-	
-	
+
+
 #ifdef MEMBAR_USES_LOCK
 	__membar_lock=&dummy_membar_lock;
 	if (lock_init(__membar_lock)==0){
@@ -199,9 +199,9 @@ int main(int argc, char** argv)
 		goto error;
 	}
 #endif
-	
+
 	printf("%s\n", flags);
-	
+
 	printf("starting memory barrier opcode tests...\n");
 	membar();
 	printf(" membar() .............................. ok\n");
@@ -227,9 +227,9 @@ int main(int argc, char** argv)
 	printf(" membar_write_atomic_op() .............. ok\n");
 	membar_write_atomic_setget();
 	printf(" membar_write_atomic_setget() .......... ok\n");
-	
+
 	printf("\nstarting atomic ops basic tests...\n");
-	
+
 	VERIFY(at_set(v, 1), 1);
 	printf(" atomic_set, v should be 1 ............. %2d\n", (int)at_get(v));
 	VERIFY(at_inc(v), 2);
@@ -237,7 +237,7 @@ int main(int argc, char** argv)
 	VERIFY(r=at_inc_and_test(v), 3);
 	printf(" atomic_inc_and_test, v should be  3 ... %2d\n", (int)at_get(v));
 	printf("                      r should be  0 ... %2d\n", (int)r);
-	
+
 	VERIFY(at_dec(v), 2);
 	printf(" atomic_dec, v should be 2 ............. %2d\n", (int)at_get(v));
 	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);
 	printf(" atomic_dec_and_test, v should be -1 ... %2d\n", (int)at_get(v));
 	printf("                      r should be  0 ... %2d\n", (int)r);
-	
+
 	VERIFY(at_and(v, 2), 2);
 	printf(" atomic_and, v should be 2 ............. %2d\n", (int)at_get(v));
-	
+
 	VERIFY(at_or(v, 5), 7);
 	printf(" atomic_or,  v should be 7 ............. %2d\n", (int)at_get(v));
 	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("             r should be -1 ............ %2d\n", (int)r);
 
-	
+
 	printf("\ndone.\n");
 #ifdef MEMBAR_USES_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
  * 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
  */
 
@@ -72,9 +72,9 @@ int main(int argc, char** argv)
 			fprintf(stderr, " no parameters\n");
 			exit(-1);
 	}
-	
+
 	for (i=0;i<10000000;i++){
-		
+
 	for(t=argv[1];*t;t++){
 		switch(*t){
 			case 'V':
@@ -415,7 +415,7 @@ int main(int argc, char** argv)
 								break;
 							case UNKNOWN_HEADER:
 							default:
-								/*printf("found unknown header, state=%d\n", 
+								/*printf("found unknown header, state=%d\n",
 											state);*/
 								err=1;
 								state=INITIAL;

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

@@ -76,9 +76,9 @@
 #define QUOTEME(x) #x
 
 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) ""
-#if defined BASE64_LOOKUP_TABLE 
+#if defined BASE64_LOOKUP_TABLE
 #ifdef BASE64_LOOKUP_LARGE
 " (large b64 lookup table)"
 #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),"
 			" 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->total_cycles);
 }
@@ -135,7 +135,7 @@ void dump_profile_info(struct profile_data* pd)
 int seed_prng()
 {
 	int seed, rfd;
-	
+
 	if ((rfd=open("/dev/urandom", O_RDONLY))!=-1){
 try_again:
 		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
 						  aligned stuff malloc returns */
-	
-	
+
+
 	seed_prng();
 	/* profile */
 	profile_init(&pf1, "encode");
 	profile_init(&pf2, "decode");
-	
+
 	init_basex();
 	if (verbose)
 		printf("starting (loops %d, min size %d, max size %d, offset %d,"
 				", e_offset %d, buffer sizes %d %d %d)\n",
 				loops, min_len, max_len, offset, e_offset, ibuf_len,
 				enc_buf_len, dec_buf_len);
-		
+
 		for (r=0; r<loops; r++){
 			if (min_len!=max_len)
 				/* test encode/decode random data w/ random length*/
 				c_len= min_len+(int)((float)(max_len-min_len+1)*
 											(rand()/(RAND_MAX+1.0)));
-			else 
+			else
 				/* test encode /decode random data w/ fixed length*/
 				c_len=max_len;
 			if (offset==-1)
@@ -361,9 +361,9 @@ int main(int argc, char** argv)
 				printf("loop %d, current len %d, offset %d, start %p\n",
 							r, c_len-offs, offs, &ibuf[offs]);
 			else if ((verbose >1) && (r %10==0)) putchar('.');
-			
+
 			fill_rand(ibuf, c_len);
-			
+
 			c_len-=offs;
 			e_len=B_ENC_LEN(c_len);
 			profile_start(&pf1);

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

@@ -1,7 +1,7 @@
 /*
  * test bit_scan operations from bit_scan.h
  *  (both for correctness  and speed)
- * 
+ *
  * Copyright (C) 2007 iptelorg GmbH
  *
  * 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
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-/* 
+/*
  * Example gcc command line:
  *  gcc -O9 -Wall -DCC_GCC_LIKE_ASM  -D__CPU_x86 bit_scan_test.c ../bit_scan.c
  *      -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_long, pdl_long;
 #endif /* NO_PROFILE */
-	
+
 	profile_init(&pdf1, "first_debruijn32");
 	profile_init(&pdf2, "first_slow32");
 #ifdef HAS_BIT_SCAN_ASM
@@ -111,7 +111,7 @@ int main(int argc, char** argv)
 	profile_init(&pdl7, "last_asm64");
 #endif
 	profile_init(&pdl8, "last_br64");
-	
+
 	profile_init(&pdf_32, "scan_forward32");
 	profile_init(&pdf_64, "scan_forward64");
 	profile_init(&pdl_32, "scan_reverse32");
@@ -195,7 +195,7 @@ int main(int argc, char** argv)
 	PROFILE_PRINT(&pdl7);
 #endif
 	PROFILE_PRINT(&pdl8);
-	
+
 	PROFILE_PRINT(&pdf_32);
 	PROFILE_PRINT(&pdf_64);
 	PROFILE_PRINT(&pdf_long);

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

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

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

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

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

@@ -13,8 +13,8 @@
  * 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 
+ * 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
  */
 
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
 	unsigned char** h;
 
 	name=0;
-	
+
 	opterr=0;
 	while ((c=getopt(argc, argv, "n:hV"))!=-1){
 		switch(c){
@@ -78,18 +78,18 @@ int main(int argc, char** argv)
 				abort();
 		}
 	}
-	
+
 	if (name==0){
 		fprintf(stderr, "Missing domain name (-n name)\n");
 		goto error;
 	}
-	
+
 	he=gethostbyname(name);
 	if (he==0){
 			printf("bad address <%s>\n", name);
 			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");
 	else{
 		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
  * 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
  */
 
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
 	unsigned char** h;
 
 	name=0;
-	
+
 	opterr=0;
 	while ((c=getopt(argc, argv, "n:hV"))!=-1){
 		switch(c){
@@ -78,12 +78,12 @@ int main(int argc, char** argv)
 				abort();
 		}
 	}
-	
+
 	if (name==0){
 		fprintf(stderr, "Missing domain name (-n name)\n");
 		goto error;
 	}
-	
+
 	he=gethostbyname(name);
 	if (he==0) printf("no answer\n");
 	else{

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

@@ -15,8 +15,8 @@
  * 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 
+ * 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
  */
  /*
@@ -73,7 +73,7 @@ void print_sockaddr(struct sockaddr* sa)
 {
 	unsigned char* buf;
 	int r;
-	
+
 	switch(sa->sa_family){
 	case AF_INET:
 		buf=(char*)&(((struct sockaddr_in*)sa)->sin_addr).s_addr;
@@ -81,14 +81,14 @@ void print_sockaddr(struct sockaddr* sa)
 		break;
 	case AF_INET6:
 		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("\n");
 		break;
 	default:
 		printf("unknown af %d\n", sa->sa_family);
 #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("\n");
 #endif
@@ -101,18 +101,18 @@ int ls_ifflags(char* name, int family , int options)
 {
 	struct ifreq ifr;
 	int s;
-	
+
 	memset(&ifr, 0, sizeof(ifr)); /* init to 0 (check if filled)*/
 	s=socket(family, SOCK_DGRAM, 0);
 	strncpy(ifr.ifr_name, name, IFNAMSIZ);
-#if 0	
+#if 0
 	if (ioctl(s, SIOCGIFADDR, &ifr)==-1){
 		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));
 		goto error;
 	};
-	
+
 	printf("%s:\n", ifr.ifr_name);
 	printf("        dbg: family=%d", ifr.ifr_addr.sa_family);
 #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");
 		goto error;
 	}
-	
+
 	printf("        ");
 	print_sockaddr(&ifr.ifr_addr);
 
@@ -170,7 +170,7 @@ int ls_ifflags(char* name, int family , int options)
 			}
 		}
 	};
-		
+
 	close(s);
 	return 0;
 error:
@@ -188,7 +188,7 @@ int ls_ifs(char* name, int family, int options)
 	int size;
 	int lastlen;
 	int s;
-	
+
 	/* ipv4 or ipv6 only*/
 	s=socket(family, SOCK_DGRAM, 0);
 	lastlen=0;
@@ -210,7 +210,7 @@ int ls_ifs(char* name, int family, int options)
 		/* try a bigger array*/
 		free(ifc.ifc_req);
 	}
-	
+
 	last=(char*)ifc.ifc_req+ifc.ifc_len;
 	for(ifr=ifc.ifc_req; (char*)ifr<last;
 			ifr=(struct ifreq*)((char*)ifr+sizeof(ifr->ifr_name)+
@@ -266,8 +266,8 @@ int main(int argc, char**argv)
 	int ipv6, ipv4;
 	int r;
 	char c;
-	
-	
+
+
 	options=0;
 	ipv6=ipv4=1;
 	name=0;
@@ -324,7 +324,7 @@ int main(int argc, char**argv)
 		no=argc-optind;
 		name=&argv[optind];
 	}
-	
+
 	if (no==0){
 		/* list all interfaces */
 		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);
 		}
 	};
-	
-	
+
+
 	exit(0);
 error:
 	exit(-1);

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

@@ -1,13 +1,13 @@
 /*
- * 
+ *
  *  simple locking test program
  *  (no paralles stuff)
- * 
+ *
  *  Compile with: gcc -D__CPU_i386 -O3 on x86 machines and
  *                gcc -mips2 -O2 -D__CPU_mips2  on mips machines.
  *  -- andrei
  *
- *  
+ *
  */
 
 #include <stdio.h>
@@ -19,10 +19,10 @@ int main(int argc, char** argv)
 {
 	fl_lock_t lock;
 	int r;
-	
+
 	lock=0;
 	printf("starting locking basic tests...\n");
-	
+
 	r=try_lock(&lock);
 	printf(" try_lock should return 0            ... %d\n", r);
 	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
  * 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
  */
 
@@ -174,14 +174,14 @@ int main (int argc, char** argv)
 	int c;
 	int r;
 	char *tmp;
-	
+
 	int count;
 	int verbose;
 	char *address;
 #ifdef SYSV_SEM
 	union semun su;
 #endif
-	
+
 	/* init */
 	count=0;
 	verbose=0;
@@ -228,7 +228,7 @@ int main (int argc, char** argv)
 		}
 	}
 
-	
+
 	/* check if all the required params are present */
 	if(count==0){
 		fprintf(stderr, "Missing count (-c number)\n");

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

@@ -2,12 +2,12 @@
  *
  *  simple locking test program
  *  (no paralles stuff)
- * 
+ *
  *  Compile with: gcc -D__CPU_i386 -O3 on x86 machines and
  *                gcc -mips2 -O2 -D__CPU_mips  on mips machines.
  *  -- andrei
  *
- *  
+ *
  */
 
 #include <stdio.h>
@@ -19,10 +19,10 @@ typedef volatile int fl_lock_t;
 int tsl(fl_lock_t* lock)
 {
 	long val;
-	
+
 #ifdef __CPU_mips
 	long tmp=0;
-	
+
 	asm volatile(
 		".set noreorder\n\t"
 		"1:  ll %1, %2   \n\t"
@@ -31,19 +31,19 @@ int tsl(fl_lock_t* lock)
 		"    beqz %0, 1b \n\t"
 		"    nop \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"
 	);
 #elif defined __CPU_i386
 	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
 #error "cpu type not defined, add -D__CPU_<type> when compiling"
 #endif
-	
+
 	return val;
 }
 
@@ -64,7 +64,7 @@ void release_lock(fl_lock_t* lock)
 #elif defined __CPU_i386
 	asm volatile(
 		" movb $0, (%0)" : /*no output*/ : "r"(lock): "memory"
-	); 
+	);
 #else
 #error "cpu type not defined, add -D__CPU_<type> when compiling"
 #endif
@@ -76,10 +76,10 @@ int main(int argc, char** argv)
 {
 	fl_lock_t lock;
 	int r;
-	
+
 	lock=0;
 	printf("starting locking basic tests...\n");
-	
+
 	r=tsl(&lock);
 	printf(" tsl should return 0                 ... %d\n", r);
 	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]);
 		exit(1);
 	}
-	
+
 	for (r=1; r<argc; r++){
 		if (parse_uri(argv[r], strlen(argv[r]), &uri)<0){
 			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]);
 		exit(1);
 	}
-	
+
 	for (r=1; r<argc; r++){
 		/*memset(&to_b, 0, sizeof(to_b));*/
 		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
  *
- * 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
  *                              the cpu cycles counter
  * struct profile_data;            - holds all the profile results
  *                               (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)
  * void     profile_init(pd, name) - initialize a profile structure
  * void     profile_start(pd)      - starts profiling (call before calling
  *                               the target function)
  * void     profile_end(pd)        - stops profiling (call after the target
  *                               function returns)
- * 
+ *
  */
  /*
  * Config defines:   CC_GCC_LIKE_ASM  - the compiler support gcc style
  *                     inline asm,
  *                  __CPU_x86, __CPU_x86_64, __CPU_sparc64
  */
-/* 
+/*
  * History:
  * --------
  *  2007-06-23  created by andrei
@@ -60,8 +60,8 @@
  *            (unsigned long long for now)
  *
  * 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
  *                              the cpu cycles counter
  */
@@ -119,7 +119,7 @@ inline static cycles_t get_cpu_cycles()
 		cycles_t c;
 		struct uint_64 u;
 	}r;
-	
+
 	asm volatile("rd %%tick, %0 \n\t"
 				 "srlx %0, 32, %1 \n\t"
 				: "=r"(r.u.u1), "=r"(r.u.u2));
@@ -159,7 +159,7 @@ struct profile_data{
 	unsigned long entries; /* no. profile_start calls */
 	unsigned long exits;   /* no. profile_end calls */
 	char * name;
-	
+
 	/* private stuff */
 	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
  * 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
  */
 /*
@@ -64,10 +64,10 @@ int main (int argc, char** argv)
 	regmatch_t pmatch;
 	int match;
 	int eflags;
-	
+
 	int verbose;
 	char *fname;
-	
+
 	/* init */
 	verbose=0;
 	fname=0;
@@ -121,7 +121,7 @@ int main (int argc, char** argv)
 	if (optind < argc){
 		re_str=argv[optind];
 	}
-	
+
 	/* check if all the required params are present */
 	if (re_str==0){
 		fprintf(stderr, "ERROR: no regular expression specified\n");
@@ -132,7 +132,7 @@ int main (int argc, char** argv)
 			goto error;
 		}
 	}
-		
+
 	if ((fname!=0 ) &&(strcmp(fname, "-")!=0)){
 		/* open packet file */
 		fd=open(fname, O_RDONLY);
@@ -151,7 +151,7 @@ int main (int argc, char** argv)
 	buf[n]=0; /* null terminate it */
 	if (verbose) printf("read %d bytes from file %s\n", n, fname);
 	if (fd!=0) close(fd); /* we don't want to close stdin */
-	
+
 	while (regexec(&re, buf, 1, &pmatch, eflags)==0){
 		eflags|=REG_NOTBOL;
 		match++;
@@ -171,7 +171,7 @@ int main (int argc, char** argv)
 	if (verbose) printf("\n%d matches\n", match);
 	if (match) exit(0);
 	else exit(1);
-	
+
 error:
 	exit(-1);
 }

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

@@ -14,8 +14,8 @@
  * 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 
+ * 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
  */
 
@@ -57,11 +57,11 @@ int main (int argc, char** argv)
 	int errors;
 	int r;
 	char *tmp;
-	
+
 	int count;
 	int verbose;
 	char *address;
-	
+
 	/* init */
 	count=0;
 	verbose=0;
@@ -110,7 +110,7 @@ int main (int argc, char** argv)
 					abort();
 		}
 	}
-	
+
 	/* check if all the required params are present */
 	if (address==0){
 		fprintf(stderr, "Missing -a address\n");
@@ -123,7 +123,7 @@ int main (int argc, char** argv)
 		fprintf(stderr, "Invalid count (-c %d)\n", count);
 		exit(-1);
 	}
-	
+
 
 
 	/* flood loop */
@@ -133,7 +133,7 @@ int main (int argc, char** argv)
 		he=gethostbyname(address);
 		if (he==0){
 			errors++;
-			if (verbose>1) 
+			if (verbose>1)
 				putchar('?');
 		}else ok++;
 	}

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

@@ -29,7 +29,7 @@ regex_t* regexp;
 
 #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
 the address. i chose to internally represent the address as long for speedier
 comparisons.
@@ -94,7 +94,7 @@ long getaddress(char *host)
 /*
 shoot:
 takes:
-	1. the text message of buff to 
+	1. the text message of buff to
 	2. the address (network ordered byte order)
 	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 */
 	/* compile("^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", compiledre, &compiledre[RESIZE], '\0'); */
 	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 */
 
 	addr.sin_addr.s_addr = address;
 	addr.sin_port = htons((short)rport);
 	addr.sin_family = AF_INET;
-	
+
 	/* we connect as per the RFC 2543 recommendations
 	modified from sendto/recvfrom */
 
@@ -178,16 +178,16 @@ void shoot(char *buff, long address, int lport, int rport )
 			perror("send failure");
 			exit( 1 );
 		}
-		
+
 
 		tv.tv_sec = retryAfter/1000;
 		tv.tv_usec = (retryAfter % 1000) * 1000;
 
 		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
-		even when there is data pending in the recv queue. 
+		even when there is data pending in the recv queue.
 		please help, someone! */
 
 		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 ");
 				exit(0);
 			}
-		
-		} 
+
+		}
 		else	{
 			perror("recv error");
 			exit(2);
@@ -299,7 +299,7 @@ int main(int argc, char *argv[])
 
 	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
 	Uncomment it if needed.
 	getchar();*/
@@ -312,7 +312,7 @@ int main(int argc, char *argv[])
 /*
 shoot will exercise all the types of sip servers.
 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.
 
 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_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
 the address. i chose to internally represent the address as long for speedier
 comparisons.
@@ -141,7 +141,7 @@ add_via(char *mes)
 /*
 shoot:
 takes:
-	1. the text message of buff to 
+	1. the text message of buff to
 	2. the address (network ordered byte order)
 	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 */
 	/* compile("^SIP/[0-9]\\.[0-9] 1[0-9][0-9] ", compiledre, &compiledre[RESIZE], '\0'); */
 	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 */
 
 	addr.sin_addr.s_addr = address;
 	addr.sin_port = htons((short)rport);
 	addr.sin_family = AF_INET;
-	
+
 	/* we connect as per the RFC 2543 recommendations
 	modified from sendto/recvfrom */
 
@@ -215,7 +215,7 @@ void shoot(char *buff, long address, int lport, int rport )
 	/* jku - e */
 
 	add_via(buff);
-	
+
 	for (i = 0; i < nretries; i++)
 	{
 		puts("/* request */");
@@ -227,16 +227,16 @@ void shoot(char *buff, long address, int lport, int rport )
 			perror("send failure");
 			exit( 1 );
 		}
-		
+
 
 		tv.tv_sec = retryAfter/1000;
 		tv.tv_usec = (retryAfter % 1000) * 1000;
 
 		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
-		even when there is data pending in the recv queue. 
+		even when there is data pending in the recv queue.
 		please help, someone! */
 
 		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 ");
 				exit(0);
 			}
-		
-		} 
+
+		}
 		else	{
 			perror("recv error");
 			exit(2);
@@ -386,7 +386,7 @@ int main(int argc, char *argv[])
 
 	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
 	Uncomment it if needed.
 	getchar();*/
@@ -399,7 +399,7 @@ int main(int argc, char *argv[])
 /*
 shoot will exercise all the types of sip servers.
 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.
 
 TO-DO:

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

@@ -13,8 +13,8 @@
  * 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 
+ * 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
  */
 
@@ -66,7 +66,7 @@ int udp_send()
 		exit(1);
 	}
 
-	for (i=0; i<1024*1024*16; i++) 
+	for (i=0; i<1024*1024*16; i++)
 		write( sock, &buffer, 1 );
 /*		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
  * 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
  */
 
@@ -60,7 +60,7 @@ int udp_send()
 	addr.sin_port=htons(9);
 	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));
 
 }

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

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2001-2003 FhG Fokus
  *
  * This file is part of Kamailio, a free SIP server.
@@ -13,8 +13,8 @@
  * 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 
+ * 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
  */
 
@@ -45,14 +45,14 @@ int main(char** argv, int argn)
 	int r, len;
 
 	printf("starting\n");
-	
+
 	addr.sin_family=AF_INET;
 	addr.sin_port=htons(PORT);
 	addr.sin_addr.s_addr=INADDR_ANY;
 	to.sin_family=AF_INET;
 	to.sin_port=htons(SEND_PORT);
 	to.sin_addr.s_addr=htonl(SEND_ADDR);
-		
+
 
 	sock=socket(PF_INET, SOCK_DGRAM,0);
 	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
  * 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
  */
 
@@ -127,7 +127,7 @@ void shoot()
 #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 */
 	addr.sin_addr.s_addr = inet_addr("192.168.99.100");
 	addr.sin_port = htons((short)888);
@@ -135,7 +135,7 @@ void shoot()
 
 	/* if we don't connect, even on Linux, nothing will happen */
 
-#ifdef CONNECTED	
+#ifdef CONNECTED
 	/* we connect as per the RFC 2543 recommendations
 	   modified from sendto/recvfrom */
 	ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
@@ -151,7 +151,7 @@ void shoot()
 	}
 	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 */
 	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
  * 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
  */
 
@@ -65,7 +65,7 @@ int main (int argc, char** argv)
 	char* buf[BUF_SIZE];
 	struct hostent* he;
 	struct sockaddr_in addr;
-	
+
 	int count;
 	int verbose;
 	char *fname;
@@ -74,7 +74,7 @@ int main (int argc, char** argv)
 #ifdef __linux__
 	int optval;
 #endif
-	
+
 	/* init */
 	count=0;
 	verbose=0;
@@ -133,7 +133,7 @@ int main (int argc, char** argv)
 					abort();
 		}
 	}
-	
+
 	/* check if all the required params are present */
 	if (fname==0){
 		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);
 		exit(-1);
 	}
-	
+
 	/* open packet file */
 	fd=open(fname, O_RDONLY);
 	if (fd<0){
@@ -184,7 +184,7 @@ int main (int argc, char** argv)
 	addr.sin_family=he->h_addrtype;
 	addr.sin_port=htons(port);
 	memcpy(&addr.sin_addr.s_addr, he->h_addr_list[0], he->h_length);
-	
+
 	sock = socket(he->h_addrtype, SOCK_DGRAM, 0);
 	if (sock==-1){
 		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
  *
  * This file is part of Kamailio, a free SIP server.
@@ -13,8 +13,8 @@
  * 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 
+ * 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
  */
 
@@ -76,7 +76,7 @@ int main(int argc, char** argv)
 	src=dst=0;
 	n=0;
 	use_diff_ssock=0;
-	
+
 	opterr=0;
 	while ((c=getopt(argc,argv, "l:p:d:s:n:2vhV"))!=-1){
 		switch(c){
@@ -197,7 +197,7 @@ int main(int argc, char** argv)
 		s_sock = socket(he->h_addrtype, SOCK_DGRAM, 0);
 	else
 		s_sock=sock;
-	
+
 	if ((sock==-1)||(s_sock==-1)){
 		fprintf(stderr, "ERROR: socket: %s\n", strerror(errno));
 		goto error;

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

@@ -15,8 +15,8 @@
  * 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 
+ * 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
  */
 
@@ -25,7 +25,7 @@
 /* parsing:           compact form:
  */
 
-/* 
+/*
  * still TODO/test:
  *  - parse next via
  *  - 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)
 
 
-/* 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}!
- * 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 */
 __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;
 	char* param_name;
 	char* param_value;
-	
+
 	state=*pstate;
 	saved_state=*psaved_state;
 	param_name=param_value=0;
 	param_type=0;
-	
+
 	for (tmp=p;*tmp;tmp++){
 		switch(*tmp){
 			case ' ':
@@ -253,7 +253,7 @@ __inline char* parse_via_param(char* p, int* pstate, int* psaved_state)
 						goto endofparam;
 				}
 				break;
-				
+
 				/* param names */
 			case 'h':
 			case 'H':
@@ -558,7 +558,7 @@ find_value:
 				switch(state){
 					case L_VALUE:
 					case F_VALUE: /*eat space*/
-						break; 
+						break;
 					case P_VALUE:
 						*tmp=0;
 						state=L_PARAM;
@@ -583,7 +583,7 @@ find_value:
 					case P_STRING:
 						saved_state=state;
 						state=F_LF;
-						break; 
+						break;
 					case P_VALUE:
 						*tmp=0;
 						saved_state=L_PARAM;
@@ -609,7 +609,7 @@ find_value:
 					case P_STRING:
 						saved_state=state;
 						state=F_CR;
-						break; 
+						break;
 					case P_VALUE:
 						*tmp=0;
 						saved_state=L_PARAM;
@@ -664,7 +664,7 @@ find_value:
 						goto error;
 				}
 				break;
-			
+
 			case '"':
 				switch(state){
 					case F_VALUE:
@@ -760,7 +760,7 @@ int main(int argc, char** argv)
 			fprintf(stderr, " no parameters\n");
 			exit(-1);
 	}
-	
+
 	/* parse start of via ( SIP/2.0/UDP    )*/
 	state=F_SIP;
 	for(tmp=argv[1];*tmp;tmp++){
@@ -871,7 +871,7 @@ int main(int argc, char** argv)
 						goto error;
 				}
 				break;
-			
+
 			case '/':
 				switch(state){
 					case FIN_SIP:
@@ -1007,7 +1007,7 @@ int main(int argc, char** argv)
 						goto error;
 				}
 				break;
-			
+
 			default:
 				switch(state){
 					case F_PROTO:
@@ -1070,7 +1070,7 @@ main_via:
 						break;
 					case P_IP6HOST:
 						*tmp=0; /*mark end of host*/
-						state=L_PORT; 
+						state=L_PORT;
 						break;
 					case F_CRLF:
 					case F_LF:
@@ -1170,7 +1170,7 @@ main_via:
 						goto  error;
 				}
 			break;
-			
+
 			case ':':
 				switch(state){
 					case F_HOST:
@@ -1269,7 +1269,7 @@ main_via:
 						break;
 					case P_COMMENT: /*everything is allowed in a comment*/
 						break;
-					
+
 					default:
 						LOG(L_CRIT,"BUG: parse_via"
 							" on <%c> state %d\n",
@@ -1304,7 +1304,7 @@ main_via:
 						goto error;
 					case F_VIA:
 						/* do  nothing,  eat ","*/
-						break;	
+						break;
 					case F_CRLF:
 					case F_LF:
 					case F_CR:
@@ -1460,7 +1460,7 @@ main_via:
 						goto  error;
 				}
 				break;
-						
+
 			default:
 				switch(state){
 					case F_HOST:
@@ -1535,14 +1535,14 @@ main_via:
 							*tmp, state);
 						goto error;
 				}
-				
-					
-		}			
+
+
+		}
 	}
 
 	printf("end of packet reached, state=%d\n", state);
 	goto endofpacket; /*end of packet, probably should be goto error*/
-	
+
 endofheader:
 	state=saved_state;
 	printf("end of header reached, state=%d\n", state);
@@ -1564,7 +1564,7 @@ endofpacket:
 					" state %d\n", state);
 			goto error;
 	}
-		
+
 nextvia:
 	if (proto) printf("<SIP/2.0/%s>\n", proto);
 	if (host) printf("host= <%s>\n", host);
@@ -1573,7 +1573,7 @@ nextvia:
 	if (comment) printf("comment= <%s>\n", comment);
 	if(next_via) printf("next_via= <%s>\n", next_via);
 	printf("rest=<%s>\n", tmp);
-	
+
 	exit(0);
 
 error: