fixed argp code, implemented --all
This commit is contained in:
1 parent
62542734b5
commit
c87dd241a0
3 files changed
+99
-58
No files matched your search
+7
-14
@@ -16,22 +16,11 @@ int main( int argc, char** argv )
|
||||
{
|
||||
arguments_t args;
|
||||
|
||||
initialise_args( &args );
|
||||
|
||||
parse_args( argc, argv, &args );
|
||||
|
||||
if ( 2 < argc ) return -1;
|
||||
|
||||
char argument_directory[ PATH_MAX ];
|
||||
|
||||
if ( 2 == argc )
|
||||
{
|
||||
strcpy( argument_directory, argv[1] );
|
||||
}
|
||||
else
|
||||
{
|
||||
argument_directory[0] = '.';
|
||||
argument_directory[1] = '\0';
|
||||
}
|
||||
|
||||
char argument_directory[ PATH_MAX ] = ".";
|
||||
DIR* directory = opendir( argument_directory );
|
||||
struct dirent* entry;
|
||||
|
||||
@@ -47,6 +36,10 @@ int main( int argc, char** argv )
|
||||
|
||||
while ( NULL != ( entry = readdir( directory ) ) )
|
||||
{
|
||||
if ( !args.show_all && ( !strncmp( entry->d_name, ".", 1) || !strncmp( entry->d_name, "..", 2 ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
log_info( "%s", entry->d_name );
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user