ReactOS  0.4.14-dev-358-gbef841c
ls.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  LsCacheItem
 

Macros

#define kLsCacheItemLifetime   900 /* seconds */
 
#define kLsCacheSize   32
 

Typedefs

typedef struct LsCacheItem LsCacheItem
 

Functions

void InitLsCache (void)
 
void InitLsMonths (void)
 
void InitLs (void)
 
void FlushLsCache (void)
 
int LsCacheLookup (const char *const)
 
void LsDate (char *, time_t)
 
void LsL (FileInfoListPtr, int, int, FILE *)
 
void Ls1 (FileInfoListPtr, int, FILE *)
 
void Ls (const char *const, int, const char *const, FILE *)
 
void LLs (const char *const, int, const char *const, FILE *)
 

Macro Definition Documentation

◆ kLsCacheItemLifetime

#define kLsCacheItemLifetime   900 /* seconds */

Definition at line 8 of file ls.h.

◆ kLsCacheSize

#define kLsCacheSize   32

Definition at line 17 of file ls.h.

Typedef Documentation

◆ LsCacheItem

Function Documentation

◆ FlushLsCache()

void FlushLsCache ( void  )

Definition at line 94 of file ls.c.

95 {
96  int i;
97 
98  for (i=0; i<kLsCacheSize; i++) {
99  if (gLsCache[i].expiration != (time_t) 0) {
101  }
102  }
103 } /* FlushLsCache */
static void FlushLsCacheItem(int i)
Definition: ls.c:79
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LsCacheItem gLsCache[kLsCacheSize]
Definition: ls.c:26
#define kLsCacheSize
Definition: ls.h:17
__kernel_time_t time_t
Definition: linux.h:252

Referenced by ChmodCmd(), DeleteCmd(), GetCmd(), MkdirCmd(), OpenCmd(), PutCmd(), RenameCmd(), RmdirCmd(), and SymlinkCmd().

◆ InitLs()

void InitLs ( void  )

Definition at line 68 of file ls.c.

69 {
70  InitLsCache();
71  InitLsMonths();
72 } /* InitLs */
void InitLsCache(void)
Definition: ls.c:36
void InitLsMonths(void)
Definition: ls.c:47

Referenced by PreInit().

◆ InitLsCache()

void InitLsCache ( void  )

Definition at line 36 of file ls.c.

37 {
38  (void) memset(gLsCache, 0, sizeof(gLsCache));
40 } /* InitLsCache */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
LsCacheItem gLsCache[kLsCacheSize]
Definition: ls.c:26
int gOldestLsCacheItem
Definition: ls.c:27
#define memset(x, y, z)
Definition: compat.h:39

Referenced by InitLs().

◆ InitLsMonths()

void InitLsMonths ( void  )

Definition at line 47 of file ls.c.

48 {
49  time_t now;
50  struct tm *ltp;
51  int i;
52 
53  (void) time(&now);
54  ltp = localtime(&now); /* Fill up the structure. */
55  ltp->tm_mday = 15;
56  ltp->tm_hour = 12;
57  for (i=0; i<12; i++) {
58  ltp->tm_mon = i;
59  (void) strftime(gLsMon[i], sizeof(gLsMon[i]), "%b", ltp);
60  gLsMon[i][sizeof(gLsMon[i]) - 1] = '\0';
61  }
62  (void) strcpy(gLsMon[i], "BUG");
63 } /* InitLsMonths */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
char gLsMon[13][4]
Definition: ls.c:21
int tm_mday
Definition: time.h:80
__u16 time
Definition: mkdosfs.c:366
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
time_t now
Definition: finger.c:65
int tm_mon
Definition: time.h:81
size_t CDECL strftime(char *str, size_t max, const char *format, const struct tm *mstm)
Definition: strftime.c:293
Definition: time.h:76
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
Definition: time.h:424
__kernel_time_t time_t
Definition: linux.h:252
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int tm_hour
Definition: time.h:79

Referenced by InitLs().

◆ LLs()

void LLs ( const char * const  ,
int  ,
const char * const  ,
FILE  
)

Referenced by LocalListCmd().

◆ Ls()

void Ls ( const char * const  ,
int  ,
const char * const  ,
FILE  
)

