wd
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Typedefs | Functions
dir_list.h File Reference

The dir_list module provides functions to manipulate and search the list of bookmarks. More...

#include "cmdln.h"
#include <stddef.h>
#include <time.h>

Go to the source code of this file.

Typedefs

typedef struct dir_list_sdir_list_t
 Structure to represent a list of directory bookmarks. More...
 

Functions

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. More...
 
dir_list_t new_dir_list (void)
 Create a new directory list structure. More...
 
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 remove_dir (dir_list_t p_list, const char *const p_dir)
 
int dump_dir_with_name (const dir_list_t p_list, const char *const p_name)
 
int dump_dir_if_exists (const dir_list_t p_list, const char *const p_dir)
 
int remove_dir_by_index (dir_list_t p_list, const size_t p_dir)
 
int dir_in_list (dir_list_t p_list, const char *const p_dir)
 
int bookmark_in_list (dir_list_t p_list, const char *const p_name)
 
int save_dir_list (const dir_list_t p_list, const char *p_fn)
 
void dump_dir_list (const dir_list_t p_list)
 
void list_dirs (const dir_list_t p_list)
 

Detailed Description

The dir_list module provides functions to manipulate and search the list of bookmarks.

LICENSE

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file dir_list.h.

Typedef Documentation

typedef struct dir_list_s* dir_list_t

Structure to represent a list of directory bookmarks.

Definition at line 34 of file dir_list.h.

Function Documentation

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 
)

Definition at line 96 of file dir_list.c.

int bookmark_in_list ( dir_list_t  p_list,
const char *const  p_name 
)

Definition at line 399 of file dir_list.c.

int dir_in_list ( dir_list_t  p_list,
const char *const  p_dir 
)

Definition at line 467 of file dir_list.c.

int dump_dir_if_exists ( const dir_list_t  p_list,
const char *const  p_dir 
)

Definition at line 547 of file dir_list.c.

void dump_dir_list ( const dir_list_t  p_list)

Definition at line 734 of file dir_list.c.

int dump_dir_with_name ( const dir_list_t  p_list,
const char *const  p_name 
)

Definition at line 580 of file dir_list.c.

void list_dirs ( const dir_list_t  p_list)

Definition at line 635 of file dir_list.c.

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.

Note that in the case where invalid data is found in the file or a problem is encountered while reading from the file, the function will return a list of the bookmarks it was able to successfully read

Parameters
[in]p_configConfiguration options to associate with the dir list
[in]p_fnThe filename to load the bookmarks from
Returns
Pointer to a list of bookmarks loaded from the file or NULL in the case of a problem (failure to allocate memory, failure to open file)

Definition at line 213 of file dir_list.c.

dir_list_t new_dir_list ( void  )

Create a new directory list structure.

Allocates the required memory and initialises the structure members

Returns
Pointer to the newly created structure or NULL if allocation failed

Definition at line 156 of file dir_list.c.

int remove_dir ( dir_list_t  p_list,
const char *const  p_dir 
)

Definition at line 455 of file dir_list.c.

int remove_dir_by_index ( dir_list_t  p_list,
const size_t  p_dir 
)

Definition at line 437 of file dir_list.c.

int save_dir_list ( const dir_list_t  p_list,
const char *  p_fn 
)

Definition at line 822 of file dir_list.c.