Deleted Added
full compact
pwd.c (90458) pwd.c (90535)
1/*
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)pwd.c 8.3 (Berkeley) 4/1/94";
43#endif
44static const char rcsid[] =
1/*
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)pwd.c 8.3 (Berkeley) 4/1/94";
43#endif
44static const char rcsid[] =
45 "$FreeBSD: head/bin/pwd/pwd.c 90458 2002-02-10 05:56:36Z mike $";
45 "$FreeBSD: head/bin/pwd/pwd.c 90535 2002-02-11 18:38:54Z mike $";
46#endif /* not lint */
47
46#endif /* not lint */
47
48#include <sys/types.h>
48#include <sys/param.h>
49#include <sys/stat.h>
49#include <sys/stat.h>
50#include <sys/types.h>
50
51#include <err.h>
52#include <errno.h>
51
52#include <err.h>
53#include <errno.h>
53#include <limits.h>
54#include <stdio.h>
55#include <stdlib.h>
56#include <unistd.h>
54#include <stdio.h>
55#include <stdlib.h>
56#include <unistd.h>
57#include <sys/param.h>
58
59static char *getcwd_logical(void);
60void usage(void);
61
62int
63main(int argc, char *argv[])
64{
65 int Lflag, Pflag;
66 int ch;
67 char *p;
57
58static char *getcwd_logical(void);
59void usage(void);
60
61int
62main(int argc, char *argv[])
63{
64 int Lflag, Pflag;
65 int ch;
66 char *p;
68 char buf[PATH_MAX];
69
67
70 if (strcmp(getprogname(), "realpath") == 0) {
71 if (argc != 2)
72 usage();
73 if ((p = realpath(argv[1], buf)) == NULL)
74 err(1, "%s", argv[1]);
75 (void)printf("%s\n", p);
76 exit(0);
77 }
78
79 Lflag = Pflag = 0;
80 while ((ch = getopt(argc, argv, "LP")) != -1)
81 switch (ch) {
82 case 'L':
83 Lflag = 1;
84 break;
85 case 'P':
86 Pflag = 1;

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

102
103 exit(0);
104}
105
106void
107usage(void)
108{
109
68 Lflag = Pflag = 0;
69 while ((ch = getopt(argc, argv, "LP")) != -1)
70 switch (ch) {
71 case 'L':
72 Lflag = 1;
73 break;
74 case 'P':
75 Pflag = 1;

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

91
92 exit(0);
93}
94
95void
96usage(void)
97{
98
110 if (strcmp(getprogname(), "realpath") == 0)
111 (void)fprintf(stderr, "usage: realpath [path]\n");
112 else
113 (void)fprintf(stderr, "usage: pwd [-L | -P]\n");
99 (void)fprintf(stderr, "usage: pwd [-L | -P]\n");
114 exit(1);
115}
116
117static char *
118getcwd_logical(void)
119{
120 struct stat log, phy;
121 char *pwd;

--- 15 unchanged lines hidden ---
100 exit(1);
101}
102
103static char *
104getcwd_logical(void)
105{
106 struct stat log, phy;
107 char *pwd;

--- 15 unchanged lines hidden ---