Definition at line 465 of file ls.c.

466 {
467  char itempath[512];
468  FileInfoList fil;
469  FileInfoListPtr filp;
470  LinePtr linePtr, nextLinePtr;
471  LineList dirContents;
472  int parsed;
473  int linkedTo;
474  int endChars;
475  int rlisted;
476  int opt;
477  const char *cp;
478  int sortBy;
479  int sortOrder;
480  int unknownOpts;
481  char optstr[32];
482  char unoptstr[32];
483  int doNotUseCache;
484  int wasInCache;
485  int mlsd;
486  int ci;
487 
488  InitLineList(&dirContents);
489  InitFileInfoList(&fil);
490 
491  sortBy = 'n'; /* Sort by filename. */
492  sortOrder = 'a'; /* Sort in ascending order. */
493  linkedTo = 0;
494  endChars = (listmode == 'C') ? 1 : 0;
495  unknownOpts = 0;
496  memset(unoptstr, 0, sizeof(unoptstr));
497  unoptstr[0] = '-';
498  doNotUseCache = 0;
499  rlisted = 0;
500 
501  for (cp = options; *cp != '\0'; cp++) {
502  opt = *cp;
503  switch (opt) {
504  case 't':
505  sortBy = 't'; /* Sort by modification time. */
506  break;
507  case 'S':
508  sortBy = 's'; /* Sort by size. */
509  break;
510  case 'r':
511  sortOrder = 'd'; /* descending order */
512  break;
513  case 'L':
514  linkedTo = 1;
515  break;
516  case 'f':
517  doNotUseCache = 1;
518  break;
519  case 'F':
520  case 'p':
521  endChars = 1;
522  break;
523  case '1':
524  case 'C':
525  case 'l':
526  listmode = opt;
527  break;
528  case '-':
529  break;
530  default:
531  if (unknownOpts < ((int) sizeof(unoptstr) - 2))
532  unoptstr[unknownOpts + 1] = opt;
533  unknownOpts++;
534  break;
535  }
536  }
537 
538  /* Create a possibly relative path into an absolute path. */
539  PathCat(itempath, sizeof(itempath), gRemoteCWD,
540  (item == NULL) ? "." : item);
541 
542  if (unknownOpts > 0) {
543  /* Can't handle these -- pass them through
544  * to the server.
545  */
546 
547  Trace(0, "ls caching not used because of ls flags: %s\n", unoptstr);
548  optstr[0] = '-';
549  optstr[1] = listmode;
550  optstr[2] = '\0';
551  (void) STRNCAT(optstr, options);
552  if ((FTPListToMemory2(&gConn, (item == NULL) ? "" : item, &dirContents, optstr, 1, 0)) < 0) {
553  if (stream != NULL)
554  (void) fprintf(stderr, "List failed.\n");
555  return;
556  }
557 
558  rlisted = 1;
559  parsed = -1;
560  wasInCache = 0;
561  filp = NULL;
562  } else if ((doNotUseCache != 0) || ((ci = LsCacheLookup(itempath)) < 0)) {
563  /* Not in cache. */
564  wasInCache = 0;
565 
566  mlsd = 1;
567  if ((FTPListToMemory2(&gConn, (item == NULL) ? "" : item, &dirContents, "-l", 1, &mlsd)) < 0) {
568  if (stream != NULL)
569  (void) fprintf(stderr, "List failed.\n");
570  return;
571  }
572 
573  rlisted = 1;
574  filp = &fil;
575  if (mlsd != 0) {
576  parsed = UnMlsD(filp, &dirContents);
577  if (parsed < 0) {
578  Trace(0, "UnMlsD: %d\n", parsed);
579  }
580  } else {
581  parsed = UnLslR(filp, &dirContents, gConn.serverType);
582  if (parsed < 0) {
583  Trace(0, "UnLslR: %d\n", parsed);
584  }
585  }
586  if (parsed >= 0) {
587  VectorizeFileInfoList(filp);
588  if (filp->vec == NULL) {
589  if (stream != NULL)
590  (void) fprintf(stderr, "List processing failed.\n");
591  return;
592  }
593  }
594  } else {
595  filp = &gLsCache[ci].fil;
596  wasInCache = 1;
597  parsed = 1;
598  Trace(0, "ls cache hit: %s\n", itempath);
599  }
600 
601  if (rlisted != 0) {
602  Trace(0, "Remote listing contents {\n");
603  for (linePtr = dirContents.first;
604  linePtr != NULL;
605  linePtr = nextLinePtr)
606  {
607  nextLinePtr = linePtr->next;
608  Trace(0, " %s\n", linePtr->line);
609  }
610  Trace(0, "}\n");
611  }
612 
613  if (parsed >= 0) {
614  SortFileInfoList(filp, sortBy, sortOrder);
615  if (stream != NULL) {
616  if (listmode == 'l')
617  LsL(filp, endChars, linkedTo, stream);
618  else if (listmode == '1')
619  Ls1(filp, endChars, stream);
620  else
621  LsC(filp, endChars, stream);
622  }
623  if (wasInCache == 0) {
624  LsCacheAdd(itempath, filp);
625  }
626  } else if (stream != NULL) {
627  for (linePtr = dirContents.first;
628  linePtr != NULL;
629  linePtr = nextLinePtr)
630  {
631  nextLinePtr = linePtr->next;
632  (void) fprintf(stream, "%s\n", linePtr->line);
633  Trace(0, " %s\n", linePtr->line);
634  }
635  }
636 
637  DisposeLineListContents(&dirContents);
638 } /* Ls */
FileInfoVec vec
Definition: ncftp.h:266
void SortFileInfoList(FileInfoListPtr list, int sortKey, int sortOrder)
Definition: linelist.c:353
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
void LsL(FileInfoListPtr dirp, int endChars, int linkedTo, FILE *stream)
Definition: ls.c:284
LinePtr next
Definition: ncftp.h:80
void VectorizeFileInfoList(FileInfoListPtr list)
Definition: linelist.c:423
void Ls1(FileInfoListPtr dirp, int endChars, FILE *stream)
Definition: ls.c:419
LsCacheItem gLsCache[kLsCacheSize]
Definition: ls.c:26
FileInfoList fil
Definition: ls.h:12
int UnLslR(FileInfoListPtr filp, LineListPtr llp, int serverType)
Definition: glob.c:561
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void PathCat(char *const dst, const size_t dsize, const char *const cwd, const char *const src)
Definition: util.c:368
smooth NULL
Definition: ftsmooth.c:416
int LsCacheLookup(const char *const itempath)
Definition: ls.c:110
void InitFileInfoList(FileInfoListPtr list)
Definition: linelist.c:193
#define STRNCAT(d, s)
Definition: Strn.h:48
Definition: ncftp.h:79
Definition: ncftp.h:84
Definition: parse.h:22
#define Trace(x)
Definition: zutil.h:197
char gRemoteCWD[512]
Definition: cmds.c:33
int FTPListToMemory2(const FTPCIPtr cip, const char *const pattern, const LineListPtr llines, const char *const lsflags, const int blankLines, int *const tryMLSD)
Definition: io.c:366
int UnMlsD(FileInfoListPtr filp, LineListPtr llp)
Definition: glob.c:827
static void LsCacheAdd(const char *const itempath, FileInfoListPtr files)
Definition: ls.c:139
FTPConnectionInfo gConn
Definition: main.c:37
static ATOM item
Definition: dde.c:856
void InitLineList(LineListPtr list)
Definition: linelist.c:54
POINT cp
Definition: magnifier.c:59
FILE * stderr
void DisposeLineListContents(LineListPtr list)
Definition: linelist.c:33
static void LsC(FileInfoListPtr dirp, int endChars, FILE *stream)
Definition: ls.c:182
#define memset(x, y, z)
Definition: compat.h:39
char * line
Definition: ncftp.h:81

