// enable ls -R
#define BB_FEATURE_LS_RECURSIVE
//
+// enable ls -L
+#define BB_FEATURE_LS_FOLLOWLINKS
+//
// Change ping implementation -- simplified, featureless, but really small.
//#define BB_FEATURE_SIMPLE_PING
//
#ifdef BB_FEATURE_LS_TIMESTAMPS
static unsigned int time_fmt= TIME_MOD;
#endif
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+static unsigned int follow_links=FALSE;
+#endif
static unsigned short column = 0;
#ifdef BB_FEATURE_AUTOWIDTH
cur= (struct dnode *)xmalloc(sizeof(struct dnode));
cur->fullname= xstrdup(fullname);
cur->name= cur->fullname + (int)(fnend - fullname) ;
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+ if (follow_links == TRUE) {
+ if (stat(fullname, &cur->dstat)) {
+ errorMsg("%s: %s\n", fullname, strerror(errno));
+ free(cur->fullname);
+ free(cur);
+ continue;
+ }
+ } else
+#endif
if (lstat(fullname, &cur->dstat)) { /* get file stat info into node */
errorMsg("%s: %s\n", fullname, strerror(errno));
free(cur->fullname);
#ifdef BB_FEATURE_LS_TIMESTAMPS
"cetu"
#endif
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+"L"
+#endif
)) > 0) {
switch (opt) {
case '1': style_fmt = STYLE_SINGLE; break;
case 't': sort_opts= SORT_MTIME; break;
case 'u': time_fmt = TIME_ACCESS; sort_opts= SORT_ATIME; break;
#endif
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+ case 'L': follow_links= TRUE; break;
+#endif
#ifdef BB_FEATURE_AUTOWIDTH
case 'T': tabstops= atoi(optarg); break;
case 'w': terminal_width= atoi(optarg); break;
#ifdef BB_FEATURE_LS_TIMESTAMPS
static unsigned int time_fmt= TIME_MOD;
#endif
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+static unsigned int follow_links=FALSE;
+#endif
static unsigned short column = 0;
#ifdef BB_FEATURE_AUTOWIDTH
cur= (struct dnode *)xmalloc(sizeof(struct dnode));
cur->fullname= xstrdup(fullname);
cur->name= cur->fullname + (int)(fnend - fullname) ;
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+ if (follow_links == TRUE) {
+ if (stat(fullname, &cur->dstat)) {
+ errorMsg("%s: %s\n", fullname, strerror(errno));
+ free(cur->fullname);
+ free(cur);
+ continue;
+ }
+ } else
+#endif
if (lstat(fullname, &cur->dstat)) { /* get file stat info into node */
errorMsg("%s: %s\n", fullname, strerror(errno));
free(cur->fullname);
#ifdef BB_FEATURE_LS_TIMESTAMPS
"cetu"
#endif
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+"L"
+#endif
)) > 0) {
switch (opt) {
case '1': style_fmt = STYLE_SINGLE; break;
case 't': sort_opts= SORT_MTIME; break;
case 'u': time_fmt = TIME_ACCESS; sort_opts= SORT_ATIME; break;
#endif
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+ case 'L': follow_links= TRUE; break;
+#endif
#ifdef BB_FEATURE_AUTOWIDTH
case 'T': tabstops= atoi(optarg); break;
case 'w': terminal_width= atoi(optarg); break;