Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
iso_support_arp.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
3 #2023 X March 21 19:50 PM Brasília Time
4
5* *
6* Licensa de Copia (C) <2023> <Aurora Boreal> *
7* *
8* Este programa e software livre: voce pode redistribuir isto e/ou *
9* modificar isto sobre os termos do GNU Licensa Geral Pública como 25
10* publicado pela Fundacao de Software Livre, tanto a versão 3 da *
11* Licensa, ou (dependendo da sua opcao) qualquer versao posterior. *
12* *
13* Este programa e distribuido na esperanca que isto vai ser util, *
14* mas SEM QUALQUER GARANTIA; sem ate mesmo a implicada garantia de *
15* COMERCIALIZAcaO ou CABIMENTO PARA UM FIM PARTICULAR. Veja a *
16* Licensa Geral Publica para mais detalhes. *
17* *
18* Você deve ter recebido uma cópia da LICENSA GERAL PUBLICA e a GNU *
19* Licensa Publica Menor junto com este programa *
20* Se não, veja <http://www.gnu.org/licenses/>. *
21* *
22* Suporte: sourceforge.net github.com *
23* *
24* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
25
26* Pereira: arsoftware25@gmail.com ricardo@arsoftware.net.br *
27* xcx: arsoftware10@gmail.com charli@arsoftware.net.br *
28 Yasmin: yasmin@arsoftware.net.br *
29 pereira1001@users.sourceforge.net
30 */
31
43void dump_file_or_folder_iso(char const *name, char *initial_path_ar)
44{
45 DWORD attributes;
46 char file_or_folder_to_process[1000] = {0};
47 char file_or_folder_to_process_copy[1024] = {0};
48 char tar_file_copy[1024] = {0};
49 bool is_dir_ar = false;
50 int fd_ar;
51
52 strcpy(file_or_folder_to_process, initial_path_ar);
53
54 if (strlen(file_or_folder_to_process))
55 {
56 if ('\\' != file_or_folder_to_process[strlen(file_or_folder_to_process) - 1])
57 {
58 strcat(file_or_folder_to_process, "\\");
59 }
60 }
61 else
62 {
63 assert(0 && "path cannot be empty");
64 }
65
66 strcat(file_or_folder_to_process, name);
67
68 strcpy(file_or_folder_to_process_copy, file_or_folder_to_process);
69
70 trocadordebackslashtras(file_or_folder_to_process_copy);
71
72 strtolower_ar(file_or_folder_to_process_copy);
73 strcpy(tar_file_copy, archive_name_array_filename);
74 strtolower_ar(tar_file_copy);
75
76 if (0 == strcmp(tar_file_copy, file_or_folder_to_process_copy))
77 {
78 strcpy(warning_message_k, "Cannot add himself to the tar file, skipping...");
80 return;
81 }
82
84 {
85 WCHAR *ar_temp = (void *)malloc(AMANDA__SIZE_ww);
86 WCHAR *ar_temp2 = (void *)malloc(AMANDA__SIZE_ww);
87
88 attributes = GetFileAttributesW(permissive_name_m_(amanda_asciitowide_1_(file_or_folder_to_process, ar_temp), ar_temp2));
89
90 free(ar_temp);
91 free(ar_temp2);
92 }
93 if (INVALID_FILE_ATTRIBUTES == attributes)
94 {
96 sprintf(warning_message_k, "File %s has invalid attributes, skipping", file_or_folder_to_process);
98
99 return;
100 }
101
102 if (attributes & FILE_ATTRIBUTE_DIRECTORY)
103 {
104 is_dir_ar = true;
105 }
106 else
107 {
108 if ((attributes & FILE_ATTRIBUTE_READONLY) || //error here
109 (attributes & FILE_ATTRIBUTE_HIDDEN) ||
110 (attributes & FILE_ATTRIBUTE_SYSTEM) ||
111 (attributes & FILE_ATTRIBUTE_ARCHIVE))
112 {
113 ;
114 }
115 else
116 {
118 sprintf(warning_message_k, "File %s has invalid attributes, skipping...", file_or_folder_to_process);
120 return;
121 }
122 }
123
124 if (true == is_dir_ar)
125 {
126 ;
127 }
128 else
129 {
130 {
131 WCHAR *ar_temp = (void *)malloc(AMANDA__SIZE_ww);
132 WCHAR *ar_temp2 = (void *)malloc(AMANDA__SIZE_ww);
133
134 fd_ar = _wopen(permissive_name_m_(amanda_asciitowide_1_(file_or_folder_to_process, ar_temp), ar_temp2), O_RDONLY | O_BINARY,
135 _S_IREAD);
136 free(ar_temp);
137 free(ar_temp2);
138 }
139
140 if (-1 == fd_ar)
141 {
143 sprintf(warning_message_k, "Cannot open %s to write", file_or_folder_to_process);
145 return;
146 }
147
148 close(fd_ar);
149 }
150 sprintf(process_message_k, "Processing %s", file_or_folder_to_process);
152}
#define FILE_ATTRIBUTE_READONLY
Definition 7zTypes.h:143
#define FILE_ATTRIBUTE_HIDDEN
Definition 7zTypes.h:144
#define FILE_ATTRIBUTE_SYSTEM
Definition 7zTypes.h:145
#define FILE_ATTRIBUTE_ARCHIVE
Definition 7zTypes.h:147
UINT32 DWORD
Definition 7zTypes.h:194
#define FILE_ATTRIBUTE_DIRECTORY
Definition 7zTypes.h:146
wchar_t * permissive_name_m_(const wchar_t *wname, WCHAR *ar_temp)
Definition tar_1_33.c:279
#define AMANDA__SIZE_ww
Definition be_xml.c:64
WCHAR * amanda_asciitowide_1_(char *pUTF8, WCHAR *ar_temp)
Definition tar_1_33.c:677
void add_more_one(char *data_ar)
Definition create_zen_ar.c:383
char process_message_k[AMANDA__SIZE]
Definition create_zen_ar.c:506
int paths_with_invalid_attributes_arp
Definition create_zen_ar.c:313
void strtolower_ar(char *path)
Definition create_zen_ar.c:669
char warning_message_k[AMANDA__SIZE]
Definition create_zen_ar.c:491
int files_that_cannot_be_read
Definition create_zen_ar.c:311
void trocadordebackslashfrente(char *path)
Definition create_zen_ar.c:1423
void trocadordebackslashtras(char *path)
Definition extract_kkk.c:2087
void dump_file_or_folder_iso(char const *name, char *initial_path_ar)
Definition iso_support_arp.c:43
#define assert(condition)
Definition lz4.c:273
#define O_BINARY
Definition compress42.c:385
char archive_name_array_filename[AMANDA__SIZE]
Definition tar_1_33.c:3215
char name[NAME_LEN_MAX+1]
Name of the filter.
Definition string_conversion.c:450