%!PS-Adobe-3.0 %%Creator: groff version 1.19.2 %%CreationDate: Wed Jun 30 11:55:52 2010 %%DocumentNeededResources: font Times-Roman %%DocumentSuppliedResources: procset grops 1.19 2 %%Pages: 107 %%PageOrder: Ascend %%DocumentMedia: Default 612 792 0 () () %%Orientation: Portrait %%EndComments %%BeginDefaults %%PageMedia: Default %%EndDefaults %%BeginProlog %%BeginResource: procset grops 1.19 2 %!PS-Adobe-3.0 Resource-ProcSet /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /MANUAL{ statusdict begin/manualfeed true store end }bind def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /Fr{ setrgbcolor fill }bind def /setcmykcolor where{ pop /Fk{ setcmykcolor fill }bind def }if /Fg{ setgray fill }bind def /FL/fill load def /LW/setlinewidth load def /Cr/setrgbcolor load def /setcmykcolor where{ pop /Ck/setcmykcolor load def }if /Cg/setgray load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit []0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{}def /setpagedevice{}def }bind def /PEND{ countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%EndProlog %%BeginSetup %%BeginFeature: *PageSize Default << /PageSize [ 612 792 ] /ImagingBBox null >> setpagedevice %%EndFeature %%IncludeResource: font Times-Roman grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron /scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent /ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen /period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O /P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex /underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y /z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft /guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl /endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen /brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft /logicalnot/minus/registered/macron/degree/plusminus/twosuperior /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior /ordmasculine/guilsinglright/onequarter/onehalf/threequarters /questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex /Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn /germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash /ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def /Times-Roman@0 ENC0/Times-Roman RE %%EndSetup %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF()0 12 Q()0 24 Q()36 36 Q (May 11, 2008 archi)74.5 48 Q -.15(ve)-.25 G(_write 3).15 E()36 72 Q 0 Cg EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF()36 48 Q()0 60 Q ()-.15 E 0 Cg EP %%Page: 4 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)-.35 E -.35(NA)36 24 S (ME).35 E(

)36 36 Q(archi)0 48 Q -.15(ve)-.25 G(_write_ne).15 E (w,)-.25 E(archi)0 60 Q -.15(ve)-.25 G (_write_set_format_cpio,).15 E(archi)0 72 Q -.15(ve)-.25 G (_write_set_format_pax,).15 E 0 Cg EP %%Page: 5 5 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_format_pax_restricted,).15 E(archi)0 24 Q -.15(ve) -.25 G(_write_set_format_shar,).15 E(archi)0 36 Q -.15(ve)-.25 G (_write_set_format_shar_binary,).15 E(archi)0 48 Q -.15(ve)-.25 G (_write_set_format_ustar,).15 E(archi)0 60 Q -.15(ve)-.25 G (_write_get_bytes_per_block,).15 E(archi)0 72 Q -.15(ve)-.25 G (_write_set_bytes_per_block,).15 E 0 Cg EP %%Page: 6 6 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_bytes_in_last_block,).15 E(archi)0 24 Q -.15(ve)-.25 G(_write_set_compression_bzip2,).15 E(archi)0 36 Q -.15(ve)-.25 G (_write_set_compression_compress,).15 E(archi)0 48 Q -.15(ve)-.25 G(_write_set_compression_gzip,).15 E(archi)0 60 Q -.15(ve)-.25 G (_write_set_compression_none,).15 E(archi)0 72 Q -.15(ve)-.25 G (_write_set_compression_program,).15 E 0 Cg EP %%Page: 7 7 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_compressor_options,).15 E(archi)0 24 Q -.15(ve)-.25 G (_write_set_format_options,).15 E(archi)0 36 Q -.15(ve)-.25 G (_write_set_options,).15 E(archi)0 48 Q -.15(ve)-.25 G (_write_open,).15 E(archi)0 60 Q -.15(ve)-.25 G (_write_open_fd,).15 E(archi)0 72 Q -.15(ve)-.25 G (_write_open_FILE,).15 E 0 Cg EP %%Page: 8 8 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_open_\214lename,).15 E(archi)0 24 Q -.15(ve)-.25 G (_write_open_memory,).15 E(archi)0 36 Q -.15(ve)-.25 G (_write_header,).15 E(archi)0 48 Q -.15(ve)-.25 G (_write_data,).15 E(archi)0 60 Q -.15(ve)-.25 G (_write_\214nish_entry,).15 E(archi)0 72 Q -.15(ve)-.25 G (_write_close,).15 E 0 Cg EP %%Page: 9 9 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_\214nish).15 E 2.5(-f)0 24 S(unctions for creating archi) -2.5 E -.15(ve)-.25 G(s).15 E(

)36 36 Q(SYNOPSIS)36 48 Q(

)36 60 Q(

struct archi)0 72 Q -.15(ve)-.25 G( *).15 E 0 Cg EP %%Page: 10 10 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G(_write_ne).15 E (w\(v)-.25 E(oid\))-.2 E (

int)0 24 Q(archi)0 36 Q -.15(ve) -.25 G(_write_get_bytes_per_block\(struct archi) .15 E .3 -.15(ve *)-.25 H(\)).15 E (

int)0 48 Q(archi)0 60 Q -.15(ve) -.25 G(_write_set_bytes_per_block\(struct archi) .15 E .3 -.15(ve *)-.25 H(, int bytes_per_block\)) .15 E(

int)0 72 Q 0 Cg EP %%Page: 11 11 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_bytes_in_last_block\(struct archi).15 E .3 -.15(ve *)-.25 H(, int\)).15 E (

int)0 24 Q(archi)0 36 Q -.15(ve) -.25 G (_write_set_compression_bzip2\(struct archi).15 E .3 -.15(ve *)-.25 H(\)).15 E (

int)0 48 Q(archi)0 60 Q -.15(ve) -.25 G (_write_set_compression_compress\(struct archi) .15 E .3 -.15(ve *)-.25 H(\)).15 E (

int)0 72 Q 0 Cg EP %%Page: 12 12 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_compression_gzip\(struct archi).15 E .3 -.15(ve *)-.25 H(\)).15 E (

int)0 24 Q(archi)0 36 Q -.15(ve) -.25 G(_write_set_compression_none\(struct archi) .15 E .3 -.15(ve *)-.25 H(\)).15 E (

int)0 48 Q(archi)0 60 Q -.15(ve) -.25 G (_write_set_compression_program\(struct archi).15 E .3 -.15(ve *)-.25 H(, const char * cmd\)).15 E (

int)0 72 Q 0 Cg EP %%Page: 13 13 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_format_cpio\(struct archi).15 E .3 -.15(ve *)-.25 H(\)).15 E(

int)0 24 Q(archi)0 36 Q -.15(ve)-.25 G (_write_set_format_pax\(struct archi).15 E .3 -.15(ve *)-.25 H(\)).15 E(

int)0 48 Q(archi)0 60 Q -.15(ve)-.25 G (_write_set_format_pax_restricted\(struct archi) .15 E .3 -.15(ve *)-.25 H(\)).15 E (

int)0 72 Q 0 Cg EP %%Page: 14 14 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_format_shar\(struct archi).15 E .3 -.15(ve *)-.25 H(\)).15 E(

int)0 24 Q(archi)0 36 Q -.15(ve)-.25 G (_write_set_format_shar_binary\(struct archi).15 E .3 -.15(ve *)-.25 H(\)).15 E (

int)0 48 Q(archi)0 60 Q -.15(ve) -.25 G(_write_set_format_ustar\(struct archi).15 E .3 -.15(ve *)-.25 H(\)).15 E (

int)0 72 Q 0 Cg EP %%Page: 15 15 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_format_options\(struct archi).15 E .3 -.15(ve *)-.25 H(, const char *\)).15 E (

int)0 24 Q(archi)0 36 Q -.15(ve) -.25 G (_write_set_compressor_options\(struct archi).15 E .3 -.15(ve *)-.25 H(, const char *\)).15 E (

int)0 48 Q(archi)0 60 Q -.15(ve) -.25 G(_write_set_options\(struct archi).15 E .3 -.15(ve *)-.25 H(, const char *\)).15 E (

int)0 72 Q 0 Cg EP %%Page: 16 16 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_open\().15 E(struct archi)0 24 Q .3 -.15(ve *)-.25 H().15 E(v)0 36 Q (oid *client_data)-.2 E(archi)0 48 Q -.15(ve) -.25 G(_open_callback *).15 E(archi)0 60 Q -.15(ve)-.25 G(_write_callback *).15 E(archi)0 72 Q -.15(ve)-.25 G(_close_callback *).15 E 0 Cg EP %%Page: 17 17 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(\))0 12 Q(

int) 0 24 Q(archi)0 36 Q -.15(ve)-.25 G (_write_open_fd\(struct archi).15 E .3 -.15(ve *) -.25 H(, int fd\)).15 E (

int)0 48 Q(archi)0 60 Q -.15(ve) -.25 G(_write_open_FILE\(struct archi).15 E .3 -.15(ve *)-.25 H(, FILE *\214le\)).15 E (

int)0 72 Q 0 Cg EP %%Page: 18 18 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_open_\214lename\(struct archi).15 E .3 -.15(ve *)-.25 H(, const char *\214lename\)).15 E (

int)0 24 Q(archi)0 36 Q -.15(ve) -.25 G(_write_open_memory\().15 E (struct archi)0 48 Q .3 -.15(ve *)-.25 H().15 E(v)0 60 Q(oid *b)-.2 E(uf)-.2 E(fer)-.25 E (size_t b)0 72 Q(uf)-.2 E(ferSize)-.25 E 0 Cg EP %%Page: 19 19 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(size_t *outUsed)0 12 Q (\))0 24 Q(

int)0 36 Q(archi)0 48 Q -.15(ve)-.25 G(_write_header\(struct archi).15 E .3 -.15(ve *)-.25 H(, struct archi).15 E -.15(ve)-.25 G (_entry *\)).15 E(

ssize_t)0 60 Q(archi)0 72 Q -.15(ve)-.25 G (_write_data\(struct archi).15 E .3 -.15(ve *) -.25 H(, const v).15 E(oid *, size_t\)) -.2 E 0 Cg EP %%Page: 20 20 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

