1772
|
1 /* fixpath.c
|
|
2 Copyright (C) 1990, 1993 Rick Adams and Bob Billson
|
|
3
|
|
4 This file is part of the OS-9 UUCP package, UUCPbb.
|
|
5
|
|
6 This program is free software; you can redistribute it and/or modify
|
|
7 it under the terms of the GNU General Public License as published by
|
|
8 the Free Software Foundation; either version 2 of the License, or
|
|
9 (at your option) any later version.
|
|
10
|
|
11 This program is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 GNU General Public License for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with this program; if not, write to the Free Software
|
|
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
19
|
|
20 The author of UUCPbb, Bob Billson, can be contacted at:
|
|
21 bob@kc2wz.bubble.org or uunet!kc2wz!bob or by snail mail:
|
|
22 21 Bates Way, Westfield, NJ 07090
|
|
23 */
|
|
24
|
|
25 #include "uucp.h"
|
|
26
|
|
27 int fixpath (pathname)
|
|
28 char *pathname;
|
|
29 {
|
|
30 char string[200], user[40];
|
|
31
|
|
32 strcpy (string, pathname);
|
|
33
|
|
34 if (strncmp (pathname, "~/", 2) == 0)
|
|
35 {
|
|
36 /* relative to uucppublic */
|
|
37 sprintf (pathname, "%s/%s", pubdir, &string[2]);
|
|
38 }
|
|
39 else if (*pathname == '~')
|
|
40 {
|
|
41 /* relative to user directory */
|
|
42 getuser (user);
|
|
43 sprintf (pathname, "%s/%s/%s", userdir, user, &string[1]);
|
|
44
|
|
45 }
|
|
46 else if (*pathname == '/')
|
|
47 {
|
|
48 /* absolute path */
|
|
49 return;
|
|
50 }
|
|
51 else
|
|
52 {
|
|
53 /* relative to current directory */
|
|
54 }
|
|
55 }
|