Add -i option to ls(1).

This commit is contained in:
Jonas 'Sortie' Termansen 2014-03-06 21:31:41 +01:00
parent 2194bdb8b9
commit 05a124467e
1 changed files with 6 additions and 0 deletions

View File

@ -44,6 +44,7 @@ int current_year;
#endif #endif
bool directory = false; bool directory = false;
bool inode = false;
bool longformat = false; bool longformat = false;
bool showdotdot = false; bool showdotdot = false;
bool showdotfiles = false; bool showdotfiles = false;
@ -130,6 +131,8 @@ int handleentry_internal(const char* fullpath, const char* name)
const char* colorpre; const char* colorpre;
const char* colorpost; const char* colorpost;
getentrycolor(&colorpre, &colorpost, st.st_mode); getentrycolor(&colorpre, &colorpost, st.st_mode);
if ( inode )
printf("%ju ", (uintmax_t) st.st_ino);
if ( !longformat ) if ( !longformat )
{ {
printf("%s%s%s\n", colorpre, name, colorpost); printf("%s%s%s\n", colorpre, name, colorpost);
@ -294,6 +297,9 @@ int main(int argc, char* argv[])
case 'd': case 'd':
directory = true; directory = true;
break; break;
case 'i':
inode = true;
break;
case 'l': case 'l':
longformat = true; longformat = true;
break; break;