aboutsummaryrefslogtreecommitdiff
path: root/tar.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-12-04 18:51:09 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-12-04 18:51:09 +0000
commit4291a19ff2a34af04adfdb28e3902e4ac1aad38d (patch)
treea4f6d4889d8b3e779477ccbabb7de29d80fe0a6f /tar.c
parent91883601bbec8de7da1c7f3172ab3b408eb499e6 (diff)
downloadbusybox-w32-4291a19ff2a34af04adfdb28e3902e4ac1aad38d.tar.gz
busybox-w32-4291a19ff2a34af04adfdb28e3902e4ac1aad38d.tar.bz2
busybox-w32-4291a19ff2a34af04adfdb28e3902e4ac1aad38d.zip
Patch to add in the -X option and fix the --exclude bug, originally by
Sebastien Huet, and now ported to the latest and greatest by both Arne Bernin <ab@netropol.de> and kent robotti <robotti@metconnect.com>. git-svn-id: svn://busybox.net/trunk/busybox@1373 69ca8d6d-28ef-0310-b511-8ec308f3f277
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;