1.TH SCC-AR 1 scc\-VERSION2.SH NAME3scc-ar \- create and maintain library archives4.SH SYNOPSIS5.B scc-ar6.RB [ \-cluv ]7.RB [ \-d | \-m | \-p | \-q | \-r | \-t | \-x ]8.RB [ \-a | \-b | \-i9.IR posname ]10.I archive11.RI [ file ...]12.SH DESCRIPTION13.B scc-ar14creates and maintains groups of files combined into an archive.15Once an archive has been created, new files can be added and existing16files can be updated, replaced, or deleted.17.PP18The archive is created with a special header that identifies it as an19archive file, followed by the archived files. Each archived member includes20a header containing the file name, modification time, owner, group, file mode,21and size.22.PP23Archives are commonly used to create libraries of object files for use24with the linker. The25.B scc-ar26utility, in combination with a symbol table created by27.BR scc-ranlib (1),28allows the linker to selectively extract only those object files needed29to resolve external references.30.SH OPTIONS31Exactly one of the following key options must be specified:32.TP33.B \-d34Delete the specified35.I files36from the37.IR archive .38If the verbose modifier39.B \-v40is specified,41.B scc-ar42writes a line to standard output for each file deleted, consisting of43the single character 'd' followed by a space and the name of the file.44If one or more45.I files46are specified but not found in the archive, an error is reported.47.TP48.B \-m49Move the specified50.I files51within the52.IR archive .53By default, members are moved to the end of the archive. The54.BR \-a ,55.BR \-b ,56or57.B \-i58modifiers can be used to specify a position relative to another member.59If the verbose modifier60.B \-v61is specified,62.B scc-ar63writes a line to standard output for each file moved, consisting of64the single character 'm' followed by a space and the name of the file.65.TP66.B \-p67Print the contents of the specified68.I files69from the70.I archive71to standard output. If no72.I files73are specified, the contents of all files in the archive are printed.74If the verbose modifier75.B \-v76is specified, a header is printed before each file consisting of77a newline, '<', the file name, '>', and two newlines.78.TP79.B \-q80Quickly append the specified81.I files82to the end of the83.IR archive .84This is faster than85.B \-r86because it does not check whether the files already exist in the archive.87The88.B \-a89and90.B \-b91modifiers are not supported with this operation.92.TP93.B \-r94Replace or add the specified95.I files96to the97.IR archive .98If the archive does not exist, it is created. If a specified file is99already a member of the archive, it is replaced. New files are added100at the end of the archive by default, or at a position specified by101the102.BR \-a ,103.BR \-b ,104or105.B \-i106modifiers. If the verbose modifier107.B \-v108is specified,109.B scc-ar110writes a line to standard output for each file added or replaced,111consisting of the single character 'a' or 'r' followed by a space112and the name of the file.113.TP114.B \-t115List the table of contents of the116.IR archive .117If118.I files119are specified, only those files are listed. If the verbose modifier120.B \-v121is specified, the listing includes file permissions, owner/group IDs,122modification time, and file name in a format similar to123.BR ls (1).124Otherwise, only file names are printed, one per line.125.TP126.B \-x127Extract the specified128.I files129from the130.IR archive .131If no132.I files133are specified, all files in the archive are extracted. The extracted134files are created with the same permissions, modification time, owner,135and group as they had when archived. If the verbose modifier136.B \-v137is specified,138.B scc-ar139writes a line to standard output for each file extracted, consisting of140the single character 'x' followed by a space and the name of the file.141.PP142The following modifiers are available:143.TP144.BI \-a " posname"145Position new or moved files after the existing member146.IR posname .147This modifier is only valid with the148.B \-m149and150.B \-r151operations.152.TP153.BI \-b " posname"154Position new or moved files before the existing member155.IR posname .156This modifier is only valid with the157.B \-m158and159.B \-r160operations. The161.B \-i162modifier is a synonym for163.BR \-b .164.TP165.BI \-i " posname"166Identical to167.BR \-b .168Position new or moved files before the existing member169.IR posname .170This modifier is only valid with the171.B \-m172and173.B \-r174operations.175.TP176.B \-c177Suppress the diagnostic message that is written to standard error when178the179.I archive180is created. Without this modifier,181.B scc-ar182writes a message to standard error when creating a new archive.183.TP184.B \-l185Use local temporary files instead of186.BR tmpfile (3).187When specified, temporary files are created in the current directory188with the names189.IR ar.tmp1 ,190.IR ar.tmp2 ,191and192.IR ar.tmp3 .193This can be useful when the system temporary directory is on a different194filesystem or has insufficient space.195.TP196.B \-u197Update members conditionally. When used with the198.B \-r199option, a file is only replaced in the archive if the file on disk200has been modified more recently than the version in the archive.201This modifier is only valid with the202.B \-r203operation.204.TP205.B \-v206Verbose mode. Provide detailed output showing which files are being207processed. The format of the output depends on the operation being208performed (see individual operation descriptions above).209.SH OPERANDS210.TP211.I archive212The pathname of the archive file to be created, modified, or examined.213.TP214.I file215A pathname of a file to be added to, extracted from, or listed in the archive.216When adding files to an archive, the canonical name (basename) of the file217is stored in the archive, stripped of any directory components.218.SH IMPLEMENTATION NOTES219The220.B scc-ar221utility in the SCC toolchain is designed to be POSIX-compliant and222portable across different systems. It has the following characteristics:223.TP224\(bu225Archive member names are limited to 16 characters and cannot contain spaces.226.TP227\(bu228Member names are stored in a fixed 16-character field, space-padded.229.TP230\(bu231Archive members are aligned on even byte boundaries; if a member has an232odd size, a newline character is appended as padding.233.TP234\(bu235The archive format uses the standard UNIX archive magic number.236.TP237\(bu238File attributes (permissions, owner, group, modification time) are preserved239when extracting files.240.TP241\(bu242When adding files, the utility stores the canonical (base) name only,243stripping any directory path components.244.TP245\(bu246If any specified247.I file248is not found in the archive during an operation that requires it249(such as250.BR \-d ,251.BR \-m ,252or253.BR \-r ),254an error is reported after all other operations complete.255.TP256\(bu257Signal handling: The utility registers handlers for SIGINT, SIGQUIT258(on systems that support it), and SIGTERM to ensure temporary files259are cleaned up on abnormal termination.260.SH EXAMPLES261.PP262Create (or update) an archive containing object files:263.IP264.EX265scc-ar \-r libfoo.a foo.o bar.o baz.o266.EE267.PP268List the contents of an archive:269.IP270.EX271scc-ar \-t libfoo.a272.EN273.PP274List the contents verbosely, showing file details:275.IP276.EX277scc-ar \-tv libfoo.a278.EE279.PP280Extract all files from an archive:281.IP282.EX283scc-ar \-x libfoo.a284.EE285.PP286Extract a specific file:287.IP288.EX289scc-ar \-x libfoo.a foo.o290.EE291.PP292Delete a file from an archive:293.IP294.EX295scc-ar \-d libfoo.a foo.o296.EE297.PP298Replace a file only if it has been modified:299.IP300.EX301scc-ar \-ru libfoo.a foo.o302.EE303.PP304Insert a file before another member:305.IP306.EX307scc-ar \-r \-b bar.o libfoo.a newfile.o308.EE309.PP310Move a member to the end of the archive:311.IP312.EX313scc-ar \-m libfoo.a foo.o314.EE315.SH DIAGNOSTICS316If the317.B \-c318modifier is not specified and a new archive is created,319.B scc-ar320writes the following message to standard error:321.IP322.EX323ar: creating archive324.EE325.PP326Error messages are written to standard error and have the format:327.IP328.EX329ar: archive: message330.EE331.SH STANDARDS332The333.B scc-ar334utility is designed to conform to IEEE Std 1003.1-2008 (POSIX.1).335.SH SEE ALSO336.BR scc-ranlib (1),337.BR scc-ld (1),338.BR scc-nm (1),339.BR scc-strip (1)340.SH BUGS341The342.B scc-ar343utility does not create a symbol table by default. Use344.BR scc-ranlib (1)345to add a symbol table to an archive.346The option \-s is not implemented.