1 | .TH ATHDIR 1 "1 January 1995" |
---|
2 | .ds ]W MIT Athena |
---|
3 | .SH NAME |
---|
4 | athdir \- find machine specific directories using Athena conventions |
---|
5 | .SH SYNOPSIS |
---|
6 | .nf |
---|
7 | athdir \fIlockerpath\fR [\fItype\fR] |
---|
8 | |
---|
9 | athdir [-t \fItype\fR] [-p \fIlockerpath\fR ...] [-e] [-c] [-l] [-i | -d] |
---|
10 | [-r \fIrecsep\fR] [-f \fIformat\fR] [-s \fIsysname\fR] [-m \fImachtype\fR] |
---|
11 | .fi |
---|
12 | .SH DESCRIPTION |
---|
13 | \fIathdir\fR provides the most reliable way to determine the location |
---|
14 | in a locker of specific types of machine dependent files. While in C |
---|
15 | shell scripts the shell variable \fIbindir\fR is typically available, |
---|
16 | that information is not available in all environments (such as |
---|
17 | makefiles) and not necessarily as reliable, as it contains no |
---|
18 | intelligence. Similarly, while the environment variable |
---|
19 | \fIATHENA_SYS\fR is widely available, attempting to use it in |
---|
20 | makefiles or resource files may fail on older lockers that have not |
---|
21 | yet been upgraded to use the new conventions. (See \fIlockers\fR(7) |
---|
22 | for more information on locker directory conventions.) |
---|
23 | |
---|
24 | In the first invocation shown above, \fIathdir\fR does not accept |
---|
25 | command line options other than the two listed, and they must be in |
---|
26 | the listed order. If \fItype\fR is not specified, ``bin'' is assumed. |
---|
27 | |
---|
28 | In the second invocation above, no particular option is required, |
---|
29 | though at least one option is. \fItype\fR has no default value, and |
---|
30 | the options may be specified in any order. |
---|
31 | .SH EXAMPLES |
---|
32 | \fIathdir\fR may be used to find directories for any sort of machine |
---|
33 | dependent or potentially machine dependent files. In its most common |
---|
34 | form, it should be used to replace \fImachtype\fR(1) (as in |
---|
35 | ``/mit/locker/`machtype`bin''). For example, |
---|
36 | |
---|
37 | set path=($path `athdir /mit/locker`) |
---|
38 | |
---|
39 | will append ``/mit/locker/arch/pmax_ul4/bin'' to the user's search |
---|
40 | path if the locker supports that as the machine specific binary |
---|
41 | directory, or ``/mit/locker/decmipsbin'' otherwise. Note that in this |
---|
42 | case, no type argument is specified, so ``bin'' is assumed. The |
---|
43 | example is shorthand for using `athdir /mit/locker bin`. Similarly, |
---|
44 | one might have in one's .twmrc file: |
---|
45 | |
---|
46 | "meow" f.exec "`athdir /mit/sipb`/oneko &" |
---|
47 | |
---|
48 | to replace: |
---|
49 | |
---|
50 | "meow" f.exec "/mit/sipb/`machtype`bin/oneko &" |
---|
51 | |
---|
52 | The rest of this manual page will probably not be of interest to most |
---|
53 | users, but may be of interest to developers. |
---|
54 | |
---|
55 | Another useful application for \fIathdir\fR is in makefiles. For |
---|
56 | example, suppose you wish to build a program against the x11 locker. |
---|
57 | You might start with |
---|
58 | |
---|
59 | INCLUDES = `athdir /mit/x11 include` |
---|
60 | LIBS = `athdir /mit/x11 lib` |
---|
61 | |
---|
62 | to find the appropriate directories in the locker. For dependencies |
---|
63 | on multiple lockers, you might have |
---|
64 | |
---|
65 | INCLUDES = `athdir -t include -p /mit/motif /mit/x11` |
---|
66 | LIBS = `athdir -t lib -p /mit/motif /mit/x11` |
---|
67 | |
---|
68 | which might resolve to |
---|
69 | |
---|
70 | INCLUDES = /mit/motif/include /mit/x11/include |
---|
71 | LIBS = /mit/motif/sun4lib /mit/x11/arch/sun4m_53/lib |
---|
72 | |
---|
73 | Note that this example allows for the possibility of machine dependent |
---|
74 | include files as well as libraries. |
---|
75 | |
---|
76 | In general, \fItype\fRs are treated as random strings by |
---|
77 | \fIathdir\fR. \fIathdir\fR checks the locker first for |
---|
78 | arch/$ATHENA_SYS/\fItype\fR, then for `machtype`\fItype\fR, then |
---|
79 | finally for simply \fItype\fR. Exceptions to this rule are cases where |
---|
80 | a convention is never expected to be used, or where a convention is |
---|
81 | explicitly discouraged and has never been supported. Note that if any |
---|
82 | future conventions arise, \fIathdir\fR will know about them and act |
---|
83 | accordingly. Thus, in theory, the usage of \fIathdir\fR should be |
---|
84 | forward compatible, and is encouraged. |
---|
85 | .SH OPTIONS |
---|
86 | \fIathdir\fR provides a few options for modifying its default behavior |
---|
87 | and providing other useful information. |
---|
88 | .TP 8 |
---|
89 | .B \-e |
---|
90 | This option causes \fIathdir\fR to not engage in potentially annoying |
---|
91 | editorial behavior. It will not implement the above mentioned |
---|
92 | exceptions on conventions not expected or discouraged. |
---|
93 | .TP 8 |
---|
94 | .B \-c |
---|
95 | This option causes \fIathdir\fR to not check for the usage of |
---|
96 | different possible conventions, and simply return output in the form |
---|
97 | of currently favored convention (arch). This is useful, for example, |
---|
98 | in makefiles that may wish to ``\fImkdir\fR -p'' target directories. |
---|
99 | .TP 8 |
---|
100 | .B \-d |
---|
101 | This option, when used with \-c, tells \fIathdir\fR that you wish it |
---|
102 | to use the favored machine dependent directory convention when |
---|
103 | returning a pathname. \fIathdir\fR makes assumptions, based on |
---|
104 | \fItype\fR, what kind of directory should be returned. For example, if |
---|
105 | the \fItype\fR were ``include,'' \fIathdir\fR would ordinarily return |
---|
106 | something like ``/mit/locker/include.'' If you specify \-d, it would |
---|
107 | return ``/mit/locker/arch/$ATHENA_SYS/include'' instead. |
---|
108 | .TP 8 |
---|
109 | .B \-i |
---|
110 | This option, when used with \-c, tells \fIathdir\fR that you wish it |
---|
111 | to use the favored machine independent directory convention when |
---|
112 | returning a pathname. This is basically the reverse of the \-d option. |
---|
113 | \fIathdir\fR, when it does not recognize a \fItype\fR, assumes the |
---|
114 | type to be machine dependent, so \-i may be used to override that. |
---|
115 | .TP 8 |
---|
116 | .B \-l |
---|
117 | This option causes \fIathdir\fR to list the locations it would look |
---|
118 | for the \fItype\fR of directory requested, rather than looking in them |
---|
119 | and returning a single value. If a directory path is not specified, |
---|
120 | \fIathdir\fR will output a ``%p'' in its place; if a \fItype\fR is not |
---|
121 | specified, a ``%t'' will be output in its place, and all three above |
---|
122 | mentioned possibilities will be output. |
---|
123 | .TP 8 |
---|
124 | .B \-f \fIformat\fR |
---|
125 | This option passes a format string to \fIathdir\fR to be used as a |
---|
126 | style for searching for directories. It is used as the preferred |
---|
127 | path style, with the built-in styles as fallbacks. It makes the following |
---|
128 | substitutions: |
---|
129 | |
---|
130 | %p path (as passed by -p) |
---|
131 | %t type (as passed by -t) |
---|
132 | %s sysname |
---|
133 | %m machtype value |
---|
134 | |
---|
135 | For example, the arch convention uses the string %p/arch/%s/%t. |
---|
136 | .TP 8 |
---|
137 | .B \-r \fIrecsep\fR |
---|
138 | Specify the record separator when multiple paths are output. By default this |
---|
139 | is a newline. It may be useful to specify it to be a space or colon on |
---|
140 | various occasions. |
---|
141 | .TP 8 |
---|
142 | .B \-s \fIsysname\fR |
---|
143 | This option allows a command line override for the \fIATHENA_SYS\fR |
---|
144 | value used in generating new style machine directories. |
---|
145 | .TP 8 |
---|
146 | .B \-m \fImachtype\fR |
---|
147 | This option allows a command line override for the \fImachtype\fR |
---|
148 | value used in generating old style machine directories. |
---|
149 | .SH SEE ALSO |
---|
150 | machtype(1), lockers(7), mkdir(1) |
---|
151 | .SH AUTHOR |
---|
152 | Craig Fields, MIT Information Systems |
---|
153 | .br |
---|
154 | Copyright (c) 1995, Massachusetts Institute of Technology |
---|