mirror of
https://github.com/troglobit/libite.git
synced 2026-10-01 05:22:34 +07:00
tests: Add example of how to use printhdr()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@ fsendfile
|
||||
lfile
|
||||
makepath
|
||||
pidfile
|
||||
printhdr
|
||||
progress
|
||||
rsync
|
||||
str
|
||||
|
||||
@@ -11,6 +11,7 @@ TESTS += fsendfile
|
||||
TESTS += lfile
|
||||
TESTS += makepath
|
||||
TESTS += pidfile
|
||||
TESTS += printhdr
|
||||
TESTS += progress
|
||||
TESTS += rsync
|
||||
TESTS += str
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user