The MinGW.org Windows System Libraries
リビジョン | 40713b7cbd4d766a71a78c6b3cdd79a6491cdf96 (tree) |
---|---|
日時 | 2016-04-14 05:39:45 |
作者 | Keith Marshall <keithmarshall@user...> |
コミッター | Keith Marshall |
Generalize procedure for installing manpages.
--HG--
rename : mingwrt/man/dirname.man => mingwrt/man/dirname.3.man
@@ -1,3 +1,21 @@ | ||
1 | +2016-04-13 Keith Marshall <keithmarshall@users.sourceforge.net> | |
2 | + | |
3 | + Generalize procedure for installing manpages. | |
4 | + | |
5 | + * man/dirname.man: Rename it as... | |
6 | + * man/dirname.3.man: ...this, with inherent MANSECT specification. | |
7 | + (TH): Use %PAGEREF% substitution for NAME, MANSECT, and DATE. | |
8 | + (MS-Windows): Do not append \[tm]; it doesn't render well in Windows | |
9 | + console. Further, correct typos; some syntactic adjustments. | |
10 | + | |
11 | + * Makefile.in (%:%.man): New rule; define it. | |
12 | + (%.mancopy, %.mancopy-recursive): New rules; define and use with... | |
13 | + (reference_manpage): ...this new macro, defining it to map... | |
14 | + (dirname.3.man): ...this as the reference source file for both of... | |
15 | + (basename.3, dirname.3): ...these installed manpages. | |
16 | + (format_manpage): Add MANSECT and DATE to expansion of... | |
17 | + (%PAGEREF%): ...this sed substitution pattern. | |
18 | + | |
1 | 19 | 2016-04-12 Keith Marshall <keithmarshall@users.sourceforge.net> |
2 | 20 | |
3 | 21 | Update several incorrectly attributed header files. |
@@ -733,21 +733,31 @@ install-%-dll-files: | ||
733 | 733 | |
734 | 734 | # Install manpages. |
735 | 735 | # |
736 | -install-man install-manpages: install-mingwrt-manpages | |
737 | -format_manpage = sed "s/%PAGEREF%/`echo $1 | tr a-z A-Z` $2/" | |
738 | - | |
739 | 736 | vpath %.man ${mingwrt_srcdir}/man |
740 | -basename.$(man3ext) dirname.$(man3ext): %.$(man3ext): dirname.man | |
741 | - $(call format_manpage,$*,$(man3ext)) $< > $@ | |
742 | - | |
743 | -mingwrt-man$(man3ext): basename.$(man3ext) dirname.$(man3ext) | |
744 | - | |
737 | +install-man install-manpages: install-mingwrt-manpages | |
738 | +mingwrt-man$(man3ext): $(addsuffix .$(man3ext),basename dirname) | |
745 | 739 | install-mingwrt-manpages: mandir mingwrt-man3 |
740 | + | |
746 | 741 | mingwrt-man%: |
747 | 742 | $(call mkinstalldirs,,${man$*dir}) |
748 | 743 | $(call INSTALL_DATA,$^,${man$*dir}) |
749 | 744 | $(RM) $^ |
750 | 745 | |
746 | +%: %.man | |
747 | + $(call format_manpage,$(basename $*),$(suffix $*),$<) $< > $@ | |
748 | + | |
749 | +format_manpage = sed \ | |
750 | + -e "s/%PAGEREF%/`echo $1 | tr a-z A-Z` $(2:.%=%) `date -r $3 +%d-%b-%Y`/" | |
751 | + | |
752 | +basename.$(man3ext): export reference_manpage = dirname.$(man3ext).man | |
753 | +basename.$(man3ext): %: %.mancopy-recursive | |
754 | + | |
755 | +%.mancopy-recursive: | |
756 | + $(MAKE) --no-print-directory $*.mancopy | |
757 | + | |
758 | +%.mancopy: $(reference_manpage) | |
759 | + $(call format_manpage,$(basename $*),$(suffix $*),$<) $< > $* | |
760 | + | |
751 | 761 | |
752 | 762 | # Undo Installation |
753 | 763 | # ----------------- |
@@ -1,9 +1,10 @@ | ||
1 | -.\" t | |
2 | -.TH DIRNAME 3 04-Jan-2007 MinGW "Programmer's Reference Manual" | |
1 | +'\" t | |
2 | +.\" vim: ft=nroff | |
3 | +.TH %PAGEREF% MinGW "Programmer's Reference Manual" | |
3 | 4 | . |
4 | 5 | .SH NAME |
5 | 6 | . |
6 | -.BR dirname ,\0 basename | |
7 | +.BR \%dirname ,\0 \%basename | |
7 | 8 | \- parse path name components |
8 | 9 | . |
9 | 10 | . |
@@ -24,9 +25,9 @@ | ||
24 | 25 | .SH DESCRIPTION |
25 | 26 | . |
26 | 27 | The |
27 | -.B dirname | |
28 | +.BR \%dirname () | |
28 | 29 | and |
29 | -.B basename | |
30 | +.BR \%basename () | |
30 | 31 | functions parse a null\-terminated path name string, |
31 | 32 | and split it into its |
32 | 33 | .B directory name |
@@ -37,7 +38,7 @@ Splitting is performed on the basis of the location of the | ||
37 | 38 | .B directory separator |
38 | 39 | characters, |
39 | 40 | which, |
40 | -for this MS\-Windows(\(tm) implementation, | |
41 | +for this MS\-Windows implementation, | |
41 | 42 | are the characters |
42 | 43 | .RB \(dq / \(dq |
43 | 44 | and |
@@ -52,7 +53,7 @@ is a colon | ||
52 | 53 | .RB (\(dq : \(dq), |
53 | 54 | the first two characters of |
54 | 55 | .I path |
55 | -are interpreted as an MS\-Windows(\(tm) drive designator, | |
56 | +are interpreted as an MS\-Windows drive designator, | |
56 | 57 | which will be included in the |
57 | 58 | .B directory name |
58 | 59 | component of |
@@ -63,48 +64,48 @@ component. | ||
63 | 64 | . |
64 | 65 | .PP |
65 | 66 | In normal usage, |
66 | -.B dirname | |
67 | +.BR \%dirname () | |
67 | 68 | returns a pointer to a string representing the path name component of |
68 | 69 | .IR path , |
69 | 70 | up to but not including the rightmost directory separator, |
70 | 71 | while |
71 | -.B basename | |
72 | +.BR \%basename () | |
72 | 73 | returns a pointer to the component following this separator. |
73 | 74 | Any trailing directory separators present in |
74 | 75 | .I path |
75 | 76 | are disregarded, |
76 | 77 | when determining the rightmost separator, |
77 | 78 | and, in the case of the return value from |
78 | -.BR dirname , | |
79 | +.BR \%dirname (), | |
79 | 80 | any internal sequences of recurring separator characters |
80 | 81 | are each reduced to a single such character. |
81 | 82 | . |
82 | 83 | .PP |
83 | 84 | If |
84 | 85 | .I path |
85 | -contains no MS\-Windows(\(tm) drive designator, | |
86 | +contains no MS\-Windows drive designator, | |
86 | 87 | and no directory separator character, |
87 | 88 | then |
88 | -.B dirname | |
89 | +.BR \%dirname () | |
89 | 90 | returns the string |
90 | 91 | .RB \(dq . \(dq, |
91 | 92 | and |
92 | -.B basename | |
93 | +.BR \%basename () | |
93 | 94 | returns a copy of |
94 | 95 | .IR path. |
95 | 96 | If |
96 | 97 | .I path |
97 | -does commence with an MS\-Windows(\(tm) drive designator, | |
98 | +does commence with an MS\-Windows drive designator, | |
98 | 99 | but contains no directory separators, |
99 | 100 | then |
100 | -.B dirname | |
101 | +.BR \%dirname () | |
101 | 102 | returns the string |
102 | 103 | .RB \(dq d:. \(dq, |
103 | 104 | where |
104 | 105 | .RB \(dq d: \(dq |
105 | 106 | represents the drive designator, |
106 | 107 | while |
107 | -.B basename | |
108 | +.BR \%basename () | |
108 | 109 | returns a copy of |
109 | 110 | .IR path , |
110 | 111 | with its initial two characters, |
@@ -117,9 +118,9 @@ If | ||
117 | 118 | is a NULL pointer, |
118 | 119 | or is a pointer to an empty string, |
119 | 120 | then both |
120 | -.B dirname | |
121 | +.BR \%dirname () | |
121 | 122 | and |
122 | -.B basename | |
123 | +.BR \%basename () | |
123 | 124 | return the string |
124 | 125 | .RB \(dq . \(dq. |
125 | 126 | . |
@@ -131,9 +132,9 @@ is the string | ||
131 | 132 | or the string |
132 | 133 | .RB \(dq \e \(dq, |
133 | 134 | both |
134 | -.B dirname | |
135 | +.BR \%dirname () | |
135 | 136 | and |
136 | -.B basename | |
137 | +.BR \%basename () | |
137 | 138 | return the string |
138 | 139 | .RB \(dq / \(dq, |
139 | 140 | or the string |
@@ -148,15 +149,15 @@ commences with | ||
148 | 149 | two directory separator characters, |
149 | 150 | which must be similar, |
150 | 151 | then |
151 | -.B dirname | |
152 | +.BR \%dirname () | |
152 | 153 | will preserve these two characters in the returned path name. |
153 | 154 | This construct does not affect the string returned by |
154 | -.BR basename , | |
155 | +.BR \%basename (), | |
155 | 156 | neither is this behaviour replicated by |
156 | -.BR dirname , | |
157 | +.BR \%dirname (), | |
157 | 158 | if |
158 | 159 | .I path |
159 | -includes an MS\-Windows(\(tm) drive designator. | |
160 | +includes an MS\-Windows drive designator. | |
160 | 161 | . |
161 | 162 | .PP |
162 | 163 | In the special case, |
@@ -165,13 +166,13 @@ where | ||
165 | 166 | is specified as |
166 | 167 | .I exactly |
167 | 168 | two identical directory separator characters, |
168 | -with no MS\-Windows(\(tm) drive designator, | |
169 | +with no MS\-Windows drive designator, | |
169 | 170 | and no following path name, |
170 | -.B dirname | |
171 | +.BR \%dirname () | |
171 | 172 | returns |
172 | 173 | .I path |
173 | 174 | unchanged; |
174 | -.B basename | |
175 | +.BR \%basename () | |
175 | 176 | normalises the return string to only a single character, |
176 | 177 | either |
177 | 178 | .RB \(dq / \(dq |
@@ -182,27 +183,27 @@ matching the characters used to specify | ||
182 | 183 | . |
183 | 184 | .PP |
184 | 185 | Concatenating the string returned by |
185 | -.BR dirname , | |
186 | +.BR \%dirname (), | |
186 | 187 | a |
187 | 188 | .RB \(dq / \(dq |
188 | 189 | or a |
189 | 190 | .RB \(dq \e \(dq, |
190 | 191 | and the string returned by |
191 | -.B basename | |
192 | +.BR \%basename () | |
192 | 193 | yields a complete path name. |
193 | 194 | . |
194 | 195 | .PP |
195 | 196 | The |
196 | -.B dirname | |
197 | +.BR \%dirname () | |
197 | 198 | and |
198 | -.B basename | |
199 | +.BR \%basename () | |
199 | 200 | functions conform generally to SUSv3, |
200 | 201 | extended to accommodate the handling of |
201 | 202 | .RB \(dq / \(dq |
202 | 203 | and |
203 | 204 | .RB \(dq \e \(dq |
204 | 205 | as alternative directory separator characters, |
205 | -and also to accommodate the likelihood of MS\-Windows(\(tm) | |
206 | +and also to accommodate the likelihood of MS\-Windows | |
206 | 207 | drive designators appearing in any path name specification. |
207 | 208 | The example, |
208 | 209 | which follows, |
@@ -213,9 +214,9 @@ and also the effects of the extended behaviour. | ||
213 | 214 | .SH EXAMPLE |
214 | 215 | . |
215 | 216 | To verify the behaviour of the |
216 | -.B dirname | |
217 | +.BR \%dirname () | |
217 | 218 | and |
218 | -.B basename | |
219 | +.BR \%basename () | |
219 | 220 | functions, |
220 | 221 | the test program defines the following function:\(em |
221 | 222 | . |
@@ -241,16 +242,16 @@ void result( char *path ) | ||
241 | 242 | .RE |
242 | 243 | .PP |
243 | 244 | This illustrates the correct use of the |
244 | -.B dirname | |
245 | +.BR \%dirname () | |
245 | 246 | and the |
246 | -.B basename | |
247 | +.BR \%basename () | |
247 | 248 | functions, |
248 | 249 | with copies of the original |
249 | 250 | .I path |
250 | 251 | string being passed in the function calls. |
251 | 252 | Note that the return values from each function are used immediately, |
252 | 253 | in the |
253 | -.B printf | |
254 | +.BR printf () | |
254 | 255 | call, |
255 | 256 | and the temporary copies of |
256 | 257 | .I path |
@@ -260,9 +261,9 @@ before these go out of scope. | ||
260 | 261 | . |
261 | 262 | .PP |
262 | 263 | Calling this example function illustrates the effect of each of the |
263 | -.B dirname | |
264 | +.BR \%dirname () | |
264 | 265 | and |
265 | -.B basename | |
266 | +.BR \%basename () | |
266 | 267 | functions, |
267 | 268 | for various values of |
268 | 269 | .IR path . |
@@ -290,7 +291,7 @@ lw(15n) lw(10n) lw(10n). | ||
290 | 291 | . |
291 | 292 | .PP |
292 | 293 | Similarly, |
293 | -for the case where path names are expressed using the MS\-Windows(\(tm) | |
294 | +for the case where path names are expressed using the MS\-Windows | |
294 | 295 | .RB \(dq \e \(dq |
295 | 296 | directory separator notation, |
296 | 297 | calling the example function displays:\(em |
@@ -315,7 +316,7 @@ lw(15n) lw(10n) lw(10n). | ||
315 | 316 | . |
316 | 317 | .PP |
317 | 318 | and, |
318 | -when an MS\-Windows(\(tm) drive designator is also specified, | |
319 | +when an MS\-Windows drive designator is also specified, | |
319 | 320 | this becomes:\(em |
320 | 321 | .RS |
321 | 322 | .TS |
@@ -344,7 +345,7 @@ the special handling of path names which begin with | ||
344 | 345 | two directory separator characters, |
345 | 346 | and also that this special handling is suppressed |
346 | 347 | when these two characters are dissimilar, |
347 | -or when an MS\-Windows(\(tm) drive designator is specified:\(em | |
348 | +or when an MS\-Windows drive designator is specified:\(em | |
348 | 349 | .RS |
349 | 350 | .TS |
350 | 351 | tab(!); |
@@ -369,7 +370,7 @@ lw(15n) lw(10n) lw(10n). | ||
369 | 370 | .SH RETURN VALUE |
370 | 371 | . |
371 | 372 | The |
372 | -.B dirname | |
373 | +.BR \%dirname () | |
373 | 374 | function returns a pointer to a null terminated string, |
374 | 375 | which represents the directory path component of the passed |
375 | 376 | .I path |
@@ -380,7 +381,7 @@ normalised to a single separator at each level of directory nesting. | ||
380 | 381 | . |
381 | 382 | .PP |
382 | 383 | The |
383 | -.B basename | |
384 | +.BR \%basename () | |
384 | 385 | function |
385 | 386 | returns a pointer to a null terminated string, |
386 | 387 | which represents the rightmost element of the passed |
@@ -389,14 +390,14 @@ string, | ||
389 | 390 | with all trailing directory separator characters removed. |
390 | 391 | . |
391 | 392 | .PP |
392 | -If any MS\-Windows(\(tm) drive designator is specified in the input | |
393 | +If any MS\-Windows drive designator is specified in the input | |
393 | 394 | .I path |
394 | 395 | string, |
395 | 396 | it is included in the return value of the |
396 | -.B dirname | |
397 | +.BR \%dirname () | |
397 | 398 | function, |
398 | 399 | but not in that of the |
399 | -.B basename | |
400 | +.BR \%basename () | |
400 | 401 | function. |
401 | 402 | . |
402 | 403 | . |
@@ -408,9 +409,9 @@ None. | ||
408 | 409 | .SH CAVEATS AND BUGS |
409 | 410 | . |
410 | 411 | The |
411 | -.B dirname | |
412 | +.BR \%dirname () | |
412 | 413 | and |
413 | -.B basename | |
414 | +.BR \%basename () | |
414 | 415 | functions may modify the |
415 | 416 | .I path |
416 | 417 | string passed to them. |
@@ -425,9 +426,9 @@ Also note that, | ||
425 | 426 | since the |
426 | 427 | .I path |
427 | 428 | argument may be modified by the |
428 | -.B dirname | |
429 | +.BR \%dirname () | |
429 | 430 | or the |
430 | -.B basename | |
431 | +.BR \%basename () | |
431 | 432 | function call, |
432 | 433 | if you wish to preserve the original content of |
433 | 434 | .IR path , |
@@ -437,14 +438,14 @@ either function may return its result in a statically allocated buffer, | ||
437 | 438 | which may be overwritten on a subsequent function call. |
438 | 439 | .PP |
439 | 440 | Although the |
440 | -.B dirname | |
441 | +.BR \%dirname () | |
441 | 442 | and |
442 | -.B basename | |
443 | +.BR \%basename () | |
443 | 444 | functions parse path name strings, |
444 | 445 | they are basically just |
445 | 446 | .I string |
446 | 447 | functions. |
447 | -The presence of an MS\-Windows(\(tm) drive designator is determined | |
448 | +The presence of an MS\-Windows drive designator is determined | |
448 | 449 | by the appearance of a colon |
449 | 450 | .RB (\(dq : \(dq) |
450 | 451 | as the second character of the |
@@ -459,13 +460,13 @@ represents a valid path name. | ||
459 | 460 | . |
460 | 461 | .SH AUTHOR |
461 | 462 | . |
462 | -This manpage was written for the MinGW implementation of the | |
463 | -.B dirname | |
463 | +This manpage was written by \%Keith\ Marshall, | |
464 | +\%<keithmarshall@users.sourceforge.net>, to document the | |
465 | +.BR \%basename () | |
464 | 466 | and |
465 | -.B basename | |
466 | -functions by Keith\ Marshall, | |
467 | -<keithmarshall@users.sourceforge.net>. | |
468 | -It may copied, modified and redistributed, | |
467 | +.BR \%dirname () | |
468 | +functions as they have been implemented for the MinGW.org Project. | |
469 | +It may be copied, modified and redistributed, | |
469 | 470 | without restriction of copyright, |
470 | 471 | provided this acknowledgement of contribution by |
471 | 472 | the original author remains unchanged. |