Displaying 5 results from an estimated 5 matches for "do_dir".
Did you mean:
do_div
2009 May 29
1
[PATCH v2] klibc-utils: add simple ls
...if ((rc = readlink(path, link_name, max_linksiz)) == -1) {
+ free(link_name);
+ perror("readlink");
+ exit(1);
+ }
+ link_name[rc] = '\0';
+ fprintf(stdout, " -> %s", link_name);
+ free(link_name);
+ }
+
+ putchar('\n');
+ return;
+}
+
+static void do_dir(const char *path, int preformat)
+{
+ DIR *dir;
+ struct dirent *dent;
+ struct stat st;
+
+ if (chdir(path) == -1) {
+ perror(path);
+ exit(1);
+ }
+
+ if ((dir = opendir(path)) == NULL) {
+ perror(path);
+ exit(1);
+ }
+
+ while ((dent = readdir(dir)) != NULL) {
+ if (lstat(dent->d_name,...
2009 May 28
1
[PATCH] klibc-utils: add minils
...perror("malloc");
+ exit(1);
+ }
+
+ if (readlink(path, link_name, max_siz) == -1) {
+ perror("readlink");
+ free(link_name);
+ exit(1);
+ }
+ printf(" -> %s", link_name);
+ free(link_name);
+ }
+
+ printf ("\n");
+ return;
+}
+
+static void do_dir(const char *path, int preformat)
+{
+ DIR *dir;
+ struct dirent *dent;
+ struct stat st;
+
+ if (chdir(path) == -1) {
+ perror(path);
+ exit(1);
+ }
+
+ if ((dir = opendir(path)) == NULL) {
+ perror(path);
+ exit(1);
+ }
+
+ while ((dent = readdir(dir)) != NULL) {
+ if (lstat(dent->d_name,...
2023 Jan 13
0
[klibc:master] ls: Handle relative directory names correctly
...ot;);
exit(1);
}
- rc = readlink(path, link_name, max_linksiz);
+ rc = readlinkat(dir_fd, path, link_name, max_linksiz);
if (rc == -1) {
free(link_name);
perror("readlink");
@@ -156,28 +156,26 @@ static void do_stat(const struct stat *st, const char *path)
static void do_dir(const char *path, int preformat)
{
DIR *dir;
+ int dir_fd;
struct dirent *dent;
struct stat st;
- if (chdir(path) == -1) {
- perror(path);
- exit(1);
- }
-
dir = opendir(path);
if (dir == NULL) {
perror(path);
exit(1);
}
+ dir_fd = dirfd(dir);
while ((dent = readdir(dir))...
2011 Jul 07
5
[PATCH 0/5] checkpatch cleanups
It seems checkpatch errors krept in, this is a first go.
Next run will go into usr/kinit directory.
No code changes, just codingstyle fixes (verified with size(3)).
maximilian attems (5):
[klibc] sleep: have argument on next line
[klibc] readklink: remove unneeded braces
[klibc] mount: whitespace policy
[klibc] ls: fix various checkpatch complaints
[klibc] tests: checkpatch fixlets
2005 Aug 04
0
[PATCH 6/11] Xenstore watch rework
...if (readonly)
+ handles[handle] = xs_daemon_open_readonly();
+ else
+ handles[handle] = xs_daemon_open();
+ if (!handles[handle])
+ barf_perror("Opening connection to daemon");
+ }
+ command = arg(line, 0);
+
+ if (timeout)
+ alarm(1);
+
+ if (streq(command, "dir"))
+ do_dir(handle, arg(line, 1));
+ else if (streq(command, "read"))
+ do_read(handle, arg(line, 1));
+ else if (streq(command, "write"))
+ do_write(handle,
+ arg(line, 1), arg(line, 2), arg(line, 3));
+ else if (streq(command, "setid"))
+ do_setid(handle, arg(line, 1));
+...