File: test_filepath.c

package info (click to toggle)
yaz 5.35.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,488 kB
  • sloc: xml: 124,226; ansic: 73,966; sh: 5,224; tcl: 2,189; makefile: 1,273; yacc: 382
file content (41 lines) | stat: -rw-r--r-- 919 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* This file is part of the YAZ toolkit.
 * Copyright (C) Index Data
 * See the file LICENSE for details.
 */

#if HAVE_CONFIG_H
#include <config.h>
#endif

#include <errno.h>
#include <string.h>
#include <stdlib.h>

#include <yaz/tpath.h>
#include <yaz/test.h>

void tst(void)
{
    char fullpath[1024];
    YAZ_CHECK(yaz_filepath_resolve("test_filepath", ".", 0, fullpath));
    YAZ_CHECK(strcmp(fullpath, "./test_filepath") == 0);
    YAZ_CHECK(!yaz_filepath_resolve("test_filepath1", ".", 0, fullpath));
    YAZ_CHECK(!yaz_filepath_resolve("test_filepath", "bogus", 0, fullpath));
    YAZ_CHECK(yaz_filepath_resolve("test_filepath", "bogus:.", 0, fullpath));
}

int main (int argc, char **argv)
{
    YAZ_CHECK_INIT(argc, argv);
    tst();
    YAZ_CHECK_TERM;
}
/*
 * Local variables:
 * c-basic-offset: 4
 * c-file-style: "Stroustrup"
 * indent-tabs-mode: nil
 * End:
 * vim: shiftwidth=4 tabstop=8 expandtab
 */