L.S.,

In order to give fileutils the functionality that I needed, I needed
to make some patches to the source. The main thing is that I added the
'-f/--force' option to mknod. 
The other is a minor cosmetic change on the verbosity of ln.
Hope you find the patch usefull.

Kind regards,
  Dirk-Jan Faber <[EMAIL PROTECTED]>
diff -rcN fileutils-4.1.6.orig/man/ln.1 fileutils-4.1.6/man/ln.1
*** fileutils-4.1.6.orig/man/ln.1       Sun Feb 17 18:20:11 2002
--- fileutils-4.1.6/man/ln.1    Tue Mar 19 12:58:03 2002
***************
*** 23,28 ****
--- 23,30 ----
  .PP
  Mandatory arguments to long options are mandatory for short options too.
  .TP
+ A statically linked version of ln is also available, named \fBsln\fR.
+ .TP
  \fB\-\-backup\fR[=\fICONTROL\fR]
  make a backup of each existing destination file
  .TP
diff -rcN fileutils-4.1.6.orig/man/mknod.1 fileutils-4.1.6/man/mknod.1
*** fileutils-4.1.6.orig/man/mknod.1    Sun Feb 17 18:20:11 2002
--- fileutils-4.1.6/man/mknod.1 Tue Mar 19 12:58:03 2002
***************
*** 15,20 ****
--- 15,23 ----
  \fB\-m\fR, \fB\-\-mode\fR=\fIMODE\fR
  set permission mode (as in chmod), not a=rw - umask
  .TP
+ \fB\-f\fR, \fB\-\-force\fR
+ force the creation of the device
+ .TP
  \fB\-\-help\fR
  display this help and exit
  .TP
diff -rcN fileutils-4.1.6.orig/src/ln.c fileutils-4.1.6/src/ln.c
*** fileutils-4.1.6.orig/src/ln.c       Sun Dec  2 23:18:01 2001
--- fileutils-4.1.6/src/ln.c    Tue Mar 19 12:58:03 2002
***************
*** 301,308 ****
    if (verbose)
      {
        printf ((symbolic_link
!              ? _("create symbolic link %s to %s")
!              : _("create hard link %s to %s")),
              quote_n (0, dest), quote_n (1, source));
        if (backup_succeeded)
        printf (_(" (backup: %s)"), quote (dest_backup));
--- 301,308 ----
    if (verbose)
      {
        printf ((symbolic_link
!              ? _("creating symbolic link %s to %s")
!              : _("creating hard link %s to %s")),
              quote_n (0, dest), quote_n (1, source));
        if (backup_succeeded)
        printf (_(" (backup: %s)"), quote (dest_backup));
diff -rcN fileutils-4.1.6.orig/src/mknod.c fileutils-4.1.6/src/mknod.c
*** fileutils-4.1.6.orig/src/mknod.c    Sun Dec  2 23:16:57 2001
--- fileutils-4.1.6/src/mknod.c Tue Mar 19 12:58:03 2002
***************
*** 15,31 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  
! /* Usage: mknod [-m mode] [--mode=mode] path {bcu} major minor
                make a block or character device node
!           mknod [-m mode] [--mode=mode] path p
                make a FIFO (named pipe)
  
     Options:
     -m, --mode=mode    Set the mode of created nodes to MODE, which is
                        symbolic as in chmod and uses the umask as a point of
                        departure.
  
!    David MacKenzie <[EMAIL PROTECTED]>  */
  
  #include <config.h>
  #include <stdio.h>
--- 15,36 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  
! /* Usage: mknod [-m mode] [--mode=mode] [-f] [--force] path {bcu} major minor
                make a block or character device node
!           mknod [-m mode] [--mode=mode] [-f] [--force] path p
                make a FIFO (named pipe)
  
     Options:
     -m, --mode=mode    Set the mode of created nodes to MODE, which is
                        symbolic as in chmod and uses the umask as a point of
                        departure.
+    -f, --force          Force the creation of the device.
  
!    David MacKenzie <[EMAIL PROTECTED]>
! 
!    Patch: 
!    12-03-2001: Dirk-Jan Faber <[EMAIL PROTECTED]>; added --force option.
! */
  
  #include <config.h>
  #include <stdio.h>
***************
*** 49,54 ****
--- 54,60 ----
  static struct option const longopts[] =
  {
    {"mode", required_argument, NULL, 'm'},
+   {"force", no_argument, NULL, 'f'},
    {GETOPT_HELP_OPTION_DECL},
    {GETOPT_VERSION_OPTION_DECL},
    {NULL, 0, NULL, 0}
***************
*** 73,78 ****
--- 79,87 ----
        fputs (_("\
    -m, --mode=MODE   set permission mode (as in chmod), not a=rw - umask\n\
  "), stdout);
+       fputs (_("\
+   -f, --force       force the creation of the device\n\
+ "), stdout);
        fputs (HELP_OPTION_DESCRIPTION, stdout);
        fputs (VERSION_OPTION_DESCRIPTION, stdout);
        fputs (_("\
***************
*** 95,100 ****
--- 104,110 ----
    struct mode_change *change;
    const char *specified_mode;
    int optc;
+   int force=0;
    mode_t node_type;
  
    program_name = argv[0];
***************
*** 106,112 ****
  
    specified_mode = NULL;
  
!   while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
      {
        switch (optc)
        {
--- 116,122 ----
  
    specified_mode = NULL;
  
!   while ((optc = getopt_long (argc, argv, "m:f", longopts, NULL)) != -1)
      {
        switch (optc)
        {
***************
*** 115,120 ****
--- 125,133 ----
        case 'm':
          specified_mode = optarg;
          break;
+       case 'f':
+         force=1;
+         break;
        case_GETOPT_HELP_CHAR;
        case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
        default:
***************
*** 198,203 ****
--- 211,217 ----
          error (1, 0, _("invalid device %s %s"), s_major, s_minor);
  #endif
  
+       if (force) unlink(argv[optind]);
        if (mknod (argv[optind], newmode | node_type, device) != 0)
          error (1, errno, "%s", quote (argv[optind]));
        }
***************
*** 213,218 ****
--- 227,233 ----
  major and minor device numbers may not be specified for fifo files"));
          usage (1);
        }
+       if (force) unlink(argv[optind]);
        if (mkfifo (argv[optind], newmode))
        error (1, errno, "%s", quote (argv[optind]));
  #endif

Reply via email to