37 fprintf(stdout,
"Enter number to remove: ");
44 success = fscanf(stdin,
"%u",&index);
64 "%s: Error: Invalid index '%d'\n",
70 "%s: Warning: Directory not in list: '%s'\n",
78 int main(
int argc,
char* argv[] )
93 int dir_list_needs_save = 0;
101 if( dir_list == NULL ) {
102 fprintf(stderr,
"%s: Warning: Unable to load list file '%s'\n",
111 dir_list_needs_save = do_remove( &cfg, argv[0], dir_list );
120 dir_list_needs_save = 1;
129 dir_list_needs_save = 1;
137 "%s: Warning: Directory already in list: '%s'\n",
142 "%s: Warning: Bookmark name already in list: '%s'\n",
155 dir_list_needs_save = 1;
163 _setmode(1,_O_BINARY);
172 fprintf(stderr,
"Unhandled operation type\n");
175 if( dir_list_needs_save ) {
180 ret_code = EXIT_SUCCESS;
182 ret_code = EXIT_FAILURE;
int dir_in_list(dir_list_t p_list, const char *const p_dir)
char * wd_bookmark_name
Name of a bookmark read from the command line on which operations should be performed.
void list_dirs(const dir_list_t p_list)
int dump_dir_with_name(const dir_list_t p_list, const char *const p_name)
time_t wd_now_time
Time to use as the current time when manipulating datestamps.
struct dir_list_item * dir_list
The dir_list module provides functions to manipulate and search the list of bookmarks.
wd_oper_t wd_oper
Type of operation which the command line has instructed should be performed.
void init_cmdln(config_container_t *const p_config)
Initialise the specified config with default values.
int dump_dir_if_exists(const dir_list_t p_list, const char *const p_dir)
char * list_fn
Directory containing list of bookmarks.
int process_cmdln(config_container_t *const p_config, const int argc, char *const argv[])
char wd_oper_dir[MAXPATHLEN]
Directory read from the command line upon which operations should be performed.
dir_list_t load_dir_list(const config_container_t *const p_config, const char *const p_fn)
Load a set of bookmarks from the specified file.
int bookmark_in_list(dir_list_t p_list, const char *const p_name)
const config_container_t * cfg
int save_dir_list(const dir_list_t p_list, const char *p_fn)
int remove_dir_by_index(dir_list_t p_list, const size_t p_dir)
int add_dir(dir_list_t p_list, const char *const p_dir, const char *const p_name, const time_t p_t_added, const time_t p_t_accessed, const wd_entity_t p_type)
int wd_store_access
Indicate whether or not access times should be stored in the bookmarks.
void dump_dir_list(const dir_list_t p_list)
int wd_prompt
Indicate whether or not to run in "interactive" mode.
int main(int argc, char *argv[])
int process_env(config_container_t *const p_config)
int remove_dir(dir_list_t p_list, const char *const p_dir)
dir_list_t new_dir_list(void)
Create a new directory list structure.