int)0 12 Q (archi)0 24 Q -.15(ve)-.25 G (_write_\214nish_entry\(struct archi).15 E .3 -.15(ve *)-.25 H(\)).15 E(

int)0 36 Q(archi)0 48 Q -.15(ve)-.25 G (_write_close\(struct archi).15 E .3 -.15(ve *) -.25 H(\)).15 E(

int)0 60 Q (archi)0 72 Q -.15(ve)-.25 G (_write_\214nish\(struct archi).15 E .3 -.15 (ve *)-.25 H(\)).15 E 0 Cg EP %%Page: 21 21 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)36 12 Q(DESCRIPTION)36 24 Q(

)36 36 Q(These functions pro)0 48 Q (vide a complete API for creating streaming)-.15 E(archi)0 60 Q .3 -.15 (ve \214)-.25 H(les.).15 E(The general process is to \214rst create the) 0 72 Q 0 Cg EP %%Page: 22 22 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(struct archi)0 12 Q -.15(ve)-.25 G().15 E (object, set an)0 24 Q 2.5(yd)-.15 G (esired options, initialize the archi)-2.5 E -.15(ve)-.25 G 2.5(,a).15 G (ppend entries, then)-2.5 E(close the archi)0 36 Q .3 -.15(ve a)-.25 H (nd release all resources.).15 E(The follo)0 48 Q (wing summary describes the functions in approximately)-.25 E (the order the)0 60 Q 2.5(ya)-.15 G(re ordinarily used:)-2.5 E (
)0 72 Q 0 Cg EP %%Page: 23 23 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

