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