projects
/
libc-test
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
new test system
[libc-test]
/
src
/
common
/
path.c
1
#include <string.h>
2
#include "test.h"
3
4
/* relative path to p */
5
char *t_pathrel(char *buf, size_t n, char *argv0, char *p)
6
{
7
char *s = strrchr(argv0, '/');
8
int k;
9
10
if (s)
11
k = snprintf(buf, n, "%.*s/%s", (int)(s-argv0), argv0, p);
12
else
13
k = snprintf(buf, n, "./%s", p);
14
if ((size_t)k >= n)
15
return 0;
16
return buf;
17
}