aboutsummaryrefslogtreecommitdiff
path: root/tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'tar.c')
-rw-r--r--tar.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/tar.c b/tar.c
index 6d8e633b0..7e56fb99a 100644
--- a/tar.c
+++ b/tar.c
@@ -147,6 +147,9 @@ extern int tar_main(int argc, char **argv)
147 char** extractList=NULL; 147 char** extractList=NULL;
148#if defined BB_FEATURE_TAR_EXCLUDE 148#if defined BB_FEATURE_TAR_EXCLUDE
149 int excludeListSize=0; 149 int excludeListSize=0;
150 char *excludeFileName ="-";
151 FILE *fileList;
152 char file[256];
150#endif 153#endif
151 const char *tarName="-"; 154 const char *tarName="-";
152 int listFlag = FALSE; 155 int listFlag = FALSE;
@@ -198,7 +201,7 @@ extern int tar_main(int argc, char **argv)
198 break; 201 break;
199#if defined BB_FEATURE_TAR_EXCLUDE 202#if defined BB_FEATURE_TAR_EXCLUDE
200 case 'e': 203 case 'e':
201 if (strcmp(*argv, "exclude")==0) { 204 if (strcmp(*argv, "xclude")==0) {
202 excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); 205 excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2));
203 excludeList[excludeListSize] = *(++argv); 206 excludeList[excludeListSize] = *(++argv);
204 if (excludeList[excludeListSize] == NULL) 207 if (excludeList[excludeListSize] == NULL)
@@ -211,6 +214,30 @@ extern int tar_main(int argc, char **argv)
211 stopIt=TRUE; 214 stopIt=TRUE;
212 break; 215 break;
213 } 216 }
217 case 'X':
218 if (*excludeFileName != '-')
219 fatalError("Only one 'X' option allowed\n");
220 excludeFileName = *(++argv);
221 if (excludeFileName == NULL)
222 fatalError("Option requires an argument: No file specified\n");
223 fileList = fopen (excludeFileName, "rt");
224 if (! fileList)
225 fatalError("Exclude file: file not found\n");
226 while (!feof(fileList)) {
227 fscanf(fileList, "%s", file);
228 excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2));
229 excludeList[excludeListSize] = malloc(sizeof(char) * (strlen(file)+1));
230 strcpy(excludeList[excludeListSize],file);
231 /* Remove leading "/"s */
232 if (*excludeList[excludeListSize] == '/')
233 excludeList[excludeListSize] = (excludeList[excludeListSize])+1;
234 /* Tack a NULL onto the end of the list */
235 excludeList[++excludeListSize] = NULL;
236 }
237
238 fclose(fileList);
239 stopIt=TRUE;
240 break;
214#endif 241#endif
215 case '-': 242 case '-':
216 break; 243 break;