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)    ((strcmp(a, ".") == 0) || (strcmp(a, "..") == 0))
 
#define TYPE(b)   ((st->st_mode & (S_IFMT)) == (b))
 
#define MODE(b)   ((st->st_mode & (b)) == (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)     ((strcmp(a, ".") == 0) || (strcmp(a, "..") == 0))

◆ MODE

#define MODE (   b)    ((st->st_mode & (b)) == (b))

◆ TYPE

#define TYPE (   b)    ((st->st_mode & (S_IFMT)) == (b))

Function Documentation

◆ ad_ls_r()

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

◆ ad_print()

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

◆ check_netatalk_dirs()

static 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()

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

◆ get_terminal_width()

static int get_terminal_width ( void  )
static

◆ nad_ls()

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

◆ print_columns()

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

◆ print_date()

static void print_date ( const struct stat *  statp)
static

◆ print_flags()

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

◆ print_group()

static void print_group ( const struct stat *  statp)
static

◆ print_mode()

static void print_mode ( const struct stat *  st)
static

◆ print_name_sanitized()

static 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()

static void print_numlinks ( const struct stat *  statp)
static

◆ print_owner()

static void print_owner ( const struct stat *  statp)
static

◆ print_size()

static void print_size ( const struct stat *  statp)
static

◆ usage_ls()

static 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:
= {
".AppleDB",
".AppleDesktop",
NULL
}
#define ADv2_DIRNAME
Definition nad_ls.c:42

◆ recursion

int recursion
static