Browse code

- fixed bug in print_routeset (reported by Alexander Mayrhofer)

Jan Janak authored on 15/12/2003 19:15:48
Showing 1 changed files
... ...
@@ -862,7 +862,7 @@ char* print_routeset(char* buf, dlg_t* _d)
862 862
 
863 863
 	ptr = _d->hooks.first_route;
864 864
 
865
-	if (ptr) {
865
+	if (ptr || _d->hooks.last_route) {
866 866
 		memcpy(buf, ROUTE_PREFIX, ROUTE_PREFIX_LEN);
867 867
 		buf += ROUTE_PREFIX_LEN;
868 868
 	}
... ...
@@ -879,15 +879,19 @@ char* print_routeset(char* buf, dlg_t* _d)
879 879
 	} 
880 880
 
881 881
 	if (_d->hooks.last_route) {
882
-		memcpy(buf, ROUTE_SEPARATOR "<", ROUTE_SEPARATOR_LEN + 1);
883
-		buf += ROUTE_SEPARATOR_LEN + 1;
882
+		if (_d->hooks.first_route) {
883
+			memcpy(buf, ROUTE_SEPARATOR, ROUTE_SEPARATOR_LEN);
884
+			buf += ROUTE_SEPARATOR_LEN;
885
+		}
886
+		memcpy(buf, "<", 1);
887
+		buf++;
884 888
 		memcpy(buf, _d->hooks.last_route->s, _d->hooks.last_route->len);
885 889
 		buf += _d->hooks.last_route->len;
886 890
 		*buf = '>';
887 891
 		buf++;
888 892
 	}
889 893
 
890
-	if (_d->hooks.first_route) {
894
+	if (_d->hooks.first_route || _d->hooks.last_route) {
891 895
 		memcpy(buf, CRLF, CRLF_LEN);
892 896
 		buf += CRLF_LEN;
893 897
 	}