archi)0 12 Q -.15(ve)-.25 G(_write_ne) .15 E(w\(\)
)-.25 E(Allocates and initializes a)0 24 Q(struct \ archi)0 36 Q -.15(ve)-.25 G().15 E (object suitable for writing a tar archi)0 48 Q -.15(ve)-.25 G(.).15 E (

archi)0 60 Q -.15(ve)-.25 G (_write_set_bytes_per_block\(\)
).15 E (Sets the block size used for writing the archi)0 72 Q .3 -.15(ve d)-.25 H(ata.).15 E 0 Cg EP %%Page: 24 24 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Ev)0 12 Q (ery call to the write callback function, e)-.15 E (xcept possibly the last one, will)-.15 E(use this v)0 24 Q (alue for the length.)-.25 E(The third parameter is a boolean that spec\ i\214es whether or not the \214nal block)0 36 Q (written will be padded to the full block size.)0 48 Q (If it is zero, the last block will not be padded.)0 60 Q(If it is non-\ zero, padding will be added both before and after compression.)0 72 Q 0 Cg EP %%Page: 25 25 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(The def)0 12 Q (ault is to use a block size of 10240 bytes and to pad the last block.) -.1 E(Note that a block size of zero will suppress internal blocking)0 24 Q(and cause writes to be sent directly to the write callback as the)0 36 Q 2.5(yo)-.15 G(ccur)-2.5 E(.)-.55 E(

archi)0 48 Q -.15(ve) -.25 G(_write_get_bytes_per_block\(\)
).15 E(Retrie) 0 60 Q .3 -.15(ve t)-.25 H(he block size to be used for writing.).15 E 2.5(Av)0 72 S(alue of -1 here indicates that the library should use def) -2.75 E(ault v)-.1 E(alues.)-.25 E 0 Cg EP %%Page: 26 26 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 2.5(Av)0 12 S (alue of zero indicates that internal blocking is suppressed.)-2.75 E (

archi)0 24 Q -.15(ve)-.25 G (_write_set_bytes_in_last_block\(\)
).15 E (Sets the block size used for writing the last block.)0 36 Q(If this v)0 48 Q(alue is zero, the last block will be padded to the same size)-.25 E (as the other blocks.)0 60 Q(Otherwise, the \214nal block will be padde\ d to a multiple of this size.)0 72 Q 0 Cg EP %%Page: 27 27 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(In particular)0 12 Q 2.5(,s)-.4 G (etting it to 1 will cause the \214nal block to not be padded.)-2.5 E -.15(Fo)0 24 S 2.5(rc).15 G(ompressed output, an)-2.5 E 2.5(yp)-.15 G (adding generated by this option)-2.5 E (is applied only after the compression.)0 36 Q (The uncompressed data is al)0 48 Q -.1(wa)-.1 G(ys unpadded.).1 E (The def)0 60 Q (ault is to pad the last block to the full block size \(note that)-.1 E (archi)0 72 Q -.15(ve)-.25 G (_write_open_\214lename\(\)).15 E 0 Cg EP %%Page: 28 28 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(will set this based on the \214le type\).)0 12 Q (Unlik)0 24 Q 2.5(et)-.1 G(he other)-2.5 E -.74(``)0 36 S(set').74 E(') -.74 E(functions, this function can be called after the archi)0 48 Q .3 -.15(ve i)-.25 H 2.5(so).15 G(pened.)-2.5 E(

archi)0 60 Q -.15 (ve)-.25 G(_write_get_bytes_in_last_block\(\)
).15 E (Retrie)0 72 Q .3 -.15(ve t)-.25 H(he currently-set v).15 E (alue for last block size.)-.25 E 0 Cg EP %%Page: 29 29 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 2.5(Av)0 12 S (alue of -1 here indicates that the library should use def)-2.75 E (ault v)-.1 E(alues.)-.25 E(

Xo
)0 24 Q(archi)0 36 Q -.15 (ve)-.25 G(_write_set_format_cpio\(\),).15 E(archi)0 48 Q -.15(ve)-.25 G(_write_set_format_pax\(\),).15 E (archi)0 60 Q -.15(ve)-.25 G (_write_set_format_pax_restricted\(\),).15 E(archi)0 72 Q -.15(ve)-.25 G(_write_set_format_shar\(\),).15 E 0 Cg EP %%Page: 30 30 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_format_shar_binary\(\),).15 E(archi)0 24 Q -.15(ve)-.25 G(_write_set_format_ustar\(\)).15 E (Sets the format that will be used for the archi)0 36 Q -.15(ve)-.25 G (.).15 E(The library can write)0 48 Q (POSIX octet-oriented cpio format archi)0 60 Q -.15(ve)-.25 G(s,).15 E (POSIX-standard)0 72 Q 0 Cg EP %%Page: 31 31 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF -.74(``)0 12 S(pax interchange').74 E(')-.74 E (format archi)0 24 Q -.15(ve)-.25 G(s,).15 E(traditional)0 36 Q -.74(``) 0 48 S(shar').74 E(')-.74 E(archi)0 60 Q -.15(ve)-.25 G(s,).15 E (enhanced)0 72 Q 0 Cg EP %%Page: 32 32 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF -.74(``)0 12 S(binary').74 E(')-.74 E (shar archi)0 24 Q -.15(ve)-.25 G 2.5(st).15 G(hat store a v)-2.5 E (ariety of \214le attrib)-.25 E(utes and handle binary \214les,)-.2 E (and)0 36 Q(POSIX-standard)0 48 Q -.74(``)0 60 S(ustar').74 E(')-.74 E (archi)0 72 Q -.15(ve)-.25 G(s.).15 E 0 Cg EP %%Page: 33 33 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(The pax interchange format is a backw)0 12 Q (ards-compatible tar format that)-.1 E(adds k)0 24 Q -.15(ey)-.1 G(/v) .15 E(alue attrib)-.25 E(utes to each entry and supports arbitrary)-.2 E (\214lenames, linknames, uids, sizes, etc.)0 36 Q -.74(``)0 48 S (Restricted pax interchange format').74 E(')-.74 E(is the library def)0 60 Q(ault; this is the same as pax format, b)-.1 E(ut suppresses)-.2 E (the pax e)0 72 Q(xtended header for most normal \214les.)-.15 E 0 Cg EP %%Page: 34 34 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF (In most cases, this will result in ordinary ustar archi)0 12 Q -.15(ve) -.25 G(s.).15 E(

Xo
)0 24 Q(archi)0 36 Q -.15(ve)-.25 G (_write_set_compression_bzip2\(\),).15 E(archi)0 48 Q -.15(ve)-.25 G(_write_set_compression_compress\(\),) .15 E(archi)0 60 Q -.15(ve)-.25 G (_write_set_compression_gzip\(\),).15 E(archi)0 72 Q -.15(ve)-.25 G(_write_set_compression_none\(\)).15 E 0 Cg EP %%Page: 35 35 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(The resulting archi)0 12 Q .3 -.15(ve w)-.25 H (ill be compressed as speci\214ed.).15 E (Note that the compressed output is al)0 24 Q -.1(wa)-.1 G (ys properly block).1 E(ed.)-.1 E(

archi)0 36 Q -.15(ve)-.25 G (_write_set_compression_program\(\)
).15 E (The archi)0 48 Q .3 -.15(ve w)-.25 H (ill be fed into the speci\214ed compression program.).15 E (The output of that program is block)0 60 Q (ed and written to the client)-.1 E(write callbacks.)0 72 Q 0 Cg EP %%Page: 36 36 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