Referenced by capGetDriverDescriptionW(), GetLsCacheFileList(), and ListCmd().

◆ Ls1()

void Ls1 ( FileInfoListPtr  ,
int  ,
FILE  
)

Definition at line 419 of file ls.c.

420 {
421  char fTail[2];
422  int i;
423  int fType;
424  FileInfoVec diritemv;
425  FileInfoPtr diritemp;
426 
427  fTail[0] = '\0';
428  fTail[1] = '\0';
429  diritemv = dirp->vec;
430 
431  for (i=0; ; i++) {
432  diritemp = diritemv[i];
433  if (diritemp == NULL)
434  break;
435 
436  fType = (int) diritemp->type;
437  if (endChars != 0) {
438  if (fType == 'd')
439  fTail[0] = '/';
440  else
441  fTail[0] = '\0';
442  }
443 
444  (void) fprintf(stream, "%s%s\n",
445  diritemp->relname,
446  fTail
447  );
448 
449  Trace(0, "%s%s\n",
450  diritemp->relname,
451  fTail
452  );
453  }
454 } /* Ls1 */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
char * relname
Definition: ncftp.h:253
if(!(yy_init))
Definition: macro.lex.yy.c:714
Definition: parse.h:22
#define Trace(x)
Definition: zutil.h:197
int type
Definition: ncftp.h:258
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by Ls().

