IEEE P1003.2 Draft 11.2 - September 1991 Copyright (c) 1991 by the Institute of Electrical and Electronics Engineers, Inc. 345 East 47th Street New York, NY 10017, USA All rights reserved as an unpublished work. This is an unapproved and unpublished IEEE Standards Draft, subject to change. The publication, distribution, or copying of this draft, as well as all derivative works based on this draft, is expressly prohibited except as set forth below. Permission is hereby granted for IEEE Standards Committee participants to reproduce this document for purposes of IEEE standardization activities only, and subject to the restrictions contained herein. Permission is hereby also granted for member bodies and technical committees of ISO and IEC to reproduce this document for purposes of developing a national position, subject to the restrictions contained herein. Permission is hereby also granted to the preceding entities to make limited copies of this document in an electronic form only for the stated activities. The following restrictions apply to reproducing or transmitting the document in any form: 1) all copies or portions thereof must identify the document's IEEE project number and draft number, and must be accompanied by this entire notice in a prominent location; 2) no portion of this document may be redistributed in any modified or abridged form without the prior approval of the IEEE Standards Department. Other entities seeking permission to reproduce this document, or any portion thereof, for standardization or other activities, must contact the IEEE Standards Department for the appropriate license. Use of information contained in this unapproved draft is at your own risk. IEEE Standards Department Copyright and Permissions 445 Hoes Lane, P.O. Box 1331 Piscataway, NJ 08855-1331, USA +1 (908) 562-3800 +1 (908) 562-1571 [FAX] P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX 4.33 ln - Link files 4.33.1 Synopsis ln [-f] _s_o_u_r_c_e__f_i_l_e _t_a_r_g_e_t__f_i_l_e ln [-f] _s_o_u_r_c_e__f_i_l_e ... _t_a_r_g_e_t__d_i_r 4.33.2 Description In the first synopsis form, the ln utility shall create a new directory entry (link) for the file specified by the _s_o_u_r_c_e__f_i_l_e operand, at the _d_e_s_t_i_n_a_t_i_o_n path specified by the _t_a_r_g_e_t__f_i_l_e operand. This first synopsis form shall be assumed when the final operand does not name an existing directory; if more than two operands are specified and the final 1 is not an existing directory, an error shall result. 1 In the second synopsis form, the ln utility shall create a new directory entry for each file specified by a _s_o_u_r_c_e__f_i_l_e operand, at a _d_e_s_t_i_n_a_t_i_o_n path in the existing directory named by _t_a_r_g_e_t__d_i_r. If the last operand specifies an existing file of a type not specified by POSIX.1 {8}, the behavior is implementation defined. The corresponding destination path for each _s_o_u_r_c_e__f_i_l_e shall be the concatenation of the target directory pathname, a slash character, and the last pathname component of the _s_o_u_r_c_e__f_i_l_e. The second synopsis form shall be assumed when the final operand names an existing directory. For each _s_o_u_r_c_e__f_i_l_e: (1) If the _d_e_s_t_i_n_a_t_i_o_n path exists: (a) If the -f option is not specified, ln shall write a diagnostic message to standard error, do nothing more with the current _s_o_u_r_c_e__f_i_l_e, and go on to any remaining _s_o_u_r_c_e__f_i_l_e_s. (b) Actions shall be performed equivalent to the POSIX.1 {8} _u_n_l_i_n_k() function, called using _d_e_s_t_i_n_a_t_i_o_n as the _p_a_t_h argument. If this fails for any reason, ln shall write a diagnostic message to standard error, do nothing more with the current _s_o_u_r_c_e__f_i_l_e, and go on to any remaining _s_o_u_r_c_e__f_i_l_e_s. (2) Actions shall be performed equivalent to the POSIX.1 {8} _l_i_n_k() function using _s_o_u_r_c_e__f_i_l_e as the _p_a_t_h_1 argument, and the Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 566 4 Execution Environment Utilities Part 2: SHELL AND UTILITIES P1003.2/D11.2 _d_e_s_t_i_n_a_t_i_o_n path as the _p_a_t_h_2 argument. 4.33.3 Options The ln utility shall conform to the utility argument syntax guidelines described in 2.10.2. The following option shall be supported by the implementation: -f Force existing _d_e_s_t_i_n_a_t_i_o_n pathnames to be removed to allow the link. 4.33.4 Operands The following operands shall be supported by the implementation: _s_o_u_r_c_e__f_i_l_e A pathname of a file to be linked. This can be a regular or special file; whether a directory can be linked is implementation defined. _t_a_r_g_e_t__f_i_l_e The pathname of the new directory entry to be created. _t_a_r_g_e_t__d_i_r A pathname of an existing directory in which the new directory entries are to be created. 4.33.5 External Influences 4.33.5.1 Standard Input None. 4.33.5.2 Input Files None. 4.33.5.3 Environment Variables The following environment variables shall affect the execution of ln: LANG This variable shall determine the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with LC_) do not specify a locale. See 2.6. Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 4.33 ln - Link files 567 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX LC_ALL This variable shall determine the locale to be used to override any values for locale categories specified by the settings of LANG or any environment variables beginning with LC_. LC_CTYPE This variable shall determine the locale for the interpretation of sequences of bytes of text data as characters (e.g., single- versus multibyte characters in arguments). LC_MESSAGES This variable shall determine the language in which messages should be written. 4.33.5.4 Asynchronous Events Default. 4.33.6 External Effects 4.33.6.1 Standard Output None. 4.33.6.2 Standard Error Used only for diagnostic messages. 4.33.6.3 Output Files None. 4.33.7 Extended Description None. 4.33.8 Exit Status The ln utility shall exit with one of the following values: 0 All the specified files were linked successfully. >0 An error occurred. Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 568 4 Execution Environment Utilities Part 2: SHELL AND UTILITIES P1003.2/D11.2 4.33.9 Consequences of Errors Default. BEGIN_RATIONALE 4.33.10 Rationale. (_T_h_i_s _s_u_b_c_l_a_u_s_e _i_s _n_o_t _a _p_a_r_t _o_f _P_1_0_0_3._2) _E_x_a_m_p_l_e_s_,__U_s_a_g_e None. _H_i_s_t_o_r_y__o_f__D_e_c_i_s_i_o_n_s__M_a_d_e Some historic versions of ln (including the one specified by the _S_V_I_D) unlink the destination file, if it exists, by default. If the mode does not permit writing, these versions will prompt for confirmation before attempting the unlink. In these versions the -f option causes ln to not attempt to prompt for confirmation. This allows ln to succeed in creating links when the target file already exists, even if the file itself is not writable (although the directory must be). Previous versions of this draft specified this functionality. This draft does not allow the ln utility to unlink existing destination paths by default for the following reasons: - The ln utility has traditionally been used to provide locking for shell applications, a usage that is incompatible with ln unlinking the destination path by default. There was no corresponding technical advantage to adding this functionality. - This functionality gave ln the ability to destroy the link structure of files, which changes the historical behavior of ln. - This functionality is easily replicated with a combination of rm and ln. - It is not historical practice in many systems; BSD and BSD-derived systems do not support this behavior. Unfortunately, whichever behavior is selected can cause scripts written expecting the other behavior to fail. - It is preferable that ln perform in the same manner as the _l_i_n_k() function, which does not permit the target to already exist. This standard retains the -f option to provide support for shell scripts depending on the _S_V_I_D semantics. It seems likely that shell scripts Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 4.33 ln - Link files 569 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX would not be written to handle prompting by ln, and would therefore have specified the -f option. It should also be noted that -f is an undocumented feature of many historical versions of the ln utility, allowing linking to directories. These versions will require modification. Previous drafts of this standard also required an -i option, which behaved like the -i options in cp and mv, prompting for confirmation before unlinking existing files. This was not historical practice for the ln utility and has been deleted from this version. Although symbolic links are not part of the standard, the -s option should be used only for the traditional purpose of creating symbolic links. END_RATIONALE 4.34 locale - Get locale-specific information 4.34.1 Synopsis locale [ -a | -m ] locale [-ck] _n_a_m_e ... 4.34.2 Description The locale utility shall write information about the current locale environment, or all public locales, to the standard output. For the purposes of this clause, a _p_u_b_l_i_c _l_o_c_a_l_e is one provided by the implementation that is accessible to the application. When locale is invoked without any arguments, it shall summarize the current locale environment for each locale category as determined by the settings of the environment variables defined in 2.5. When invoked with operands, it shall write values that have been assigned to the keywords in the locale categories, as follows: - Specifying a keyword name shall select the named keyword and the category containing that keyword. - Specifying a category name shall select the named category and all keywords in that category. Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 570 4 Execution Environment Utilities