Xo
)0 12 Q(archi)0 24 Q -.15(ve) -.25 G(_write_set_compressor_options\(\),).15 E (archi)0 36 Q -.15(ve)-.25 G (_write_set_format_options\(\),).15 E(archi)0 48 Q -.15(ve)-.25 G(_write_set_options\(\)).15 E (Speci\214es options that will be passed to the currently-enabled)0 60 Q (compressor and/or format writer)0 72 Q(.)-.55 E 0 Cg EP %%Page: 37 37 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(The ar)0 12 Q (gument is a comma-separated list of indi)-.18 E(vidual options.)-.25 E (Indi)0 24 Q(vidual options ha)-.25 E .3 -.15(ve o)-.2 H (ne of the follo).15 E(wing forms:)-.25 E(
)0 36 Q (
option=v)0 48 Q(alue
)-.25 E(The option/v)0 60 Q (alue pair will be pro)-.25 E(vided to e)-.15 E -.15(ve)-.25 G (ry module.).15 E (Modules that do not accept an option with this name will ignore it.)0 72 Q 0 Cg EP %%Page: 38 38 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(
option
)0 12 Q (The option will be pro)0 24 Q(vided to e)-.15 E -.15(ve)-.25 G (ry module with a v).15 E(alue of)-.25 E -.74(``)0 36 S(1').74 E('.)-.74 E(
!option
)0 48 Q(The option will be pro)0 60 Q (vided to e)-.15 E -.15(ve)-.25 G(ry module with a NULL v).15 E(alue.) -.25 E(
module:option=v)0 72 Q(alue, module:\ option, module:!option
)-.25 E 0 Cg EP %%Page: 39 39 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(As abo)0 12 Q -.15(ve)-.15 G 2.5(,b).15 G (ut the corresponding option and v)-2.7 E(alue will be pro)-.25 E(vided) -.15 E(only to modules whose name matches)0 24 Q(module.)0 36 Q(
)0 48 Q(The return v)0 60 Q(alue will be)-.25 E (ARCHIVE_OK)0 72 Q 0 Cg EP %%Page: 40 40 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(if an)0 12 Q 2.5(ym)-.15 G (odule accepts the option, or)-2.5 E(ARCHIVE_W)0 24 Q(ARN) -1.2 E(if no module accepted the option, or)0 36 Q(ARCHIVE_F)0 48 Q -1.21 -1.11(AT A)-.74 H(L)1.11 E(if there w)0 60 Q(as a f)-.1 E (atal error while attempting to process the option.)-.1 E(

)36 72 Q 0 Cg EP %%Page: 41 41 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(The currently supported options are:)0 12 Q (

)0 24 Q(
Compressor gzip
)0 36 Q(
)0 48 Q (
compression-le)0 60 Q -.15(ve)-.25 G(l
).15 E (The v)0 72 Q(alue is interpreted as a decimal inte)-.25 E (ger specifying the)-.15 E 0 Cg EP %%Page: 42 42 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(gzip compression le)0 12 Q -.15(ve)-.25 G(l.).15 E(
)0 24 Q(
Compressor xz
)0 36 Q(
)0 48 Q (
compression-le)0 60 Q -.15(ve)-.25 G(l
).15 E (The v)0 72 Q(alue is interpreted as a decimal inte)-.25 E (ger specifying the)-.15 E 0 Cg EP %%Page: 43 43 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(compression le)0 12 Q -.15(ve)-.25 G(l.).15 E (
)0 24 Q(
F)0 36 Q(ormat mtree
)-.15 E(
)0 48 Q (
cksum, de)0 60 Q(vice, \215a\ gs, gid, gname, indent\ , link, md5, mode, nli\ nk, rmd160, sha1, sha256<\ b>, sha384)-.25 E(, sha512, size\ , time, uid, uname
)A (Enable a particular k)0 72 Q -.15(ey)-.1 G -.1(wo).15 G (rd in the mtree output.).1 E 0 Cg EP %%Page: 44 44 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Pre\214x with an e)0 12 Q (xclamation mark to disable the corresponding k)-.15 E -.15(ey)-.1 G -.1 (wo).15 G(rd.).1 E(The def)0 24 Q(ault is equi)-.1 E -.25(va)-.25 G (lent to).25 E -.74(``)0 36 S(de).74 E(vice, \215ags, gid, gname, link,\ mode, nlink, size, time, type, uid, uname')-.25 E('.)-.74 E (
all
)0 48 Q(Enables all of the abo)0 60 Q .3 -.15 (ve k)-.15 H -.15(ey).05 G -.1(wo).15 G(rds.).1 E (
use-set
)0 72 Q 0 Cg EP %%Page: 45 45 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Enables generation of)0 12 Q(/set) 0 24 Q(lines that specify def)0 36 Q(ault v)-.1 E(alues for the follo) -.25 E(wing \214les and/or directories.)-.25 E (
indent
)0 48 Q(XXX needs e)0 60 Q(xplanation XXX) -.15 E(
)0 72 Q 0 Cg EP %%Page: 46 46 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(
)0 12 Q(

archi)0 24 Q -.15(ve)-.25 G(_write_open\(\)
).15 E (Freeze the settings, open the archi)0 36 Q -.15(ve)-.25 G 2.5(,a).15 G (nd prepare for writing entries.)-2.5 E (This is the most generic form of this function, which accepts)0 48 Q (pointers to three callback functions which will be in)0 60 Q -.2(vo)-.4 G -.1(ke).2 G 2.5(db).1 G(y)-2.5 E (the compression layer to write the constructed archi)0 72 Q -.15(ve) -.25 G(.).15 E 0 Cg EP %%Page: 47 47 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

archi)0 12 Q -.15(ve)-.25 G (_write_open_fd\(\)
).15 E 2.5(Ac)0 24 S(on)-2.5 E -.15(ve)-.4 G(nience form of).15 E(archi)0 36 Q -.15(ve)-.25 G (_write_open\(\)).15 E (that accepts a \214le descriptor)0 48 Q(.)-.55 E(The)0 60 Q(archi)0 72 Q -.15(ve)-.25 G(_write_open_fd\(\)).15 E 0 Cg EP %%Page: 48 48 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(function is safe for use with tape dri)0 12 Q -.15(ve)-.25 G 2.5(so).15 G 2.5(ro)-2.5 G(ther)-2.5 E(block-oriented de) 0 24 Q(vices.)-.25 E(

archi)0 36 Q -.15(ve)-.25 G (_write_open_FILE\(\)
).15 E 2.5(Ac)0 48 S(on)-2.5 E -.15(ve)-.4 G(nience form of).15 E(archi)0 60 Q -.15(ve)-.25 G (_write_open\(\)).15 E(that accepts a)0 72 Q 0 Cg EP %%Page: 49 49 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

FILE *)0 12 Q (pointer)0 24 Q(.)-.55 E(Note that)0 36 Q(archi)0 48 Q -.15(ve)-.25 G (_write_open_FILE\(\)).15 E (is not safe for writing to tape dri)0 60 Q -.15(ve)-.25 G 2.5(so).15 G 2.5(ro)-2.5 G(ther de)-2.5 E(vices)-.25 E (that require correct blocking.)0 72 Q 0 Cg EP %%Page: 50 50 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

