58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
/* --------------------------------------------------------
|
|
* -- project: SCAN
|
|
* -- description: handle commandline arguments
|
|
* --------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef __ARGUMENTS_H
|
|
#define __ARGUMENTS_H
|
|
|
|
#include <stdbool.h>
|
|
#include <argp.h>
|
|
|
|
#define MAX_PATH_NUM ( ( int )256 )
|
|
|
|
typedef enum {
|
|
no_permissions = 0,
|
|
char_permissions = 1,
|
|
octal_permissions = 2
|
|
} permission_mode_t;
|
|
|
|
typedef enum {
|
|
sort_by_name = 0,
|
|
sort_by_extension = 1,
|
|
sort_by_time = 2,
|
|
sort_by_size = 3
|
|
} sorting_mode_t;
|
|
|
|
typedef enum {
|
|
time_none = 0,
|
|
time_access = 1,
|
|
time_modified = 2,
|
|
time_status_change = 3
|
|
} time_mode_t;
|
|
|
|
typedef struct {
|
|
bool show_all;
|
|
bool show_almost_all;
|
|
bool case_sensitive_sorting;
|
|
bool no_colour;
|
|
bool group_directories;
|
|
bool display_help;
|
|
bool long_view;
|
|
bool reverse_order;
|
|
bool tree_view;
|
|
bool show_git_dir;
|
|
size_t depth;
|
|
permission_mode_t permission_mode;
|
|
sorting_mode_t sorting_mode;
|
|
time_mode_t time_mode;
|
|
char* path[MAX_PATH_NUM];
|
|
size_t path_count;
|
|
} arguments_t;
|
|
|
|
void initialise_args( arguments_t* arguments );
|
|
error_t parse_args( int argc, char** argv, arguments_t* arguments );
|
|
|
|
#endif
|