summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2000-04-12 12:34:45 +0200
committerPavel Machek <pavel@ucw.cz>2000-04-12 12:34:45 +0200
commit78c6217c1e9f8a46026cecf6a6369b72d5d883b0 (patch)
treef7265d1198b222cfa12903687ad2d531d6b8878e
parentf7d534cf2e8932869b049bd64677bb0a67e362c1 (diff)
downloadbird-78c6217c1e9f8a46026cecf6a6369b72d5d883b0.tar
bird-78c6217c1e9f8a46026cecf6a6369b72d5d883b0.zip
Path printing is now much nicer: not having to put it backward
simplifies it. (Sorry for previous commit, cvs is naughty).
-rw-r--r--filter/filter.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/filter/filter.c b/filter/filter.c
index cfb30f9..f3f8c23 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -9,7 +9,7 @@
*
*/
-#undef LOCAL_DEBUG
+#define LOCAL_DEBUG
#include "nest/bird.h"
#include "lib/lists.h"
@@ -592,24 +592,22 @@ path_getlen(u8 *p, int len)
}
-#define PRINTF(a...) { int l; bsnprintf( buf, 8000, a ); s -= (l = strlen(buf)); if (s<bigbuf) return "Path was much too long"; memcpy(s, buf, l); }
+#define PRINTF(a...) { int l; bsnprintf( s, bigbuf+4090-s, a ); s += strlen(s); }
#define COMMA if (first) first = 0; else PRINTF( ", " );
char *
path_format(u8 *p, int len)
{
char bigbuf[4096]; /* Keep it smaller than buf */
- char *s = bigbuf+4095;
- char buf[8000];
+ char *s = bigbuf;
int first = 1;
int i;
u8 *q = p+len;
- *s-- = 0;
while (p<q) {
switch (*p++) {
case 1: /* This is a set */
len = *p++;
COMMA;
- PRINTF( "}" );
+ PRINTF( "{" );
{
int first = 1;
for (i=0; i<len; i++) {
@@ -618,7 +616,7 @@ path_format(u8 *p, int len)
p+=2;
}
}
- PRINTF( "{" );
+ PRINTF( "}" );
break;
case 2: /* This is a sequence */
@@ -635,7 +633,7 @@ path_format(u8 *p, int len)
bug("This should not be in path");
}
}
- return strdup(s);
+ return strdup(bigbuf);
}
#undef PRINTF
#undef COMMA