tests: Add example of how to use printhdr()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2020-02-22 11:14:27 +01:00
parent 2aed5a6b3f
commit 9d50de3ec7
3 changed files with 22 additions and 0 deletions
+1
View File
@@ -9,6 +9,7 @@ fsendfile
lfile
makepath
pidfile
printhdr
progress
rsync
str
+1
View File
@@ -11,6 +11,7 @@ TESTS += fsendfile
TESTS += lfile
TESTS += makepath
TESTS += pidfile
TESTS += printhdr
TESTS += progress
TESTS += rsync
TESTS += str
+20
View File
@@ -0,0 +1,20 @@
#include <stdlib.h> /* atexit() */
#include <unistd.h> /* usleep() */
#include "check.h"
#define SCREEN_WIDTH 80
int main(void)
{
FILE *fp = stderr;
char buf[SCREEN_WIDTH];
printhdr(fp, "", 0, UNDERSCORE);
printhdr(fp, "Neighbor Table", 0, 0);
snprintf(buf, sizeof(buf), "%-15s %-15s %7s %-5s%10s %6s",
"Neighbor", "Interface", "Version", "Flags", "Uptime", "Expire");
printhdr(fp, buf, 0, REVERSE);
return 0;
}