Deleted Added
full compact
pawd.c (42629) pawd.c (51292)
1/*
1/*
2 * Copyright (c) 1997-1998 Erez Zadok
2 * Copyright (c) 1997-1999 Erez Zadok
3 * Copyright (c) 1990 Jan-Simon Pendry
4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
5 * Copyright (c) 1990 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Jan-Simon Pendry at Imperial College, London.
10 *

--- 22 unchanged lines hidden (view full) ---

33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * %W% (Berkeley) %G%
40 *
3 * Copyright (c) 1990 Jan-Simon Pendry
4 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
5 * Copyright (c) 1990 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Jan-Simon Pendry at Imperial College, London.
10 *

--- 22 unchanged lines hidden (view full) ---

33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * %W% (Berkeley) %G%
40 *
41 * $Id: pawd.c,v 1.2 1998/12/27 06:24:50 ezk Exp $
41 * $Id: pawd.c,v 1.5 1999/09/08 23:36:40 ezk Exp $
42 *
43 */
44
45/*
46 * pawd is similar to pwd, except that it returns more "natural" versions of
47 * pathnames for directories automounted with the amd automounter. If any
48 * arguments are given, the "more natural" form of the given pathnames are
49 * printed.
50 *
51 * Paul Anderson (paul@ed.lfcs)
52 *
53 */
54
55#ifdef HAVE_CONFIG_H
56# include <config.h>
57#endif /* HAVE_CONFIG_H */
58#include <am_defs.h>
59#include <amq.h>
60
42 *
43 */
44
45/*
46 * pawd is similar to pwd, except that it returns more "natural" versions of
47 * pathnames for directories automounted with the amd automounter. If any
48 * arguments are given, the "more natural" form of the given pathnames are
49 * printed.
50 *
51 * Paul Anderson (paul@ed.lfcs)
52 *
53 */
54
55#ifdef HAVE_CONFIG_H
56# include <config.h>
57#endif /* HAVE_CONFIG_H */
58#include <am_defs.h>
59#include <amq.h>
60
61/* dummy variables */
62#if 0
63char *progname;
64char hostname[MAXHOSTNAMELEN];
65pid_t mypid;
66serv_state amd_state;
67int foreground, orig_umask;
68int debug_flags;
69#endif
70
71/* statics */
72static char *localhost="localhost";
73static char newdir[MAXPATHLEN];
74static char transform[MAXPATHLEN];
75
76static int
77find_mt(amq_mount_tree *mt, char *dir)
78{
79 while (mt) {
61/* statics */
62static char *localhost="localhost";
63static char newdir[MAXPATHLEN];
64static char transform[MAXPATHLEN];
65
66static int
67find_mt(amq_mount_tree *mt, char *dir)
68{
69 while (mt) {
80 if (STREQ(mt->mt_type, "link") || STREQ(mt->mt_type, "nfs")) {
70 if (STREQ(mt->mt_type, "link") ||
71 STREQ(mt->mt_type, "nfs") ||
72 STREQ(mt->mt_type, "nfsl")) {
81 int len = strlen(mt->mt_mountpoint);
82 if (NSTREQ(mt->mt_mountpoint, dir, len) &&
83 ((dir[len] == '\0') || (dir[len] == '/'))) {
84 char tmp_buf[MAXPATHLEN];
85 strcpy(tmp_buf, mt->mt_directory);
86 strcat(tmp_buf, &dir[len]);
87 strcpy(newdir, tmp_buf);
88 return 1;

--- 210 unchanged lines hidden ---
73 int len = strlen(mt->mt_mountpoint);
74 if (NSTREQ(mt->mt_mountpoint, dir, len) &&
75 ((dir[len] == '\0') || (dir[len] == '/'))) {
76 char tmp_buf[MAXPATHLEN];
77 strcpy(tmp_buf, mt->mt_directory);
78 strcat(tmp_buf, &dir[len]);
79 strcpy(newdir, tmp_buf);
80 return 1;

--- 210 unchanged lines hidden ---