Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)
ar(1) OSS Shell and Utilities Reference Manual
abbrevi ated-month
is equivalent to the %b format in the output of the date command.
day-of-the-month
is equivalent to the %e format in the date command.
hour is equivalent to the %H format in the date command.
minute is equivalent to the %M format in the date command.
year is equivalent to the %Y format in the date command.
• If the -x flag is used with the -v flag, the standard output format is:
"x - %s\n", file
where file is the file operand specified on the command line if file operands were
specified, or the name of the file within the archive file if the file operands were not
specified.
Standard Error
Messages from the ar command are only diagnostic messages. The diagnostic message about
creating a new archive file when the -c flag is not specified does not modify the exit status.
Output Files
Output is the normal archive file name with string "!arch\n" at the beginning.
EXAMPLES
1. The command
ar -rcv newlib a1.o a2.o a3.o a4.o
creates an archive file named newlib (if an archive file by that name does not already
exist) with the files a1.o, a2.o, a3.o, and a4.o as its members. If newlib already
exists and some of the files named a1.o, a2.o, a3.o, and a4.o are in the archive,
these files are replaced by the new files. Files that are not current members of the
archive are added to the end of the archive file. The -v flag causes a file-by-file replace-
ment or addition message to be displayed on the terminal when each operation is ini-
tiated.
2. The command
ar -tv newlib
displays a detailed table of contents of the archive newlib.
3. The command
ar -x oldlib x.o y.o
extracts member files x.o and y.o from the archive oldlib.
4. The command
ar -rb abc.o oldlib x.o y.o
adds new member files x.o and y.o to the archive file oldlib. The new files are
inserted in front of the existing member abc.o.
5. The command
ar -dv libmylib f1.0 f2.0
deletes files f1.0 and f2.0 from the archive libmylib.
1−12 Hewlett-Packard Company 527188-021