archi)0 12 Q -.15(ve)-.25 G (_write_open_\214le\(\)
).15 E 2.5(Ad)0 24 S (eprecated synon)-2.5 E(ym for)-.15 E(archi)0 36 Q -.15(ve)-.25 G (_write_open_\214lename\(\).).15 E(

archi)0 48 Q -.15(ve)-.25 G(_write_open_\214lename\(\)
).15 E 2.5(Ac)0 60 S(on)-2.5 E -.15(ve)-.4 G(nience form of).15 E(archi)0 72 Q -.15(ve)-.25 G(_write_open\(\)).15 E 0 Cg EP %%Page: 51 51 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(that accepts a \214lename.)0 12 Q 2.5(AN)0 24 S (ULL ar)-2.5 E (gument indicates that the output should be written to standard output;) -.18 E(an ar)0 36 Q(gument of)-.18 E -.74(``)0 48 S(-').74 E(')-.74 E (will open a \214le with that name.)0 60 Q(If you ha)0 72 Q .3 -.15 (ve n)-.2 H(ot in).15 E -.2(vo)-.4 G -.1(ke).2 G(d).1 E 0 Cg EP %%Page: 52 52 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_set_bytes_in_last_block\(\),).15 E(then)0 24 Q (archi)0 36 Q -.15(ve)-.25 G (_write_open_\214lename\(\)).15 E (will adjust the last-block padding depending on the \214le:)0 48 Q (it will enable padding when writing to standard output or)0 60 Q (to a character or block de)0 72 Q (vice node, it will disable padding otherwise.)-.25 E 0 Cg EP %%Page: 53 53 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF -1.1(Yo)0 12 S 2.5(uc)1.1 G(an o)-2.5 E -.15(ve) -.15 G(rride this by manually in).15 E -.2(vo)-.4 G(king).2 E(archi)0 24 Q -.15(ve)-.25 G(_write_set_bytes_in_last_block\(\)) .15 E(before calling)0 36 Q(archi)0 48 Q -.15(ve)-.25 G (_write_open\(\).).15 E(The)0 60 Q(archi)0 72 Q -.15 (ve)-.25 G(_write_open_\214lename\(\)).15 E 0 Cg EP %%Page: 54 54 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(function is safe for use with tape dri)0 12 Q -.15(ve)-.25 G 2.5(so).15 G 2.5(ro)-2.5 G(ther)-2.5 E(block-oriented de) 0 24 Q(vices.)-.25 E(

archi)0 36 Q -.15(ve)-.25 G (_write_open_memory\(\)
).15 E 2.5(Ac)0 48 S(on)-2.5 E -.15(ve)-.4 G(nience form of).15 E(archi)0 60 Q -.15(ve)-.25 G (_write_open\(\)).15 E (that accepts a pointer to a block of memory that will recei)0 72 Q -.15 (ve)-.25 G 0 Cg EP %%Page: 55 55 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(the archi)0 12 Q -.15(ve)-.25 G(.).15 E (The \214nal)0 24 Q(

size_t *)0 36 Q (ar)0 48 Q(gument points to a v)-.18 E(ariable that will be updated)-.25 E(after each write to re\215ect ho)0 60 Q 2.5(wm)-.25 G(uch of the b) -2.5 E(uf)-.2 E(fer)-.25 E(is currently in use.)0 72 Q 0 Cg EP %%Page: 56 56 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF -1.1(Yo)0 12 S 2.5(us)1.1 G (hould be careful to ensure that this v)-2.5 E(ariable)-.25 E (remains allocated until after the archi)0 24 Q .3 -.15(ve i)-.25 H(s) .15 E(closed.)0 36 Q(

archi)0 48 Q -.15(ve)-.25 G (_write_header\(\)
).15 E (Build and write a header using the data in the pro)0 60 Q(vided)-.15 E (struct a\ rchi)0 72 Q -.15(ve)-.25 G(_entry).15 E 0 Cg EP %%Page: 57 57 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(structure.)0 12 Q(See)0 24 Q (archi)-.65 E -.15(ve)-.25 G(_entry\(3\)).15 E (for information on creating and populating)0 48 Q(struct archi)0 60 Q -.15(ve) -.25 G(_entry).15 E(objects.)0 72 Q 0 Cg EP %%Page: 58 58 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

archi)0 12 Q -.15(ve)-.25 G (_write_data\(\)
).15 E (Write data corresponding to the header just written.)0 24 Q (Returns number of bytes written or -1 on error)0 36 Q(.)-.55 E (

archi)0 48 Q -.15(ve)-.25 G (_write_\214nish_entry\(\)
).15 E (Close out the entry just written.)0 60 Q(In particular)0 72 Q 2.5(,t) -.4 G(his writes out the \214nal padding required by some formats.)-2.5 E 0 Cg EP %%Page: 59 59 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Ordinarily)0 12 Q 2.5(,c)-.65 G(lients ne)-2.5 E -.15(ve)-.25 G 2.5(rn).15 G(eed to call this, as it)-2.5 E (is called automatically by)0 24 Q(archi)0 36 Q -.15(ve)-.25 G (_write_ne).15 E(xt_header\(\))-.15 E(and)0 48 Q (archi)0 60 Q -.15(ve)-.25 G(_write_close\(\)).15 E (as needed.)0 72 Q 0 Cg EP %%Page: 60 60 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

