| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: setmode.3,v 1.19 2009/01/04 07:54:15 dholland Exp $ | | 1 | .\" $NetBSD: setmode.3,v 1.20 2009/01/04 09:42:43 wiz Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 1989, 1991, 1993 | | 3 | .\" Copyright (c) 1989, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | | 4 | .\" The Regents of the University of California. All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. Neither the name of the University nor the names of its contributors | | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
| @@ -90,27 +90,27 @@ If the mode passed to | | | @@ -90,27 +90,27 @@ If the mode passed to |
90 | is invalid, | | 90 | is invalid, |
91 | .Fn setmode | | 91 | .Fn setmode |
92 | returns | | 92 | returns |
93 | .Dv NULL . | | 93 | .Dv NULL . |
94 | .Sh EXAMPLES | | 94 | .Sh EXAMPLES |
95 | The effects of the shell command | | 95 | The effects of the shell command |
96 | .Ql "chmod a+x myscript.sh" | | 96 | .Ql "chmod a+x myscript.sh" |
97 | can be duplicated as follows: | | 97 | can be duplicated as follows: |
98 | .Bd -literal -offset indent | | 98 | .Bd -literal -offset indent |
99 | const char *file = "myscript.sh"; | | 99 | const char *file = "myscript.sh"; |
100 | struct stat st; | | 100 | struct stat st; |
101 | mode_t newmode; | | 101 | mode_t newmode; |
102 | | | 102 | |
103 | stat(file, &st); | | 103 | stat(file, \*[Am]st); |
104 | newmode = getmode(setmode("a+x"), st.st_mode); | | 104 | newmode = getmode(setmode("a+x"), st.st_mode); |
105 | chmod(file, newmode); | | 105 | chmod(file, newmode); |
106 | .Ed | | 106 | .Ed |
107 | .Sh ERRORS | | 107 | .Sh ERRORS |
108 | The | | 108 | The |
109 | .Fn setmode | | 109 | .Fn setmode |
110 | function | | 110 | function |
111 | may fail and set | | 111 | may fail and set |
112 | .Va errno | | 112 | .Va errno |
113 | for any of the errors specified for the library routines | | 113 | for any of the errors specified for the library routines |
114 | .Xr malloc 3 | | 114 | .Xr malloc 3 |
115 | or | | 115 | or |
116 | .Xr strtol 3 . | | 116 | .Xr strtol 3 . |