2 * Copyright (C) 2010 Joel Rosdahl
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 3 of the License, or (at your option)
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "test/util.h"
23 path_exists(const char *path)
26 return lstat(path, &st) == 0;
30 is_symlink(const char *path)
33 return lstat(path, &st) == 0 && S_ISLNK(st.st_mode);
37 create_file(const char *path, const char *content)
39 FILE *f = fopen(path, "w");
40 if (!f || fputs(content, f) < 0) {
41 fprintf(stderr, "create_file: %s: %s\n", path, strerror(errno));