MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / set_parent_directory

Function set_parent_directory

src/askloc.c:132–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131#endif
132static void set_parent_directory(char *dst_directory)
133{
134 int i;
135 int last_sep=-1;
136 for(i=0;dst_directory[i]!='\0';i++)
137 if(dst_directory[i]==PATH_SEP)
138 last_sep=i;
139#ifdef __CYGWIN__
140 if(memcmp(dst_directory, "/cygdrive", 9)==0)
141 {
142 if(last_sep > CYGDRIVE_LEN)
143 dst_directory[last_sep]='\0';
144 else
145 dst_directory[CYGDRIVE_LEN]='\0';
146 }
147 else if(last_sep>0)
148 dst_directory[last_sep]='\0';
149 else if(last_sep==0 && dst_directory[1]=='\0')
150 strcpy(dst_directory, "/cygdrive");
151 else
152 {
153 dst_directory[0]=PATH_SEP;
154 dst_directory[1]='\0';
155 }
156#elif defined(DJGPP) || defined(__OS2__)
157 if(last_sep > 2 )
158 dst_directory[last_sep]='\0'; /* subdirectory */
159 else if(last_sep == 2 && dst_directory[3]!='\0')
160 dst_directory[3]='\0'; /* root directory */
161 else
162 dst_directory[0]='\0'; /* drive list */
163#else
164 if(last_sep>0)
165 dst_directory[last_sep]='\0';
166 else
167 {
168 dst_directory[0]=PATH_SEP;
169 dst_directory[1]='\0';
170 }
171#endif
172}
173
174void ask_location(char *dst_directory, const unsigned int dst_size, const char *msg, const char *src_dir)
175{

Callers 1

askloc.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected