/*
- $Id: ad_ls.c,v 1.1 2009-09-01 14:28:07 franklahm Exp $
+ $Id: ad_ls.c,v 1.4 2009-10-14 01:38:28 didg Exp $
Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
}
-static void usage_ls()
+static void usage_ls(void)
{
printf(
"Usage: ad ls [-dRl[u]] [file|dir, ...]\n\n"
uint16_t AFPattributes;
char type[5] = "----";
char creator[5] = "----";
+ int i;
+ uint32_t cnid;
if (S_ISDIR(st->st_mode))
adflags = ADFLAGS_DIR;
printf(" %s ", labels[(FinderFlags & FINDERINFO_COLOR) >> 1]);
/* Type & Creator */
- int i;
for(i=0; i<4; i++) {
if (isalnum(type[i]))
putchar(type[i]);
putchar(' ');
/* CNID */
- uint32_t cnid = ad_forcegetid(&ad);
+ cnid = ad_forcegetid(&ad);
if (cnid)
printf(" %10u ", ntohl(cnid));
else
#undef TYPE
#undef MODE
-int ad_print(char *path, const struct stat *st, afpvol_t *vol)
+static int ad_print(char *path, const struct stat *st, afpvol_t *vol)
{
if ( ! ls_l) {
printf("%s ", path);
return 0;
}
-int ad_ls_r(char *path, afpvol_t *vol)
+static int ad_ls_r(char *path, afpvol_t *vol)
{
int ret = 0, cwd, dirprinted = 0, dirempty;
const char *name;
if ((name = check_netatalk_dirs(ep->d_name)) != NULL)
continue;
- if (lstat(ep->d_name, &st) < 0) {
+ if ((ret = lstat(ep->d_name, &st)) < 0) {
perror("Can't stat");
- return -1;
+ goto exit;
}
/* Recursion */
freevol(&vol);
}
else {
+ int havefile = 0;
+
firstarg = optind;
/* First run: only print files from argv paths */
- int havefile = 0;
while(optind < argc) {
if (stat(argv[optind], &st) != 0)
goto next;