coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATCH: relpath


From: Jim Meyering
Subject: Re: PATCH: relpath
Date: Thu, 01 Dec 2011 12:07:00 +0100

Peng Yu wrote:
> I have submitted the patch long time ago as I was asked to add the
> patch. However, nobody really takes a look at it. I feel really sad.
> Could anybody take a look and see if it is above the quality criterion
> and let me know what I need to change so this small utility can be
> added to the repository?

First of all, you will need to complete some copyright assignment
paperwork.  Please follow these steps:

    http://git.sv.gnu.org/cgit/coreutils.git/tree/HACKING#n444

Pádraig Brady and I talked about this today, and he suggested
to call this new program realpath, and with usage like this:

    realpath --relative-start=DIR FILE ...

Yes, that would mean a little duplication with what readlink does,
but few people know that hidden within readlink they will find a
file-name canonicalization tool.  Having another more accessible
route to that functionality may justify the minimal duplication.

Another important difference.  This tool can process more than
one file name at a time.

-----------------------------------------
Feedback on your patch.

The copyright year should be 2011, not 2002-2011.

There are some important guidelines listed in HACKING.
Please read them carefully.

I reformatted the entire file using indent, per HACKING.

src/relpath.sh looks like the fine beginning of a test suite addition,
but does not belong in src/.  Instead, add a new test:,
tests/misc/relpath, and reference it from tests/Makefile.am.

We have to add relpath to the list of programs in src/Makefile.am.

You must ensure that compilation succeeds with --enable-gcc-warnings.
Currently it fails, due to this:
    relpath.c:68:1: error: no previous prototype for 
'remove_commonprefix_modify' [-Werror=missing-prototypes]
    cc1: all warnings being treated as errors
I fixed it by making that function "static".

For a build to succeed, you must create a one-line man/relpath.x file.
I did that.

po/POTFILES.in must include src/relpath.c.

"make syntax-check" must succeed.
------------------------------------
I've done the above to show you what's required.
That is only partial.  A complete patch would also update NEWS,
add documentation to coreutils.texi and add test cases to be
run by "make check".  See the addition of the nproc for a good example
of a complete patch:

commit 74cf4cb26dcecd36eb45dc00dbd4587d9dc24a2f
Author: Giuseppe Scrivano <address@hidden>
Date:   Sat Oct 31 18:59:50 2009 +0100

    nproc: A new program to count the available processors

    * AUTHORS: Add my name.
    * NEWS: Mention it.
    * README: Likewise.
    * bootstrap.conf (gnulib_modules): Add nproc.
    * doc/coreutils.texi (nproc invocation): Add nproc info.
    * man/Makefile.am (nproc.1): Add dependency.
    * man/nproc.x: New template.
    * man/.gitignore: Ignore generated man page.
    * po/POTFILES.in: Add src/nproc.c.
    * src/.gitignore: Exclude nproc.
    * src/Makefile.am (EXTRA_PROGRAMS): Add nproc.
    * src/nproc.c: New file.
    * tests/Makefile.am (TESTS): Add misc/nproc-{avail,positive}.
    * tests/misc/nproc-avail: New file.
    * tests/misc/nproc-positive: New file.

In addition to the name change and new --relative-start=DIR option,
here are other things that will be required:

    Use /* ... */ comments, not // ...
    Don't use "PATH" to mean "file or directory name", since it is too easily
      confused with the shell search path variable.
    Remove the --no-newline option.  It is not needed.
    Add the --zero-terminated (-z) option, which is required to handle
      file or directory names containing newlines.

Realize that the following patches are mostly for your reference,
since they all need to be changed to use realpath in place of "relpath".
With those, "make check" nearly passes:
The misc/help-version test needs to be taught how to use the new program.
There's no point in doing that now for relpath when it will be different
for realpath.

--------------------------------------------------------------------------
>From 824756b16c7a0fecde2ea15eb5b7901dae302cfa Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 1 Dec 2011 09:31:25 +0100
Subject: [PATCH 1/5] scripts: commit-msg: add relpath to the list of programs

