netatalk: nad_ls.c File Reference

netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
nad_ls.c File Reference
`#include <ctype.h>`
`#include <dirent.h>`
`#include <errno.h>`
`#include <fcntl.h>`
`#include <grp.h>`
`#include <limits.h>`
`#include <pwd.h>`
`#include <stdarg.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <sys/ioctl.h>`
`#include <sys/types.h>`
`#include <termios.h>`
`#include <time.h>`
`#include <unistd.h>`
`#include <atalk/adouble.h>`
`#include <atalk/cnid.h>`
`#include <atalk/directory.h>`
`#include "nad.h"`

## Macros
#define | ADv2_DIRNAME ".AppleDouble"
#define | DIR_DOT_OR_DOTDOT(a)
#define | TYPE(b)
#define | MODE(b)

## Functions
static int | compare_names (const struct dirent **a, const struct dirent **b)
static const char * | check_netatalk_dirs (const char *name)
| Check for netatalk special folders e.g. ".AppleDB" or ".AppleDesktop".
static void | usage_ls (void)
static void | print_numlinks (const struct stat *statp)
static void | print_owner (const struct stat *statp)
static void | print_group (const struct stat *statp)
static void | print_size (const struct stat *statp)
static void | print_date (const struct stat *statp)
static void | print_flags (char *path, afpvol_t *vol, const struct stat *st)
static void | print_mode (const struct stat *st)
static int | get_terminal_width (void)
static unsigned int | print_name_sanitized (const char *name)
| Print a filename with non-printable characters replaced by '?'.
static void | print_columns (char **names, unsigned int count)
static int | ad_print (char *path, const struct stat *st, afpvol_t *vol)
static int | ad_ls_r (char *path, afpvol_t *vol)
int | nad_ls (int argc, char **argv, AFPObj *obj)

## Variables
static int | ls_a
static int | ls_l
static int | ls_R
static int | ls_d
static int | ls_u
static int | first = 1
static int | recursion
static char * | netatalk_dirs []
static char * | labels []

## Macro Definition Documentation

## ◆ ADv2_DIRNAME

#define ADv2_DIRNAME ".AppleDouble"

## ◆ DIR_DOT_OR_DOTDOT

#define DIR_DOT_OR_DOTDOT | ( |  | a | ) |

Value:
((strcmp(a, ".") == 0) || (strcmp(a, "..") == 0))

## ◆ MODE

#define MODE | ( |  | b | ) |

Value:
((st->st_mode & (b)) == (b))

## ◆ TYPE

#define TYPE | ( |  | b | ) |

Value:
((st->st_mode & (S_IFMT)) == (b))

## Function Documentation

## ◆ ad_ls_r()

int ad_ls_r | ( | char * | path,
|  | afpvol_t * | vol )
| static

## ◆ ad_print()

int ad_print | ( | char * | path,
|  | const struct stat * | st,
|  | afpvol_t * | vol )
| static

## ◆ check_netatalk_dirs()

const char * check_netatalk_dirs | ( | const char * | name | ) |
| static

Check for netatalk special folders e.g. ".AppleDB" or ".AppleDesktop".

Returns
  pointer to name or NULL.

## ◆ compare_names()

int compare_names | ( | const struct dirent ** | a,
|  | const struct dirent ** | b )
| static

## ◆ get_terminal_width()

int get_terminal_width | ( | void |  | ) |
| static

## ◆ nad_ls()

int nad_ls | ( | int | argc,
|  | char ** | argv,
|  | AFPObj * | obj )

## ◆ print_columns()

void print_columns | ( | char ** | names,
|  | unsigned int | count )
| static

## ◆ print_date()

void print_date | ( | const struct stat * | statp | ) |
| static

## ◆ print_flags()

void print_flags | ( | char * | path,
|  | afpvol_t * | vol,
|  | const struct stat * | st )
| static

## ◆ print_group()

void print_group | ( | const struct stat * | statp | ) |
| static

## ◆ print_mode()

void print_mode | ( | const struct stat * | st | ) |
| static

## ◆ print_name_sanitized()

unsigned int print_name_sanitized | ( | const char * | name | ) |
| static

Print a filename with non-printable characters replaced by '?'.

Returns
  the number of characters printed

## ◆ print_numlinks()

void print_numlinks | ( | const struct stat * | statp | ) |
| static

## ◆ print_owner()

void print_owner | ( | const struct stat * | statp | ) |
| static

## ◆ print_size()

void print_size | ( | const struct stat * | statp | ) |
| static

## ◆ usage_ls()

void usage_ls | ( | void |  | ) |
| static

## Variable Documentation

## ◆ first

int first = 1
| static

## ◆ labels

char* labels[]
| static

Initial value:
= {
"---",
"gry",
"gre",
"vio",
"blu",
"yel",
"red",
"ora"
}

## ◆ ls_a

int ls_a
| static

## ◆ ls_d

int ls_d
| static

## ◆ ls_l

int ls_l
| static

## ◆ ls_R

int ls_R
| static

## ◆ ls_u

int ls_u
| static

## ◆ netatalk_dirs

char* netatalk_dirs[]
| static

Initial value:
= {
ADv2_DIRNAME,
".AppleDB",
".AppleDesktop",
NULL
}
ADv2_DIRNAME
#define ADv2_DIRNAME
Definition cmd_dbd.h:19
NULL
#define NULL
Definition utf8util.c:47

## ◆ recursion

int recursion
| static