commit - 8f853fb5f771e6b061dddb1d778178c160361453
commit + c04b0d8972007057cbc0fab5141cc49afd1ecc3f
blob - 3f04ea537a06e47f3deefc5eb28bf0b268a08976
blob + 834c96a164942829e3a2547d3d3cce40a4b56fa0
--- rover.c
+++ rover.c
#include <ctype.h>
#include <string.h>
#include <sys/types.h> /* pid_t, ... */
-#include <stdio.h> /* FILENAME_MAX */
+#include <stdio.h>
+#include <limits.h> /* PATH_MAX */
#include <locale.h> /* setlocale(), LC_ALL */
#include <unistd.h> /* chdir(), getcwd(), read(), close(), ... */
#include <dirent.h> /* DIR, struct dirent, opendir(), ... */
/* Dynamic array of marked entries. */
typedef struct Marks {
- char dirpath[FILENAME_MAX];
+ char dirpath[PATH_MAX];
int bulk;
int nentries;
char **entries;
uint8_t flags[10];
Row *rows;
WINDOW *window;
- char cwd[10][FILENAME_MAX];
+ char cwd[10][PATH_MAX];
Marks marks;
} rover;
DIR *dp;
struct dirent *ep;
struct stat statbuf;
- char subpath[FILENAME_MAX];
+ char subpath[PATH_MAX];
ret = 0;
if (pre) {
- char dstpath[FILENAME_MAX];
+ char dstpath[PATH_MAX];
strcpy(dstpath, CWD);
strcat(dstpath, path + strlen(rover.marks.dirpath));
ret |= pre(dstpath);
process_marked(PROCESS pre, PROCESS proc, PROCESS pos)
{
int i, ret;
- char path[FILENAME_MAX];
+ char path[PATH_MAX];
clear_message();
message("Processing...", CYAN);
size_t size;
struct stat st;
char buf[BUFSIZ];
- char dstpath[FILENAME_MAX];
+ char dstpath[PATH_MAX];
ret = src = open(srcpath, O_RDONLY);
if (ret < 0) return ret;
}
static int movfile(const char *srcpath) {
int ret;
- char dstpath[FILENAME_MAX];
+ char dstpath[PATH_MAX];
strcpy(dstpath, CWD);
strcat(dstpath, srcpath + strlen(rover.marks.dirpath));
strcpy(rover.cwd[0], getenv("HOME"));
for (i = 1; i < argc && i < 10; i++) {
if ((d = opendir(argv[i]))) {
- strcpy(rover.cwd[i], argv[i]);
+ realpath(argv[i], rover.cwd[i]);
closedir(d);
} else
strcpy(rover.cwd[i], rover.cwd[0]);
}
- getcwd(rover.cwd[i], FILENAME_MAX);
+ getcwd(rover.cwd[i], PATH_MAX);
for (i++; i < 10; i++)
strcpy(rover.cwd[i], rover.cwd[i-1]);
for (i = 0; i < 10; i++)