libudev-utils.c revision 7a01f11afbcc0a639cc3676572a41445f7edb65d
/*
* libudev - interface to udev device information
*
* Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <dirent.h>
#include "libudev.h"
#include "libudev-private.h"
#include "../udev.h"
static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *devpath, char *subsystem, size_t size)
{
const char *pos;
return -1;
return -1;
}
ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size)
{
}
{
}
{
char link_target[PATH_SIZE];
int len;
int i;
int back;
if (len <= 0)
return -1;
;
for (i = 0; i <= back; i++) {
return -1;
pos[0] = '\0';
}
return 0;
}
struct util_name_entry {
char *name;
int *i;
};
{
struct util_name_entry *name_loop;
struct util_name_entry *name_new;
/* avoid duplicate entries */
return name_loop;
}
}
if (sort) {
break;
}
}
return NULL;
return name_new;
}
{
struct util_name_entry *name_loop;
struct util_name_entry *name_tmp;
}
}
int util_log_priority(const char *priority)
{
char *endptr;
int prio;
if (endptr[0] == '\0')
return prio;
return LOG_ERR;
return LOG_INFO;
return LOG_DEBUG;
return 0;
}
{
size_t i, j;
t[0] = '\0';
for (i = 0, j = 0; s[i] != '\0'; i++) {
if (s[i] == '/') {
j += 4;
} else if (s[i] == '\\') {
j += 4;
} else {
t[j] = s[i];
j++;
}
}
t[j] = '\0';
return j;
}
size_t util_path_decode(char *s)
{
size_t i, j;
for (i = 0, j = 0; s[i] != '\0'; j++) {
s[j] = '/';
i += 4;
s[j] = '\\';
i += 4;
} else {
s[j] = s[i];
i++;
}
}
s[j] = '\0';
return j;
}
void util_remove_trailing_chars(char *path, char c)
{
return;
}