1AR(5) 386BSD Programmer's Manual AR(5) 2 3NNAAMMEE 4 aarr - archive (library) file format 5 6SSYYNNOOPPSSIISS 7 ##iinncclluuddee <<aarr..hh>> 8 9DDEESSCCRRIIPPTTIIOONN 10 The archive command aarr combines several files into one. Archives are 11 mainly used as libraries of object files intended to be loaded using the 12 link-editor ld(1). 13 14 A file created with aarr begins with the ``magic'' string "!<arch>\n". The 15 rest of the archive is made up of objects, each of which is composed of a 16 header for a file, a possible file name, and the file contents. The 17 header is portable between machine architectures, and, if the file 18 contents are printable, the archive is itself printable. 19 20 The header is made up of six variable length ASCII fields, followed by a 21 two character trailer. The fields are the object name (16 characters), 22 the file last modification time (12 characters), the user and group id's 23 (each 6 characters), the file mode (8 characters) and the file size (10 24 characters). All numeric fields are in decimal, except for the file mode 25 which is in octal. 26 27 The modification time is the file _s_t__m_t_i_m_e field, i.e., CUT seconds since 28 the epoch. The user and group id's are the file _s_t__u_i_d and _s_t__g_i_d 29 fields. The file mode is the file _s_t__m_o_d_e field. The file size is the 30 file _s_t__s_i_z_e field. The two-byte trailer is the string "`\n". 31 32 Only the name field has any provision for overflow. If any file name is 33 more than 16 characters in length or contains an embedded space, the 34 string "#1/" followed by the ASCII length of the name is written in the 35 name field. The file size (stored in the archive header) is incremented 36 by the length of the name. The name is then written immediately 37 following the archive header. 38 39 Any unused characters in any of these fields are written as space 40 characters. If any fields are their particular maximum number of 41 characters in length, there will be no separation between the fields. 42 43 Objects in the archive are always an even number of bytes long; files 44 which are an odd number of bytes long are padded with a newline (``\n'') 45 character, although the size in the header does not reflect this. 46 47SSEEEE AALLSSOO 48 ar(1), stat(2) 49 50HHIISSTTOORRYY 51 There have been at least four aarr formats. The first was denoted by the 52 leading ``magic'' number 0177555 (stored as type int). These archives 53 were almost certainly created on a 16-bit machine, and contain headers 54 made up of five fields. The fields are the object name (8 characters), 55 the file last modification time (type long), the user id (type char), the 56 file mode (type char) and the file size (type unsigned int). Files were 57 padded to an even number of bytes. 58 59 The second was denoted by the leading ``magic'' number 0177545 (stored as 60 type int). These archives may have been created on either 16 or 32-bit 61 machines, and contain headers made up of six fields. The fields are the 62 object name (14 characters), the file last modification time (type long), 63 the user and group id's (each type char), the file mode (type int) and 64 the file size (type long). Files were padded to an even number of bytes. 65 For more information on converting from this format see arcv(8). 66 67 The current archive format (without support for long character names and 68 names with embedded spaces) was introduced in 4.0BSD. The headers were 69 the same as the current format, with the exception that names longer than 70 16 characters were truncated, and names with embedded spaces (and often 71 trailing spaces) were not supported. It has been extended for these 72 reasons, as described above. This format is currently under development. 73 74CCOOMMPPAATTIIBBIILLIITTYY 75 No archive format is currently specified by any standard. AT&T System V 76 UNIX has historically distributed archives in a different format from all 77 of the above. 78 79BSD Experimental May 10, 1991 2 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133