9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.01.31.21.56.29; author jromine; state Exp;
19 date 90.04.05.15.32.04; author sources; state Exp;
24 date 90.04.05.14.49.26; author sources; state Exp;
29 date 90.02.06.13.09.03; author sources; state Exp;
34 date 90.02.06.13.06.03; author sources; state Exp;
48 @/* path.c - return a pathname */
50 static char ident[] = "@@(#)$Id: path.c,v 1.5 1992/01/31 21:56:29 jromine Exp jromine $";
57 #define NCWD (sizeof CWD - 1)
61 #define NPWD (sizeof PWD - 1)
66 static char *expath ();
70 char *path (name, flag)
77 if ((cp = expath (name, flag))
78 && (ep = cp + strlen (cp) - 1) > cp
87 static char *expath (name, flag)
95 if (flag == TSUBCWF) {
96 (void) sprintf (buffer, "%s/%s", m_getfolder (), name);
97 name = m_mailpath (buffer);
99 (void) sprintf (buffer, "%s/", m_maildir (""));
100 if (ssequal (buffer, name)) {
102 name = getcpy (name + strlen (buffer));
110 && (strncmp (name, CWD, NCWD)
111 && strcmp (name, DOT)
112 && strcmp (name, DOTDOT)
113 && strncmp (name, PWD, NPWD))))
114 return getcpy (name);
119 if (strcmp (name, DOT) == 0 || strcmp (name, CWD) == 0)
120 return getcpy (pwds);
122 ep = pwds + strlen (pwds);
123 if ((cp = rindex (pwds, '/')) == NULL)
129 if (strncmp (name, CWD, NCWD) == 0)
132 if (strcmp (name, DOTDOT) == 0 || strcmp (name, PWD) == 0) {
133 (void) sprintf (buffer, "%.*s", cp - pwds, pwds);
134 return getcpy (buffer);
137 if (strncmp (name, PWD, NPWD) == 0)
142 (void) sprintf (buffer, "%.*s/%s", cp - pwds, pwds, name);
143 return getcpy (buffer);
166 for (dp = cp; *dp == '/'; dp++)
168 (void) strcpy (cp--, dp);
172 if (strcmp (cp, DOT) == 0) {
178 if (strcmp (cp, DOTDOT) == 0) {
179 for (cp -= 2; cp > f; cp--)
187 if (strncmp (cp, PWD, NPWD) == 0) {
188 for (dp = cp - 2; dp > f; dp--)
193 (void) strcpy (dp, cp + NPWD - 1);
197 if (strncmp (cp, CWD, NCWD) == 0) {
198 (void) strcpy (cp - 1, cp + NCWD - 1);
223 static char ident[] = "@@(#)$Id: path.c,v 1.4 1990/04/05 15:32:04 sources Exp jromine $";
235 static char ident[] = "@@(#)$Id:$";
261 static char ident[] = "$Id:";