Home | Develop | Download | Contact
pdsfilesfunc.h
1 /*
2  * pdsfilesfunc.h
3  *
4  * Copyright 2011 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
30 #ifndef __PDSFILESFUNC_H__
31 #define __PDSFILESFUNC_H__
32 
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #include <stdio.h>
39 #include <stdio.h>
40 #include <pds/pdscstring.h>
41 
42 #ifndef TRUE
43  #define TRUE 1
44 #endif
45 
46 #ifndef FALSE
47  #define FALSE 0
48 #endif
49 
66 typedef enum{
70 }ArqType;
71 
72 
73 
74 
95 PdsCellString *pds_get_subdirs_new(const PdsCellString *C0,const char* pattern_include,const char* pattern_exclude);
96 
97 
98 
118 PdsCellString *pds_get_arquives_new(const char *dirpath,ArqType Type,const char* pattern_include,const char* pattern_exclude);
119 
121 
141 char *pds_get_filedata_string(const char *pathname,const char* pattern);
142 
155 int pds_get_filedata_int(const char *pathname,const char* pattern);
156 
170 int pds_get_filedata_strcmp(const char *pathname,const char* pattern,const char* dat);
171 
172 
189 PdsCellString *pds_get_filedata_cell_string(const char *pathname,const char* pattern,const char *separator);
190 
192 
212 PdsCellString *pds_get_all_subdirs_new(const char *dirpath,const char* pattern_include,const char* pattern_exclude);
213 
214 
215 
229 PdsCellString *pds_get_all_files_new(const char *dirpath, const char* pattern_include,
230  const char* pattern_exclude,
231  const char* file_pattern_include,
232  const char* file_pattern_exclude);
233 
234 
247 
248 
262 PdsCellString *pds_get_all_filename_extensions(const char *dirpath, const char* pattern_include,
263  const char* pattern_exclude,
264  const char* file_pattern_include,
265  const char* file_pattern_exclude);
266 
268 
269 
285 int pds_cat(const char* filepath);
286 
305 char *pds_get_realpath(const char* filepath);
306 
314 char *pds_get_homedir(void);
315 
322 char pds_filesep(void);
323 
324 
335 char *pds_get_basename(const char * file_path);
336 
337 
350 char *pds_get_filename_extension(const char * file_path);
351 
352 
365 char *pds_get_filename(const char * file_path);
366 
367 
378 char *pds_get_dirname(const char * file_path);
379 
380 
393 char *pds_get_filepath_with_extension(const char *file_path,const char *extension);
394 
395 
409 char *pds_get_temporal_filepath(const char *filepath,const char *groupname);
410 
411 
421 char* pds_get_absolute_dirname(void);
422 
432 char* pds_get_absolute_programpath(void);
433 
435 
436 
437 
452 char *pds_fgets(FILE *fd);
453 
454 
463 char *pds_read_line(FILE *fd);
464 
466 
467 
481 int pds_is_file(const char *path);
482 
483 
491 int pds_is_dir(const char *path);
492 
493 
501 long pds_get_file_size(const char *path);
502 
512 long pds_get_number_of_chars(const char *path);
513 
514 
523 int pds_exist_file(const char *path);
524 
525 
534 int pds_archive_is_accessible(const char *path);
535 
537 
560 int pds_file_pattern_replacement(const char *filename_out,const char *filename_in,const char *pat,const char *rep);
561 
589 int pds_file_content_replacement( const char *filename_out,const char *filename_in,
590  const char *pat_open,const char *pat_close,
591  char *(*func)(const char *));
592 
593 
595 
600 #ifdef __cplusplus
601 }
602 #endif
603 
604 #endif /* __PDSFILESFUNC_H__ */
605 
char * pds_get_filedata_string(const char *pathname, const char *pattern)
La funcion analiza linea por linea el archivo y retorna el texto despues de el primer patrón pattern ...
int pds_archive_is_accessible(const char *path)
Retorna TRUE si el archivo simbólico o real (Directorio o fichero) es accesible.
char * pds_get_filename_extension(const char *file_path)
Obtén la extención de fichero desde una ruta de fichero. Esta función tendrá problemas con archivos o...
PdsCellString * pds_get_all_filename_extensions(const char *dirpath, const char *pattern_include, const char *pattern_exclude, const char *file_pattern_include, const char *file_pattern_exclude)
Retorna una estructura PdsCellString con un arreglo de células con las extenciones de archivos en el ...
char * pds_get_filepath_with_extension(const char *file_path, const char *extension)
Obtén un filepath con el mismo filename pero con la extención cambiada a extension.
int pds_is_file(const char *path)
TRUE si es un fichero (simbólico o real) o FALSE si no.
char * pds_get_temporal_filepath(const char *filepath, const char *groupname)
Obtén un nombre de archivo con la misma extención y directorio pero con nombre de archivo diferente y...
int pds_file_pattern_replacement(const char *filename_out, const char *filename_in, const char *pat, const char *rep)
Esta función busca en un archivo de texto filename_in, un patron pat y los remplaza con el contenido ...
PdsCellString * pds_get_all_subdirs_new(const char *dirpath, const char *pattern_include, const char *pattern_exclude)
Retorna una estructura PdsCellString con un arreglo de células con nombres de subdirectorios incluyen...
int pds_cat(const char *filepath)
Imprime en pantalla el contenido de un archivo de texto apuntado por filepath.
long pds_get_number_of_chars(const char *path)
Retorna el número de caracteres de un archivo. Se asume que es un archivo de texto.
int pds_get_filedata_int(const char *pathname, const char *pattern)
La funcion analiza linea por linea el archivo y retorna el valor int despues de el primer patrón patt...
char * pds_get_absolute_programpath(void)
Obtén la ruta del programa que invoca esta función.
PdsCellString * pds_get_all_filename_extensions_in_cell(const PdsCellString *FileCell)
Retorna una estructura PdsCellString con un arreglo de células con las extenciones de archivos en el ...
PdsCellString * pds_get_filedata_cell_string(const char *pathname, const char *pattern, const char *separator)
La funcion analiza linea por linea el archivo y retorna el texto despues de el primer patrón pattern ...
char * pds_get_realpath(const char *filepath)
Expande todos los enlaces simbolicos y resuleve referencia a /./, /../ y caracteres extras &#39;/&#39; en fil...
char * pds_fgets(FILE *fd)
Retorna una linea leida desde un desriptor de fichero de texto.
PdsCellString * pds_get_subdirs_new(const PdsCellString *C0, const char *pattern_include, const char *pattern_exclude)
Retorna una estructura PdsCellString con los directorios (solo un nivel), de cada directorio espesifi...
long pds_get_file_size(const char *path)
Retorna el número de bytes del archivo.
PdsCellString * pds_get_all_files_new(const char *dirpath, const char *pattern_include, const char *pattern_exclude, const char *file_pattern_include, const char *file_pattern_exclude)
Retorna una estructura PdsCellString con un arreglo de células con los nombres de archivos...
char pds_filesep(void)
Retorna um caracter con el separador de archivo para el sistema.
char * pds_get_filename(const char *file_path)
Obtén el nombre de fichero desde una ruta de fichero. Esta función tendrá problemas con archivos ocul...
int pds_get_filedata_strcmp(const char *pathname, const char *pattern, const char *dat)
La funcion analiza linea por linea el archivo y retorna TRUE si el valor despues de el primer patrón ...
char * pds_read_line(FILE *fd)
Retorna una linea leida desde un desriptor de fichero de texto.
char * pds_get_homedir(void)
Retorna una nueva cadena de texto con la dirección del directorio de usuario. HOME en gnu-linux y {HO...
char * pds_get_basename(const char *file_path)
Obtén el nombre base desde una ruta de fichero.
ArqType
Una union de tipo ArqType. Esta union tiene dos tipos de datos tipo directorio y tipo documento...
Definition: pdsfilesfunc.h:66
int pds_is_dir(const char *path)
TRUE is es un directorio (simbólico o real) o FALSE si no.
Una estructura tipo PdsCellString . Esta estructura genera un arreglo de células con de cadenas te te...
Definition: pdscstring.h:66
int pds_file_content_replacement(const char *filename_out, const char *filename_in, const char *pat_open, const char *pat_close, char *(*func)(const char *))
Esta función busca en un archivo de texto filename_in, el contenido entre un patrón pat_open y pat_cl...
char * pds_get_absolute_dirname(void)
Obtén el directorio base del programa que invoca esta función.
char * pds_get_dirname(const char *file_path)
Obtén el directorio madre desde una ruta de fichero.
PdsCellString * pds_get_arquives_new(const char *dirpath, ArqType Type, const char *pattern_include, const char *pattern_exclude)
Retorna los archivos dentro de un directorio (siguiendo algunos criterios).
int pds_exist_file(const char *path)
Retorna TRUE si path es un fichero real o simbólico (no un directorio) y es accesible.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed