Re: null byte list= terminator patch
Björn JACKE <[email protected]>
| Newsgroups | gmane.comp.archivers.star.user |
|---|---|
| Organization | Service Network GmbH, Goettingen, Germany |
| Message-ID | <[email protected]> |
On 2005-06-24 at 12:21 +0200 Bjoern Jacke sent off: > here is a patch well, here ist is...
star-1.5a60-null_terminated_lists.patch
(text/plain, 8.3 KB)
diff -ur star-1.5/star/create.c star-1.5bj/star/create.c
--- star-1.5/star/create.c 2005-05-22 14:21:51.000000000 +0200
+++ star-1.5bj/star/create.c 2005-06-24 03:08:34.127868429 +0200
@@ -104,6 +104,7 @@
extern BOOL cflag;
extern BOOL uflag;
extern BOOL nodir;
+extern BOOL null;
extern BOOL acctime;
extern BOOL dirmode;
extern BOOL paxfollow;
@@ -619,8 +620,13 @@
name = __malloc(nsize, "name buffer");
for (nlen = 1; nlen > 0; ) {
- if ((nlen = fgetline(listf, name, nsize)) < 0)
+ if (!null) {
+ if ((nlen = fgetline(listf, name, nsize)) < 0)
break;
+ } else {
+ if ((nlen = ngetline(listf, name, nsize)) < 0)
+ break;
+ }
if (nlen == 0)
continue;
if (nlen >= PATH_MAX) {
diff -ur star-1.5/star/restore.c star-1.5bj/star/restore.c
--- star-1.5/star/restore.c 2005-05-09 23:38:10.000000000 +0200
+++ star-1.5bj/star/restore.c 2005-06-24 02:28:10.743220884 +0200
@@ -119,7 +119,7 @@
LOCAL void purgeent __PR((imap_t *imp));
LOCAL void purgetree __PR((imap_t *imp));
EXPORT void sym_init __PR((GINFO *gp));
-LOCAL int ngetline __PR((FILE *f, char *buf, int len));
+EXPORT int ngetline __PR((FILE *f, char *buf, int len));
EXPORT void sym_close __PR((void));
LOCAL void sym_dump __PR((void));
LOCAL void writeheader __PR((FILE *f));
@@ -1526,7 +1526,7 @@
/*
* A special version of fgetline() that does not stop on '\n' but only on '\0'.
*/
-LOCAL int
+EXPORT int
ngetline(f, buf, len)
register FILE *f;
char *buf;
diff -ur star-1.5/star/star.c star-1.5bj/star/star.c
--- star-1.5/star/star.c 2005-05-22 22:04:23.000000000 +0200
+++ star-1.5bj/star/star.c 2005-06-24 03:07:43.376641154 +0200
@@ -171,6 +171,7 @@
BOOL prblockno = FALSE; /* -block-number for all files */
BOOL no_xheader = FALSE; /* -no-xheader ignore P.2001 */
BOOL no_fsync = FALSE; /* -no-fsync on extract */
+BOOL null = FALSE; /* null byte is list terminator */
BOOL tpath = FALSE; /* -tpath print path only */
BOOL cflag = FALSE; /* -c has been specified */
BOOL uflag = FALSE; /* -u has been specified */
@@ -286,7 +287,7 @@
* werden wird bei Falschschreibung von -fifo evt. eine Datei angelegt wird.
*/
/* BEGIN CSTYLED */
-char _opts[] = "C*,help,xhelp,version,debug,xdebug#,xd#,bsdchdir,pax-ls,level#,tardumps*,wtardumps,time,no_statistics,no-statistics,fifostats,numeric,v+,block-number,tpath,c,u,r,x,t,copy,n,diff,diffopts&,H&,artype&,print-artype,fs-name*,force_hole,force-hole,sparse,to_stdout,to-stdout,wready,force_remove,force-remove,ask_remove,ask-remove,remove_first,remove-first,remove_recursive,remove-recursive,nullout,onull,fifo,no_fifo,no-fifo,shm,fs&,VOLHDR*,list*,multivol,new-volume-script*,force-local,restore,force-restore,file&,f&,T,Z,z,bz,j,compress-program*,bs&,blocks&,b&,B,pattern&,pat&,i,d,m,o,nochown,pax-p&,a,atime,p,no-p,dirmode,l,h,L,pax-L,pax-H,D,dodesc,M,xdev,I,w,pax-i,O,signed_checksum,signed-checksum,P,S,F+,U,xdir,xdot,k,keep_old_files,keep-old-files,refresh_old_files,refresh-old-files,refresh,/,..,secure-links,no-dirslash,not,V,match-tree,pax-match,pax-n,pax-c,notarg,maxsize&,newer*,ctime,nodump,tsize&,qic24,qic120,qic150,qic250,qic525,nowarn,newest_file,newest-file,newest,hpdev,modebits,copylinks,copyhardlinks,copysymlinks,copydlinks,hardlinks,symlinks,acl,xattr,xattr-linux,xfflags,link-dirs,dumpdate*,dump,cumulative,dump-cumulative,meta,dumpmeta,silent,lowmem,no-xheader,no-fsync,errctl*,prinodes,s&,?";
+char _opts[] = "C*,help,xhelp,version,debug,xdebug#,xd#,bsdchdir,pax-ls,level#,tardumps*,wtardumps,time,no_statistics,no-statistics,fifostats,numeric,v+,block-number,tpath,c,u,r,x,t,copy,n,diff,diffopts&,H&,artype&,print-artype,fs-name*,force_hole,force-hole,sparse,to_stdout,to-stdout,wready,force_remove,force-remove,ask_remove,ask-remove,remove_first,remove-first,remove_recursive,remove-recursive,nullout,onull,fifo,no_fifo,no-fifo,shm,fs&,VOLHDR*,list*,multivol,new-volume-script*,force-local,restore,force-restore,file&,f&,T,Z,z,bz,j,compress-program*,bs&,blocks&,b&,B,pattern&,pat&,i,d,m,o,nochown,pax-p&,a,atime,p,no-p,dirmode,l,h,L,pax-L,pax-H,D,dodesc,M,xdev,I,w,pax-i,O,signed_checksum,signed-checksum,P,S,F+,U,xdir,xdot,k,keep_old_files,keep-old-files,refresh_old_files,refresh-old-files,refresh,/,..,secure-links,no-dirslash,not,V,match-tree,pax-match,pax-n,pax-c,notarg,maxsize&,newer*,ctime,nodump,tsize&,qic24,qic120,qic150,qic250,qic525,nowarn,newest_file,newest-file,newest,hpdev,modebits,copylinks,copyhardlinks,copysymlinks,copydlinks,hardlinks,symlinks,acl,xattr,xattr-linux,xfflags,link-dirs,dumpdate*,dump,cumulative,dump-cumulative,meta,dumpmeta,silent,lowmem,no-xheader,no-fsync,null,errctl*,prinodes,s&,?";
/* END CSTYLED */
char *opts = _opts;
#else
@@ -1008,6 +1009,7 @@
error("\t-qic525\t\tset tape volume size to %d kBytes\n",
TSIZE(QIC_525_TSIZE)/1024);
error("\t-no-fsync\tdo not call fsync() for each extracted file (may be dangerous)\n");
+ error("\t-null\texpect list= to be null terminated)\n");
error("\t-nowarn\t\tdo not print warning messages\n");
error("\t-time\t\tprint timing info\n");
error("\t-no-statistics\tdo not print statistics\n");
@@ -1265,7 +1267,7 @@
&dd_name,
&dodump, &dump_cumulative, &dump_cumulative,
&dometa, &dumpmeta,
- &silent, &lowmem, &no_xheader, &no_fsync, &errctlfile,
+ &silent, &lowmem, &no_xheader, &no_fsync, &null, &errctlfile,
&prinodes,
parsesubst, &do_subst, &archive) < 0) {
errmsgno(EX_BAD, "Bad Option: %s.\n", av[0]);
diff -ur star-1.5/star/starsubs.h star-1.5bj/star/starsubs.h
--- star-1.5/star/starsubs.h 2005-05-22 14:21:30.000000000 +0200
+++ star-1.5bj/star/starsubs.h 2005-06-24 02:58:50.696191066 +0200
@@ -146,6 +146,7 @@
extern void sym_addstat __PR((FINFO *info, imap_t *imp));
extern imap_t *sym_dirprepare __PR((FINFO *info, imap_t *idir));
extern imap_t *sym_typecheck __PR((FINFO *info, FINFO *cinfo, imap_t *imp));
+extern int ngetline __PR((FILE *f, char *buf, int len));
#endif
#endif
extern void sym_open __PR((char *name));
Only in star-1.5bj/star_sym: OBJ
diff -ur star-1.5/star_sym/restore.c star-1.5bj/star_sym/restore.c
--- star-1.5/star_sym/restore.c 2005-05-09 23:38:10.000000000 +0200
+++ star-1.5bj/star_sym/restore.c 2005-06-24 02:28:10.743220884 +0200
@@ -119,7 +119,7 @@
LOCAL void purgeent __PR((imap_t *imp));
LOCAL void purgetree __PR((imap_t *imp));
EXPORT void sym_init __PR((GINFO *gp));
-LOCAL int ngetline __PR((FILE *f, char *buf, int len));
+EXPORT int ngetline __PR((FILE *f, char *buf, int len));
EXPORT void sym_close __PR((void));
LOCAL void sym_dump __PR((void));
LOCAL void writeheader __PR((FILE *f));
@@ -1526,7 +1526,7 @@
/*
* A special version of fgetline() that does not stop on '\n' but only on '\0'.
*/
-LOCAL int
+EXPORT int
ngetline(f, buf, len)
register FILE *f;
char *buf;
diff -ur star-1.5/star_sym/starsubs.h star-1.5bj/star_sym/starsubs.h
--- star-1.5/star_sym/starsubs.h 2005-05-22 14:21:30.000000000 +0200
+++ star-1.5bj/star_sym/starsubs.h 2005-06-24 02:58:50.696191066 +0200
@@ -146,6 +146,7 @@
extern void sym_addstat __PR((FINFO *info, imap_t *imp));
extern imap_t *sym_dirprepare __PR((FINFO *info, imap_t *idir));
extern imap_t *sym_typecheck __PR((FINFO *info, FINFO *cinfo, imap_t *imp));
+extern int ngetline __PR((FILE *f, char *buf, int len));
#endif
#endif
extern void sym_open __PR((char *name));
Only in star-1.5bj/tartest: OBJ
--- star-1.5/STARvsGNUTAR 2002-05-03 14:43:29.000000000 +0200
+++ star-1.5bj/STARvsGNUTAR 2005-06-24 03:23:01.002071814 +0200
@@ -247,6 +247,7 @@
-remove-first remove files before extraction --unlink-first
-remove-recursive remove files recursive --recursive-unlink not yet ready in star
-onull,-nullout simulate creating an achive to compute the size -f/dev/null in GNUtar worse than star (cannot do performance tests)
+-null list= reads null-terminated names --null
/*--------------------------------------------------------------------------*/
Gnu tar options that (in the single char variant) are incompatible:
@@ -317,7 +318,6 @@
--use-compress-program=PROG filter through PROG (must accept -d) not needed (rarely used)
Local file selection:
- --null -T reads null-terminated names, disable -C ???
-X, --exclude-from=FILE exclude globbing patterns listed in FILE --nice to have--
-K, --starting-file=NAME begin at file NAME in the archive --nice to have--
--backup[=CONTROL] backup before removal, choose version control not needed