Fix build break on OS X

This commit is contained in:
Arun Prakash Jana 2017-04-22 20:26:22 +05:30
parent 4790d17d04
commit ff18d580c5
No known key found for this signature in database
GPG key ID: A75979F35C080412

16
nnn.c
View file

@ -297,14 +297,14 @@ spawn(char *file, char *arg, char *dir, int flag)
status = chdir(dir); status = chdir(dir);
if (flag == 1) if (flag == 1)
fprintf(stdout, "\n +-++-++-+\n | n n n |\n +-++-++-+\n\n"); fprintf(stdout, "\n +-++-++-+\n | n n n |\n +-++-++-+\n\n");
execlp(file, file, arg, NULL); execlp(file, file, arg, NULL);
_exit(1); _exit(1);
} else { } else {
if (flag != 2) { if (flag != 2)
/* Ignore interruptions */ /* Ignore interruptions */
while (waitpid(pid, &status, 0) == -1) while (waitpid(pid, &status, 0) == -1)
DPRINTF_D(status); DPRINTF_D(status);
}
DPRINTF_D(pid); DPRINTF_D(pid);
} }
} }
@ -805,6 +805,7 @@ get_lsperms(mode_t mode, char *desc)
return(bits); return(bits);
} }
/* Gets only a single line, that's what we need for now */
static char * static char *
get_output(char *buf, size_t bytes) get_output(char *buf, size_t bytes)
{ {
@ -846,12 +847,21 @@ show_stats(char* fpath, char* fname, struct stat *sb)
dprintf(fd, " File: '%s'", fname); dprintf(fd, " File: '%s'", fname);
/* Show size, blocks, file type */ /* Show size, blocks, file type */
#ifdef __APPLE__
dprintf(fd, "\n Size: %-15lld Blocks: %-10lld IO Block: %-6d %s",
#else
dprintf(fd, "\n Size: %-15ld Blocks: %-10ld IO Block: %-6ld %s", dprintf(fd, "\n Size: %-15ld Blocks: %-10ld IO Block: %-6ld %s",
#endif
sb->st_size, sb->st_blocks, sb->st_blksize, buf); sb->st_size, sb->st_blocks, sb->st_blksize, buf);
/* Show containing device, inode, hardlink count */ /* Show containing device, inode, hardlink count */
sprintf(buf, "%lxh/%lud", (ulong)sb->st_dev, (ulong)sb->st_dev); #ifdef __APPLE__
sprintf(buf, "%xh/%ud", sb->st_dev, sb->st_dev);
dprintf(fd, "\n Device: %-15s Inode: %-11llu Links: %-9hu",
#else
sprintf(buf, "%lxh/%lud", sb->st_dev, sb->st_dev);
dprintf(fd, "\n Device: %-15s Inode: %-11lu Links: %-9lu", dprintf(fd, "\n Device: %-15s Inode: %-11lu Links: %-9lu",
#endif
buf, sb->st_ino, sb->st_nlink); buf, sb->st_ino, sb->st_nlink);
/* Show major, minor number for block or char device */ /* Show major, minor number for block or char device */