◆ LsCacheLookup()

int LsCacheLookup ( const char * const  )

Definition at line 110 of file ls.c.

111 {
112  int i, j;
113  time_t now;
114 
115  (void) time(&now);
116  for (i=0, j=gOldestLsCacheItem; i<kLsCacheSize; i++) {
117  if (--j < 0)
118  j = kLsCacheSize - 1;
119  if ((gLsCache[j].expiration != (time_t) 0) && (gLsCache[j].itempath != NULL)) {
120  if (strcmp(itempath, gLsCache[j].itempath) == 0) {
121  if (now > gLsCache[j].expiration) {
122  /* Found it, but it was expired. */
124  return (-1);
125  }
126  gLsCache[j].hits++;
127  return (j);
128  }
129  }
130  }
131  return (-1);
132 } /* LsCacheLookup */
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
char * itempath
Definition: ls.h:11
__u16 time
Definition: mkdosfs.c:366
static void FlushLsCacheItem(int i)
Definition: ls.c:79
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LsCacheItem gLsCache[kLsCacheSize]
Definition: ls.c:26
time_t now
Definition: finger.c:65
smooth NULL
Definition: ftsmooth.c:416
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define kLsCacheSize
Definition: ls.h:17
__kernel_time_t time_t
Definition: linux.h:252
int hits
Definition: ls.h:14
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int gOldestLsCacheItem
Definition: ls.c:27

Referenced by GetLsCacheFileList(), Ls(), and LsCacheAdd().

◆ LsDate()

void LsDate ( char ,
time_t   
)

Definition at line 250 of file ls.c.

251 {
252  struct tm *gtp;
253 
254  if (ts == kModTimeUnknown) {
255  (void) strcpy(dstr, " ");
256  return;
257  }
258  gtp = localtime(&ts);
259  if (gtp == NULL) {
260  (void) strcpy(dstr, "Jan 0 1900");
261  return;
262  }
263  if ((ts > gNowPlus1Hr) || (ts < gNowMinus6Mon)) {
264  (void) sprintf(dstr, "%s %2d %4d",
265  gLsMon[gtp->tm_mon],
266  gtp->tm_mday,
267  gtp->tm_year + 1900
268  );
269  } else {
270  (void) sprintf(dstr, "%s %2d %02d:%02d",
271  gLsMon[gtp->tm_mon],
272  gtp->tm_mday,
273  gtp->tm_hour,
274  gtp->tm_min
275  );
276  }
277 } /* LsDate */
time_t gNowMinus6Mon
Definition: ls.c:18
int tm_min
Definition: time.h:78
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
char gLsMon[13][4]
Definition: ls.c:21
int tm_mday
Definition: time.h:80
int tm_year
Definition: time.h:82
time_t gNowPlus1Hr
Definition: ls.c:18
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static const char * ts(int t)
smooth NULL
Definition: ftsmooth.c:416
int tm_mon
Definition: time.h:81
Definition: time.h:76
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
Definition: time.h:424
#define kModTimeUnknown
Definition: ncftp.h:377
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int tm_hour
Definition: time.h:79

Referenced by LsL().

◆ LsL()

void LsL ( FileInfoListPtr  ,
int  ,
int  ,
FILE  
)

Definition at line 284 of file ls.c.