* scripts/git-hooks/commit-msg: Add relpath.
---
 scripts/git-hooks/commit-msg |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/git-hooks/commit-msg b/scripts/git-hooks/commit-msg
index 22f595f..f461b3c 100755
--- a/scripts/git-hooks/commit-msg
+++ b/scripts/git-hooks/commit-msg
@@ -17,7 +17,7 @@ my @valid = qw(
     expr factor false fmt fold groups head hostid hostname id install
     join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp
     mv nice nl nohup nproc od paste pathchk pinky pr printenv printf
-    ptx pwd readlink rm rmdir runcon seq sha1sum sha224sum sha256sum
+    ptx pwd readlink relpath rm rmdir runcon seq sha1sum sha224sum sha256sum
     sha384sum sha512sum shred shuf sleep sort split stat stdbuf stty
     su sum sync tac tail tee test timeout touch tr true truncate tsort
     tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
--
1.7.8.rc4


>From a65254803b895c39c7d2cf8db3aadbe283c77a51 Mon Sep 17 00:00:00 2001
From: Peng Yu <address@hidden>
Date: Sun, 13 Nov 2011 19:12:08 -0600
Subject: [PATCH 2/5] relpath: new program

---
 src/relpath.c  |  196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/relpath.sh |   26 ++++++++
 2 files changed, 222 insertions(+), 0 deletions(-)
 create mode 100644 src/relpath.c
 create mode 100755 src/relpath.sh

diff --git a/src/relpath.c b/src/relpath.c
new file mode 100644
index 0000000..9e159e0
--- /dev/null
+++ b/src/relpath.c
@@ -0,0 +1,196 @@
+/* relpath -- derive the relative path a start path with respect to a target 
path.
+   Copyright (C) 2002-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Peng Yu */
+/* Modified from readlink.c */
+/* See relpath.sh for some examples. Manpage will be added later on. */
+
+#include <config.h>
+#include <stdio.h>
+#include <getopt.h>
+
+#include "system.h"
+#include "canonicalize.h"
+#include "error.h"
+#include "quote.h"
+
+/* The official name of this program (e.g., no `g' prefix).  */
+#define PROGRAM_NAME "relpath"
+
+#define AUTHORS proper_name ("Peng Yu")
+
+/* If true, do not output the trailing newline.  */
+static bool no_newline;
+
+static struct option const longopts[] =
+{
+  {"no-newline", no_argument, NULL, 'n'},
+  {GETOPT_HELP_OPTION_DECL},
+  {GETOPT_VERSION_OPTION_DECL},
+  {NULL, 0, NULL, 0}
+};
+
+  void
+usage (int status)
+{
+  if (status != EXIT_SUCCESS)
+    fprintf (stderr, _("Try `%s --help' for more information.\n"),
+        program_name);
+  else
+  {
+    printf (_("Usage: %s [OPTION]... PATH START\n"), program_name);
+    fputs (_("Print a relative path of PATH with respect to START\n\n"),
+        stdout);
+    fputs (_("\
+          -n, --no-newline              do not output the trailing newline\n\
+          "), stdout);
+    fputs (HELP_OPTION_DESCRIPTION, stdout);
+    fputs (VERSION_OPTION_DESCRIPTION, stdout);
+    emit_ancillary_info ();
+  }
+  exit (status);
+}
+
+  void
+remove_commonprefix_modify(const char **abspath1, const char **abspath2)
+{
+
+  const char *p1;
+  const char *p2;
+
+  for(p1=*abspath1, p2=*abspath2; ; ++p1, ++p2) {
+    if(*p1 == *p2) {
+      if(*p1 == '/') {
+        *abspath1=p1;
+        *abspath2=p2;
+        // /a/b/c
+        // /a/b/c
+        //     ^
+      } else if(!(*p1)) {
+        *abspath1=p1;
+        *abspath2=p2;
+        break;
+        // /a/b
+        // /a/b
+        //     ^
+      }
+    } else if((!(*p1) && *p2=='/')
+        || (!(*p2) && *p1=='/')) {
+      *abspath1=p1;
+      *abspath2=p2;
+      break;
+      // /a/b/c
+      // /a/b
+      //     ^
+    } else {
+      break;
+      // /a/b1
+      // /a/b2
+      //     ^
+    }
+  }
+}
+
+
+  int
+main (int argc, char **argv)
+{
+  int optc;
+
+  initialize_main (&argc, &argv);
+  set_program_name (argv[0]);
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
+
+  atexit (close_stdout);
+
+  while ((optc = getopt_long (argc, argv, "n", longopts, NULL)) != -1)
+  {
+    switch (optc)
+    {
+      case 'n':
+        no_newline = true;
+        break;
+        case_GETOPT_HELP_CHAR;
+        case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+      default:
+        usage (EXIT_FAILURE);
+    }
+  }
+
+  if (optind >= argc)
+  {
+    error (0, 0, _("missing operand"));
+    usage (EXIT_FAILURE);
+  }
+
+  const char *path = argv[optind++];
+
+  const char dot_path[]=".";
+
+  const char *start;
+  if (optind >= argc) {
+    start = dot_path;
+  } else {
+    start = argv[optind++];
+  }
+
+  if (optind < argc)
+  {
+    error (0, 0, _("extra operand %s"), quote (argv[optind]));
+    usage (EXIT_FAILURE);
+  }
+
+  char *abspath = canonicalize_filename_mode (path, CAN_MISSING);
+  char *absstart = canonicalize_filename_mode (start, CAN_MISSING);
+
+  //printf ("abspath=%s\n", abspath);
+  //printf ("absstart=%s\n", absstart);
+
+  const char *abspath_suffix=abspath;
+  const char *absstart_suffix=absstart;
+  remove_commonprefix_modify(&abspath_suffix, &absstart_suffix);
+
+  //printf("relpath=");
+  if(*absstart_suffix) {
+    ++absstart_suffix;
+    printf("%s", "..");
+    for(; *absstart_suffix; ++absstart_suffix) {
+      if(*absstart_suffix=='/') {
+        printf("%s", "/..");
+      }
+    }
+
+    printf("%s", abspath_suffix);
+  } else {
+    if(*abspath_suffix) {
+      printf("%s", ++abspath_suffix);
+    } else {
+      printf("%c", '.');
+    }
+  }
+
+  if(!no_newline) printf("\n");
+
+  //printf ("abspath_suffix=%s\n", abspath_suffix);
+  //printf ("absstart_suffix=%s\n", absstart_suffix);
+
+  free (abspath);
+  free (absstart);
+
+  return EXIT_SUCCESS;
+}
diff --git a/src/relpath.sh b/src/relpath.sh
new file mode 100755
index 0000000..956eb0f
--- /dev/null
+++ b/src/relpath.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+./relpath
+echo ====
+./relpath --version
+echo ====
+./relpath --help
+echo ====
+./relpath /1/2/3 ../u/v/w
+echo ====
+./relpath /tmp/b
+echo ====
+./relpath a/b a
+echo ====
+./relpath a a
+echo ====
+./relpath a a/c
+echo ====
+./relpath a/b a/c
+echo ====
+./relpath a/b/c z
+echo ====
+./relpath a x/y/z
+echo ====
+./relpath -n a x/y/z
+echo ====
--
1.7.8.rc4


>From 88f42ef2a18ed6508caefaf0d5751647c93711ee Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 1 Dec 2011 11:01:51 +0100
Subject: [PATCH 3/5] relpath: remove relpath.sh

---
 src/relpath.sh |   26 --------------------------
 1 files changed, 0 insertions(+), 26 deletions(-)
 delete mode 100755 src/relpath.sh

diff --git a/src/relpath.sh b/src/relpath.sh
deleted file mode 100755
index 956eb0f..0000000
--- a/src/relpath.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-./relpath
-echo ====
-./relpath --version
-echo ====
-./relpath --help
-echo ====
-./relpath /1/2/3 ../u/v/w
-echo ====
-./relpath /tmp/b
-echo ====
-./relpath a/b a
-echo ====
-./relpath a a
-echo ====
-./relpath a a/c
-echo ====
-./relpath a/b a/c
-echo ====
-./relpath a/b/c z
-echo ====
-./relpath a x/y/z
-echo ====
-./relpath -n a x/y/z
-echo ====
--
1.7.8.rc4


>From c0d66e4f950aa572a77b886f6dea6c58f0bef747 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 1 Dec 2011 10:39:58 +0100
Subject: [PATCH 4/5] relpath: indent --no-tabs

---
 src/relpath.c |  204 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 110 insertions(+), 94 deletions(-)

diff --git a/src/relpath.c b/src/relpath.c
index 9e159e0..38d843d 100644
--- a/src/relpath.c
+++ b/src/relpath.c
@@ -1,5 +1,5 @@
-/* relpath -- derive the relative path a start path with respect to a target 
path.
-   Copyright (C) 2002-2011 Free Software Foundation, Inc.
+/* relpath -- derive a directory-relative name for a file
+   Copyright (C) 2011 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -16,7 +16,6 @@

 /* Written by Peng Yu */
 /* Modified from readlink.c */
-/* See relpath.sh for some examples. Manpage will be added later on. */

 #include <config.h>
 #include <stdio.h>
@@ -35,77 +34,82 @@
 /* If true, do not output the trailing newline.  */
 static bool no_newline;

-static struct option const longopts[] =
-{
+static struct option const longopts[] = {
   {"no-newline", no_argument, NULL, 'n'},
   {GETOPT_HELP_OPTION_DECL},
   {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
 };

-  void
+void
 usage (int status)
 {
   if (status != EXIT_SUCCESS)
     fprintf (stderr, _("Try `%s --help' for more information.\n"),
-        program_name);
+             program_name);
   else
-  {
-    printf (_("Usage: %s [OPTION]... PATH START\n"), program_name);
-    fputs (_("Print a relative path of PATH with respect to START\n\n"),
-        stdout);
-    fputs (_("\
+    {
+      printf (_("Usage: %s [OPTION]... PATH START\n"), program_name);
+      fputs (_("Print a relative path of PATH with respect to START\n\n"),
+             stdout);
+      fputs (_("\
           -n, --no-newline              do not output the trailing newline\n\
           "), stdout);
-    fputs (HELP_OPTION_DESCRIPTION, stdout);
-    fputs (VERSION_OPTION_DESCRIPTION, stdout);
-    emit_ancillary_info ();
-  }
+      fputs (HELP_OPTION_DESCRIPTION, stdout);
+      fputs (VERSION_OPTION_DESCRIPTION, stdout);
+      emit_ancillary_info ();
+    }
   exit (status);
 }

-  void
-remove_commonprefix_modify(const char **abspath1, const char **abspath2)
+static void
+remove_commonprefix_modify (const char **abspath1, const char **abspath2)
 {
-
   const char *p1;
   const char *p2;

-  for(p1=*abspath1, p2=*abspath2; ; ++p1, ++p2) {
-    if(*p1 == *p2) {
-      if(*p1 == '/') {
-        *abspath1=p1;
-        *abspath2=p2;
-        // /a/b/c
-        // /a/b/c
-        //     ^
-      } else if(!(*p1)) {
-        *abspath1=p1;
-        *abspath2=p2;
-        break;
-        // /a/b
-        // /a/b
-        //     ^
-      }
-    } else if((!(*p1) && *p2=='/')
-        || (!(*p2) && *p1=='/')) {
-      *abspath1=p1;
-      *abspath2=p2;
-      break;
-      // /a/b/c
-      // /a/b
-      //     ^
-    } else {
-      break;
-      // /a/b1
-      // /a/b2
-      //     ^
+  for (p1 = *abspath1, p2 = *abspath2;; ++p1, ++p2)
+    {
+      if (*p1 == *p2)
+        {
+          if (*p1 == '/')
+            {
+              *abspath1 = p1;
+              *abspath2 = p2;
+              // /a/b/c
+              // /a/b/c
+              //     ^
+            }
+          else if (!(*p1))
+            {
+              *abspath1 = p1;
+              *abspath2 = p2;
+              break;
+              // /a/b
+              // /a/b
+              //     ^
+            }
+        }
+      else if ((!(*p1) && *p2 == '/') || (!(*p2) && *p1 == '/'))
+        {
+          *abspath1 = p1;
+          *abspath2 = p2;
+          break;
+          // /a/b/c
+          // /a/b
+          //     ^
+        }
+      else
+        {
+          break;
+          // /a/b1
+          // /a/b2
+          //     ^
+        }
     }
-  }
 }

-
-  int
+int
 main (int argc, char **argv)
 {
   int optc;
@@ -119,41 +123,44 @@ main (int argc, char **argv)
   atexit (close_stdout);

   while ((optc = getopt_long (argc, argv, "n", longopts, NULL)) != -1)
-  {
-    switch (optc)
     {
-      case 'n':
-        no_newline = true;
-        break;
-        case_GETOPT_HELP_CHAR;
-        case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
-      default:
-        usage (EXIT_FAILURE);
+      switch (optc)
+        {
+        case 'n':
+          no_newline = true;
+          break;
+          case_GETOPT_HELP_CHAR;
+          case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+        default:
+          usage (EXIT_FAILURE);
+        }
     }
-  }

   if (optind >= argc)
-  {
-    error (0, 0, _("missing operand"));
-    usage (EXIT_FAILURE);
-  }
+    {
+      error (0, 0, _("missing operand"));
+      usage (EXIT_FAILURE);
+    }

   const char *path = argv[optind++];

-  const char dot_path[]=".";
+  const char dot_path[] = ".";

   const char *start;
-  if (optind >= argc) {
-    start = dot_path;
-  } else {
-    start = argv[optind++];
-  }
+  if (optind >= argc)
+    {
+      start = dot_path;
+    }
+  else
+    {
+      start = argv[optind++];
+    }

   if (optind < argc)
-  {
-    error (0, 0, _("extra operand %s"), quote (argv[optind]));
-    usage (EXIT_FAILURE);
-  }
+    {
+      error (0, 0, _("extra operand %s"), quote (argv[optind]));
+      usage (EXIT_FAILURE);
+    }

   char *abspath = canonicalize_filename_mode (path, CAN_MISSING);
   char *absstart = canonicalize_filename_mode (start, CAN_MISSING);
@@ -161,30 +168,39 @@ main (int argc, char **argv)
   //printf ("abspath=%s\n", abspath);
   //printf ("absstart=%s\n", absstart);

-  const char *abspath_suffix=abspath;
-  const char *absstart_suffix=absstart;
-  remove_commonprefix_modify(&abspath_suffix, &absstart_suffix);
+  const char *abspath_suffix = abspath;
+  const char *absstart_suffix = absstart;
+  remove_commonprefix_modify (&abspath_suffix, &absstart_suffix);

   //printf("relpath=");
-  if(*absstart_suffix) {
-    ++absstart_suffix;
-    printf("%s", "..");
-    for(; *absstart_suffix; ++absstart_suffix) {
-      if(*absstart_suffix=='/') {
-        printf("%s", "/..");
-      }
+  if (*absstart_suffix)
+    {
+      ++absstart_suffix;
+      printf ("%s", "..");
+      for (; *absstart_suffix; ++absstart_suffix)
+        {
+          if (*absstart_suffix == '/')
+            {
+              printf ("%s", "/..");
+            }
+        }
+
+      printf ("%s", abspath_suffix);
     }
-
-    printf("%s", abspath_suffix);
-  } else {
-    if(*abspath_suffix) {
-      printf("%s", ++abspath_suffix);
-    } else {
-      printf("%c", '.');
+  else
+    {
+      if (*abspath_suffix)
+        {
+          printf ("%s", ++abspath_suffix);
+        }
+      else
+        {
+          printf ("%c", '.');
+        }
     }
-  }

-  if(!no_newline) printf("\n");
+  if (!no_newline)
+    printf ("\n");

   //printf ("abspath_suffix=%s\n", abspath_suffix);
   //printf ("absstart_suffix=%s\n", absstart_suffix);
--
1.7.8.rc4


>From a07ae3271fdd2aa1b099933a961319a2a5e055c4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 1 Dec 2011 10:59:03 +0100
Subject: [PATCH 5/5] relpath: add entries for the new program

* AUTHORS: Add an entry.
* README: Add an entry.
* src/Makefile.am:  Here, too.
* po/POTFILES.in: Here, too.
* man/relpath.x: Add one-line description.
* man/Makefile.am (relpath): Add dependency.
---
 AUTHORS         |    1 +
 README          |    4 ++--
 man/Makefile.am |    1 +
 man/relpath.x   |    4 ++++
 po/POTFILES.in  |    1 +
 src/Makefile.am |    1 +
 6 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 man/relpath.x

diff --git a/AUTHORS b/AUTHORS
index 0c15472..35ec686 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -62,6 +62,7 @@ printf: David MacKenzie
 ptx: François Pinard
 pwd: Jim Meyering
 readlink: Dmitry V. Levin
+relpath: Peng Yu
 rm: Paul Rubin, David MacKenzie, Richard M. Stallman, Jim Meyering
 rmdir: David MacKenzie
 runcon: Russell Coker
diff --git a/README b/README
index eaa5fb0..5da141d 100644
--- a/README
+++ b/README
@@ -10,8 +10,8 @@ The programs that can be built with this package are:
   [ arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp
   csplit cut date dd df dir dircolors dirname du echo env expand expr
   factor false fmt fold groups head hostid hostname id install join kill
-  link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
-  nproc od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
+  link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc
+  od paste pathchk pinky pr printenv printf ptx pwd readlink relpath rm rmdir
   runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
   sleep sort split stat stdbuf stty su sum sync tac tail tee test timeout
   touch tr true truncate tsort tty uname unexpand uniq unlink uptime users
diff --git a/man/Makefile.am b/man/Makefile.am
index 8733a35..f6b889d 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -92,6 +92,7 @@ printf.1:     $(common_dep)   $(srcdir)/printf.x      
../src/printf.c
 ptx.1:         $(common_dep)   $(srcdir)/ptx.x         ../src/ptx.c
 pwd.1:         $(common_dep)   $(srcdir)/pwd.x         ../src/pwd.c
 readlink.1:    $(common_dep)   $(srcdir)/readlink.x    ../src/readlink.c
+relpath.1:     $(common_dep)   $(srcdir)/relpath.x     ../src/relpath.c
 rm.1:          $(common_dep)   $(srcdir)/rm.x          ../src/rm.c
 rmdir.1:       $(common_dep)   $(srcdir)/rmdir.x       ../src/rmdir.c
 runcon.1:      $(common_dep)   $(srcdir)/runcon.x      ../src/runcon.c
diff --git a/man/relpath.x b/man/relpath.x
new file mode 100644
index 0000000..a49bd42
--- /dev/null
+++ b/man/relpath.x
@@ -0,0 +1,4 @@
+[NAME]
+relpath \- derive a directory-relative name for a file
+[DESCRIPTION]
+.\" Add any additional description here
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7301532..5920b0f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -99,6 +99,7 @@ src/printf.c
 src/ptx.c
 src/pwd.c
 src/readlink.c
+src/relpath.c
 src/remove.c
 src/rm.c
 src/rmdir.c
diff --git a/src/Makefile.am b/src/Makefile.am
index b0b7eb5..062edc0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -97,6 +97,7 @@ EXTRA_PROGRAMS = \
   ptx          \
   pwd          \
   readlink     \
+  relpath      \
   rm           \
   rmdir                \
   runcon       \
--
1.7.8.rc4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]