archi)0 12 Q -.15(ve)-.25 G (_write_close\(\)
).15 E(Complete the archi)0 24 Q .3 -.15(ve a)-.25 H(nd in).15 E -.2(vo)-.4 G .2 -.1(ke t).2 H (he close callback.).1 E(

archi)0 36 Q -.15(ve)-.25 G (_write_\214nish\(\)
).15 E(In)0 48 Q -.2(vo)-.4 G -.1(ke).2 G(s).1 E(archi)0 60 Q -.15(ve)-.25 G (_write_close\(\)).15 E(if it w)0 72 Q(as not in)-.1 E -.2(vo)-.4 G -.1(ke).2 G 2.5(dm).1 G(anually)-2.5 E 2.5(,t)-.65 G (hen releases all resources.)-2.5 E 0 Cg EP %%Page: 61 61 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Note that this function w)0 12 Q (as declared to return)-.1 E(

v)0 24 Q (oid)-.2 E(in libarchi)0 36 Q .3 -.15(ve 1)-.25 H (.x, which made it impossible to detect errors when).15 E(archi)0 48 Q -.15(ve)-.25 G(_write_close\(\)).15 E -.1(wa)0 60 S 2.5(si).1 G -1.9 -.4(nv o)-2.5 H -.1(ke).4 G 2.5(di).1 G (mplicitly from this function.)-2.5 E(This is corrected be)0 72 Q (ginning with libarchi)-.15 E .3 -.15(ve 2)-.25 H(.0.).15 E 0 Cg EP %%Page: 62 62 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(
)0 12 Q(More information about the)0 24 Q (struct archi)0 36 Q -.15(ve)-.25 G().15 E (object and the o)0 48 Q -.15(ve)-.15 G (rall design of the library can be found in the).15 E (libarchi).15 E -.15(ve)-.25 G(\(3\)).15 E -.15(ove)0 72 S(rvie).15 E -.65(w.)-.25 G 0 Cg EP %%Page: 63 63 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

) 1.11 E(IMPLEMENT)36 24 Q -1.11(AT)-.93 G(ION)1.11 E(

)36 36 Q (Compression support is b)0 48 Q(uilt-in to libarchi)-.2 E -.15(ve)-.25 G 2.5(,w).15 G(hich uses zlib and bzlib)-2.5 E (to handle gzip and bzip2 compression, respecti)0 60 Q -.15(ve)-.25 G (ly).15 E(.)-.65 E(

).4 E 0 Cg EP %%Page: 64 64 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(CLIENT CALLB)36 12 Q -.4(AC)-.35 G(KS).4 E (

)36 24 Q 1.6 -.8(To u)0 36 T(se this library).8 E 2.5(,y)-.65 G (ou will need to de\214ne and re)-2.5 E(gister)-.15 E (callback functions that will be in)0 48 Q -.2(vo)-.4 G -.1(ke).2 G 2.5 (dt).1 G 2.5(ow)-2.5 G(rite data to the)-2.5 E(resulting archi)0 60 Q -.15(ve)-.25 G(.).15 E(These functions are re)0 72 Q (gistered by calling)-.15 E 0 Cg EP %%Page: 65 65 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_open\(\):).15 E(
)0 24 Q(

)0 36 Q (

typedef int)0 48 Q (archi)0 60 Q -.15(ve)-.25 G (_open_callback\(struct archi).15 E .3 -.15(ve *) -.25 H(, v).15 E(oid *client_data\))-.2 E(
)0 72 Q 0 Cg EP %%Page: 66 66 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)36 12 Q(The open callback is in)0 24 Q -.2 (vo)-.4 G -.1(ke).2 G 2.5(db).1 G(y)-2.5 E(archi)0 36 Q -.15(ve)-.25 G(_write_open\(\).).15 E(It should return)0 48 Q (ARCHIVE_OK)0 60 Q (if the underlying \214le or data source is successfully)0 72 Q 0 Cg EP %%Page: 67 67 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(opened.)0 12 Q(If the open f)0 24 Q (ails, it should call)-.1 E(archi)0 36 Q -.15(ve)-.25 G (_set_error\(\)).15 E(to re)0 48 Q (gister an error code and message and return)-.15 E(ARCHIVE_F) 0 60 Q -1.21 -1.11(AT A)-.74 H(L.)1.11 E(

)0 72 Q 0 Cg EP %%Page: 68 68 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)0 12 Q (

typedef ssize_t)0 24 Q (archi)0 36 Q -.15(ve)-.25 G(_write_callback\().15 E (struct archi)0 48 Q .3 -.15(ve *)-.25 H().15 E(v)0 60 Q(oid *client_data)-.2 E (const v)0 72 Q(oid *b)-.2 E(uf)-.2 E(fer)-.25 E 0 Cg EP %%Page: 69 69 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(size_t length)0 12 Q (\))0 24 Q(
)0 36 Q(

)36 48 Q(The write callback is in)0 60 Q -.2 (vo)-.4 G -.1(ke).2 G 2.5(dw).1 G(hene)-2.5 E -.15(ve)-.25 G 2.5(rt).15 G(he library)-2.5 E(needs to write ra)0 72 Q 2.5(wb)-.15 G (ytes to the archi)-2.5 E -.15(ve)-.25 G(.).15 E 0 Cg EP %%Page: 70 70 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF -.15(Fo)0 12 S 2.5(rc).15 G (orrect blocking, each call to the write callback function)-2.5 E (should translate into a single)0 24 Q (write\(2\))0 36 Q(system call.)0 48 Q (This is especially critical when writing archi)0 60 Q -.15(ve)-.25 G 2.5(st).15 G 2.5(ot)-2.5 G(ape dri)-2.5 E -.15(ve)-.25 G(s.).15 E (On success, the write callback should return the)0 72 Q 0 Cg EP %%Page: 71 71 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(number of bytes actually written.)0 12 Q (On error)0 24 Q 2.5(,t)-.4 G(he callback should in)-2.5 E -.2(vo)-.4 G -.1(ke).2 G(archi)0 36 Q -.15(ve)-.25 G (_set_error\(\)).15 E(to re)0 48 Q (gister an error code and message and return -1.)-.15 E(

)0 60 Q (

)0 72 Q 0 Cg EP %%Page: 72 72 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF (

typedef int)0 12 Q (archi)0 24 Q -.15(ve)-.25 G (_close_callback\(struct archi).15 E .3 -.15 (ve *)-.25 H(, v).15 E(oid *client_data\))-.2 E (
)0 36 Q(

)36 48 Q(The close callback is in)0 60 Q -.2(vo)-.4 G -.1(ke).2 G 2.5(db).1 G 2.5(ya)-2.5 G(rchi)-2.5 E -.15(ve)-.25 G (_close when).15 E(the archi)0 72 Q .3 -.15(ve p)-.25 H (rocessing is complete.).15 E 0 Cg EP %%Page: 73 73 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(The callback should return)0 12 Q (ARCHIVE_OK)0 24 Q(on success.)0 36 Q(On f)0 48 Q (ailure, the callback should in)-.1 E -.2(vo)-.4 G -.1(ke).2 G(archi) 0 60 Q -.15(ve)-.25 G(_set_error\(\)).15 E(to re)0 72 Q (gister an error code and message and)-.15 E 0 Cg EP %%Page: 74 74 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(return)0 12 Q(ARCHIVE_F)0 24 Q -1.21 -1.11(AT A)-.74 H(L.)1.11 E(

)36 36 Q(EXAMPLE)36 48 Q(

)36 60 Q(The follo)0 72 Q(wing sk)-.25 E (etch illustrates basic usage of the library)-.1 E(.)-.65 E 0 Cg EP %%Page: 75 75 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(In this e)0 12 Q(xample,)-.15 E (the callback functions are simply wrappers around the standard)0 24 Q (open\(2\),)0 36 Q (write\(2\),)0 48 Q(and)0 60 Q (close\(2\))0 72 Q 0 Cg EP %%Page: 76 76 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(system calls.)0 12 Q(
)0 24 Q ()0 36 Q(
)0 48 Q(#ifdef __linux__)0 60 Q 4.06
(#de\214ne _FILE_OFFSET_BITS)0 72 R(64)2.5 E 0 Cg EP
%%Page: 77 77
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF(#endif)0 12 Q(#include )0 24 Q
(#include ).15 E(#include )-.65 E(#include )0 60 Q
(#include )-.4 E 0 Cg EP
%%Page: 78 78
%%BeginPageSetup
BP
%%EndPageSetup
/F0 10/Times-Roman@0 SF(#include )0 12 Q(

)36 24 Q (struct mydata {)0 36 Q(const char *name;)36 48 Q(int fd;)36 60 Q(};)0 72 Q 0 Cg EP %%Page: 79 79 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)36 12 Q(int)0 24 Q(myopen\(struct archi)0 36 Q .3 -.15(ve *)-.25 H(a, v).15 E(oid *client_data\))-.2 E({)0 48 Q (struct mydata *mydata = client_data;)5 60 Q(

)36 72 Q 0 Cg EP %%Page: 80 80 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(mydata->fd = open\(mydata->name, O_WR)5 12 Q (ONL)-.4 E 2.5(Y|O)-1 G(_CREA)-2.5 E 1.48 -.74(T, 0)-1.11 H(644\);).74 E (if \(mydata->fd >= 0\))5 24 Q(return \(ARCHIVE_OK\);)10 36 Q(else)5 48 Q(return \(ARCHIVE_F)10 60 Q -1.21 -1.11(AT A)-.74 H(L\);)1.11 E(})0 72 Q 0 Cg EP %%Page: 81 81 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)36 12 Q(ssize_t)0 24 Q (mywrite\(struct archi)0 36 Q .3 -.15(ve *)-.25 H(a, v).15 E (oid *client_data, const v)-.2 E(oid *b)-.2 E(uf)-.2 E(f, size_t n\)) -.25 E({)0 48 Q(struct mydata *mydata = client_data;)5 60 Q(

)36 72 Q 0 Cg EP %%Page: 82 82 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(return \(write\(mydata->fd, b)5 12 Q(uf)-.2 E (f, n\)\);)-.25 E(})0 24 Q(

)36 36 Q(int)0 48 Q(myclose\(struct archi) 0 60 Q .3 -.15(ve *)-.25 H(a, v).15 E(oid *client_data\))-.2 E({)0 72 Q 0 Cg EP %%Page: 83 83 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(struct mydata *mydata = client_data;)5 12 Q(

) 36 24 Q(if \(mydata->fd > 0\))5 36 Q(close\(mydata->fd\);)10 48 Q (return \(0\);)5 60 Q(})0 72 Q 0 Cg EP %%Page: 84 84 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)36 12 Q -.2(vo)0 24 S(id).2 E(write_archi)0 36 Q -.15(ve)-.25 G(\(const char *outname, const char **\214lename\)).15 E({)0 48 Q(struct mydata *mydata = malloc\(sizeof\(struct mydata\)\);)5 60 Q(struct archi)5 72 Q .3 -.15(ve *)-.25 H(a;).15 E 0 Cg EP %%Page: 85 85 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(struct archi)5 12 Q -.15(ve)-.25 G (_entry *entry;).15 E(struct stat st;)5 24 Q(char b)5 36 Q(uf)-.2 E (f[8192];)-.25 E(int len;)5 48 Q(int fd;)5 60 Q(

)36 72 Q 0 Cg EP %%Page: 86 86 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 2.5(a=a)5 12 S(rchi)-2.5 E -.15(ve)-.25 G (_write_ne).15 E(w\(\);)-.25 E(mydata->name = outname;)5 24 Q(archi)5 36 Q -.15(ve)-.25 G(_write_set_compression_gzip\(a\);).15 E(archi)5 48 Q -.15(ve)-.25 G(_write_set_format_ustar\(a\);).15 E(archi)5 60 Q -.15(ve) -.25 G(_write_open\(a, mydata, myopen, mywrite, myclose\);).15 E (while \(*\214lename\) {)5 72 Q 0 Cg EP %%Page: 87 87 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(stat\(*\214lename, &st\);)10 12 Q(entry = archi) 10 24 Q -.15(ve)-.25 G(_entry_ne).15 E(w\(\);)-.25 E(archi)10 36 Q -.15 (ve)-.25 G(_entry_cop).15 E(y_stat\(entry)-.1 E 2.5(,&)-.65 G(st\);)-2.5 E(archi)10 48 Q -.15(ve)-.25 G(_entry_set_pathname\(entry).15 E 2.5(,*) -.65 G(\214lename\);)-2.5 E(archi)10 60 Q -.15(ve)-.25 G (_write_header\(a, entry\);).15 E(fd = open\(*\214lename, O_RDONL)10 72 Q(Y\);)-1 E 0 Cg EP %%Page: 88 88 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(len = read\(fd, b)10 12 Q(uf)-.2 E(f, sizeof\(b) -.25 E(uf)-.2 E(f\)\);)-.25 E(while \( len > 0 \) {)10 24 Q(archi)36 36 Q -.15(ve)-.25 G(_write_data\(a, b).15 E(uf)-.2 E(f, len\);)-.25 E (len = read\(fd, b)36 48 Q(uf)-.2 E(f, sizeof\(b)-.25 E(uf)-.2 E(f\)\);) -.25 E(})10 60 Q(archi)10 72 Q -.15(ve)-.25 G(_entry_free\(entry\);).15 E 0 Cg EP %%Page: 89 89 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(\214lename++;)10 12 Q(})5 24 Q(archi)5 36 Q -.15 (ve)-.25 G(_write_\214nish\(a\);).15 E(})0 48 Q(

)36 60 Q (int main\(int ar)0 72 Q(gc, const char **ar)-.18 E(gv\))-.18 E 0 Cg EP %%Page: 90 90 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF({)0 12 Q(const char *outname;)36 24 Q(ar)36 36 Q (gv++;)-.18 E(outname = ar)36 48 Q(gv++;)-.18 E(write_archi)36 60 Q -.15 (ve)-.25 G(\(outname, ar).15 E(gv\);)-.18 E(return 0;)36 72 Q 0 Cg EP %%Page: 91 91 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(})0 12 Q(

)0 24 Q(
)0 36 Q(
)0 48 Q(

)-1.35 E(RETURN V)36 72 Q(ALUES)-1.35 E 0 Cg EP %%Page: 92 92 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)36 12 Q(Most functions return)0 24 Q (ARCHIVE_OK)0 36 Q(\(zero\) on success, or one of se)0 48 Q -.15(ve)-.25 G(ral non-zero).15 E(error codes for errors.)0 60 Q (Speci\214c error codes include:)0 72 Q 0 Cg EP %%Page: 93 93 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(ARCHIVE_RETR)0 12 Q(Y)-.65 E (for operations that might succeed if retried,)0 24 Q (ARCHIVE_W)0 36 Q(ARN)-1.2 E (for unusual conditions that do not pre)0 48 Q -.15(ve)-.25 G (nt further operations, and).15 E(ARCHIVE_F)0 60 Q -1.21 -1.11 (AT A)-.74 H(L)1.11 E(for serious errors that mak)0 72 Q 2.5(er)-.1 G(emaining operations impossible.)-2.5 E 0 Cg EP %%Page: 94 94 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(The)0 12 Q(archi)0 24 Q -.15(ve)-.25 G (_errno\(\)).15 E(and)0 36 Q(archi)0 48 Q -.15(ve) -.25 G(_error_string\(\)).15 E (functions can be used to retrie)0 60 Q .3 -.15(ve a)-.25 H 2.5(na).15 G (ppropriate error code and a)-2.5 E(te)0 72 Q(xtual error message.)-.15 E 0 Cg EP %%Page: 95 95 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)36 12 Q(archi)0 24 Q -.15(ve)-.25 G (_write_ne).15 E(w\(\))-.25 E (returns a pointer to a ne)0 36 Q(wly-allocated)-.25 E(\ struct archi)0 48 Q -.15 (ve)-.25 G().15 E(object.)0 60 Q(

)36 72 Q 0 Cg EP %%Page: 96 96 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_data\(\)).15 E (returns a count of the number of bytes actually written.)0 24 Q (On error)0 36 Q 2.5(,-)-.4 G 2.5(1i)-2.5 G 2.5(sr)-2.5 G (eturned and the)-2.5 E(archi)0 48 Q -.15(ve)-.25 G (_errno\(\)).15 E(and)0 60 Q(archi)0 72 Q -.15(ve) -.25 G(_error_string\(\)).15 E 0 Cg EP %%Page: 97 97 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(functions will return appropriate v)0 12 Q (alues.)-.25 E(Note that if the client-pro)0 24 Q (vided write callback function)-.15 E(returns a non-zero v)0 36 Q (alue, that error will be propag)-.25 E(ated back to the caller)-.05 E (through whate)0 48 Q -.15(ve)-.25 G 2.5(rA).15 G (PI function resulted in that call, which)-2.5 E(may include)0 60 Q (archi)0 72 Q -.15(ve)-.25 G(_write_header\(\),).15 E 0 Cg EP %%Page: 98 98 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G (_write_data\(\),).15 E(archi)0 24 Q -.15(ve)-.25 G (_write_close\(\),).15 E(or)0 36 Q(archi)0 48 Q -.15 (ve)-.25 G(_write_\214nish\(\).).15 E (The client callback can call)0 60 Q(archi)0 72 Q -.15(ve)-.25 G (_set_error\(\)).15 E 0 Cg EP %%Page: 99 99 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(to pro)0 12 Q(vide v)-.15 E (alues that can then be retrie)-.25 E -.15(ve)-.25 G 2.5(db).15 G(y)-2.5 E(archi)0 24 Q -.15(ve)-.25 G(_errno\(\)).15 E(and)0 36 Q(archi)0 48 Q -.15(ve)-.25 G(_error_string\(\).) .15 E(

)36 60 Q(SEE ALSO)36 72 Q 0 Cg EP %%Page: 100 100 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)36 12 Q(tar\(1\),)-.55 E(libarchi).15 E -.15(ve)-.25 G(\(3\),).15 E (tar\(5\))-.55 E(

)-.65 E(HIST)36 72 Q(OR)-.18 E(Y)-.65 E 0 Cg EP %%Page: 101 101 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(

)36 12 Q(The)0 24 Q(libarchi)0 36 Q -.15 (ve)-.25 G().15 E(library \214rst appeared in)0 48 Q(FreeBSD5.3.)0 60 Q(

)-.55 E 0 Cg EP %%Page: 102 102 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF -.55(AU)36 12 S(THORS).55 E(

)36 24 Q(

)36 36 Q(The)0 48 Q(libarchi)0 60 Q -.15(ve)-.25 G().15 E(library w)0 72 Q(as written by)-.1 E 0 Cg EP %%Page: 103 103 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF -.35(Ti)0 12 S 2.5(mK).35 G (ientzle <kientzle@acm.or)-2.5 E(g>.)-.18 E(

)-.1 E -.1(BU)36 36 S(GS).1 E(

)36 48 Q(There are man)0 60 Q 2.5(yp)-.15 G(eculiar b)-2.5 E (ugs in historic tar implementations that may cause)-.2 E (certain programs to reject archi)0 72 Q -.15(ve)-.25 G 2.5(sw).15 G (ritten by this library)-2.5 E(.)-.65 E 0 Cg EP %%Page: 104 104 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF -.15(Fo)0 12 S 2.5(re).15 G(xample, se)-2.65 E -.15(ve)-.25 G(ral historic implementations calculated header checksums) .15 E(incorrectly and will thus reject v)0 24 Q(alid archi)-.25 E -.15 (ve)-.25 G(s; GNU tar does not fully support).15 E(pax interchange form\ at; some old tar implementations required speci\214c)0 36 Q (\214eld terminations.)0 48 Q(

)36 60 Q(The def)0 72 Q (ault pax interchange format eliminates most of the historic)-.1 E 0 Cg EP %%Page: 105 105 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(tar limitations and pro)0 12 Q (vides a generic k)-.15 E -.15(ey)-.1 G(/v).15 E(alue attrib)-.25 E (ute f)-.2 E(acility)-.1 E(for v)0 24 Q(endor)-.15 E(-de\214ned e)-.2 E (xtensions.)-.15 E(One o)0 36 Q -.15(ve)-.15 G(rsight in POSIX is the f) .15 E(ailure to pro)-.1 E(vide a standard attrib)-.15 E(ute)-.2 E (for lar)0 48 Q(ge de)-.18 E(vice numbers.)-.25 E(This library uses)0 60 Q -.74(``)0 72 S(SCHIL).74 E -1.29(Y.)-1 G(de)1.29 E(vminor')-.25 E(') -.74 E 0 Cg EP %%Page: 106 106 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(and)0 12 Q -.74(``)0 24 S(SCHIL).74 E -1.29(Y.) -1 G(de)1.29 E(vmajor')-.25 E(')-.74 E(for de)0 36 Q (vice numbers that e)-.25 E(xceed the range supported by the backw)-.15 E(ards-compatible)-.1 E(ustar header)0 48 Q(.)-.55 E(These k)0 60 Q -.15 (ey)-.1 G 2.5(sa).15 G(re compatible with Joer)-2.5 E 2.5(gS)-.18 G (chilling')-2.5 E(s)-.55 E(star)0 72 Q 0 Cg EP %%Page: 107 107 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(archi)0 12 Q -.15(ve)-.25 G -.55(r.).15 G (Other implementations may not recognize these k)0 24 Q -.15(ey)-.1 G 2.5(sa).15 G(nd will thus be unable)-2.5 E(to correctly restore de)0 36 Q(vice nodes with lar)-.25 E(ge de)-.18 E(vice numbers from archi)-.25 E -.15(ve)-.25 G(s).15 E(created by this library)0 48 Q(.)-.65 E()0 60 Q()0 72 Q 0 Cg EP %%Trailer end %%EOF