285 {
286  FileInfoPtr diritemp;
287  FileInfoVec diritemv;
288  int i;
289  char fTail[2];
290  int fType;
291  const char *l1, *l2;
292  char datestr[16];
293  char sizestr[32];
294  char plugspec[16];
295  char plugstr[64];
296  const char *expad;
297 
298  fTail[0] = '\0';
299  fTail[1] = '\0';
300 
301  (void) time(&gNowPlus1Hr);
302  gNowMinus6Mon = gNowPlus1Hr - 15552000;
303  gNowPlus1Hr += 3600;
304 
305  diritemv = dirp->vec;
306 #ifdef HAVE_SNPRINTF
307  (void) snprintf(
308  plugspec,
309  sizeof(plugspec) - 1,
310 #else
311  (void) sprintf(
312  plugspec,
313 #endif
314  "%%-%ds",
315  (int) dirp->maxPlugLen
316  );
317 
318  if (dirp->maxPlugLen < 29) {
319  /* We have some extra space to work with,
320  * so we can space out the columns a little.
321  */
322  expad = " ";
323  } else {
324  expad = "";
325  }
326 
327  for (i=0; ; i++) {
328  diritemp = diritemv[i];
329  if (diritemp == NULL)
330  break;
331 
332  fType = (int) diritemp->type;
333  if (endChars != 0) {
334  if (fType == 'd')
335  fTail[0] = '/';
336  else
337  fTail[0] = '\0';
338  }
339 
340  if (diritemp->rlinkto != NULL) {
341  if (linkedTo != 0) {
342  l1 = "";
343  l2 = "";
344  } else {
345  l1 = " -> ";
346  l2 = diritemp->rlinkto;
347  }
348  } else {
349  l1 = "";
350  l2 = "";
351  }
352 
353  LsDate(datestr, diritemp->mdtm);
354 
355  if (diritemp->size == kSizeUnknown) {
356  *sizestr = '\0';
357  } else {
358 #ifdef HAVE_SNPRINTF
359  (void) snprintf(
360  sizestr,
361  sizeof(sizestr) - 1,
362 #else
363  (void) sprintf(
364  sizestr,
365 #endif
366 #if defined(HAVE_LONG_LONG) && defined(PRINTF_LONG_LONG)
368 #else
369  "%ld",
370 #endif
371  (longest_int) diritemp->size
372  );
373  }
374 
375 #ifdef HAVE_SNPRINTF
376  (void) snprintf(
377  plugstr,
378  sizeof(plugstr) - 1,
379 #else
380  (void) sprintf(
381  plugstr,
382 #endif
383  plugspec,
384  diritemp->plug
385  );
386 
387  (void) fprintf(stream, "%s %12s %s%s %s%s%s%s%s\n",
388  plugstr,
389  sizestr,
390  expad,
391  datestr,
392  expad,
393  diritemp->relname,
394  l1,
395  l2,
396  fTail
397  );
398  Trace(0, "%s %12s %s%s %s%s%s%s%s\n",
399  plugstr,
400  sizestr,
401  expad,
402  datestr,
403  expad,
404  diritemp->relname,
405  l1,
406  l2,
407  fTail
408  );
409  }
410 } /* LsL */
time_t gNowMinus6Mon
Definition: ls.c:18
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define snprintf
Definition: wintirpc.h:48
__u16 time
Definition: mkdosfs.c:366
time_t gNowPlus1Hr
Definition: ls.c:18
char * plug
Definition: ncftp.h:257
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define HAVE_LONG_LONG
Definition: wincfg.h:29
smooth NULL
Definition: ftsmooth.c:416
char * rlinkto
Definition: ncftp.h:255
char * relname
Definition: ncftp.h:253
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define longest_int
Definition: ncftp.h:68
Definition: parse.h:22
#define Trace(x)
Definition: zutil.h:197
int type
Definition: ncftp.h:258
time_t mdtm
Definition: ncftp.h:259
#define PRINTF_LONG_LONG
Definition: wincfg.h:31
#define kSizeUnknown
Definition: ncftp.h:376
void LsDate(char *dstr, time_t ts)
Definition: ls.c:250
longest_int size
Definition: ncftp.h:260
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by Ls().