Introduction
Introduction Statistics Contact Development Disclaimer Help
enmasse.c - sbase - suckless unix tools
git clone git://git.suckless.org/sbase
Log
Files
Refs
README
LICENSE
---
enmasse.c (919B)
---
1 /* See LICENSE file for copyright and license details. */
2 #include <libgen.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <sys/stat.h>
7 #include <unistd.h>
8
9 #include "../util.h"
10
11 void
12 enmasse(int argc, char *argv[], int (*fn)(const char *, const char *, in…
13 {
14 struct stat st;
15 char buf[PATH_MAX], *dir;
16 int i, len;
17 size_t dlen;
18
19 if (argc == 2 && !(stat(argv[1], &st) == 0 && S_ISDIR(st.st_mode…
20 fnck(argv[0], argv[1], fn, 0);
21 return;
22 } else {
23 dir = (argc == 1) ? "." : argv[--argc];
24 }
25
26 for (i = 0; i < argc; i++) {
27 dlen = strlen(dir);
28 if (dlen > 0 && dir[dlen - 1] == '/')
29 len = snprintf(buf, sizeof(buf), "%s%s", dir, ba…
30 else
31 len = snprintf(buf, sizeof(buf), "%s/%s", dir, b…
32 if (len < 0 || len >= sizeof(buf)) {
33 eprintf("%s/%s: filename too long\n", dir,
34 basename(argv[i]));
35 }
36 fnck(argv[i], buf, fn, 0);
37 }
38 }
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.