[BACK]Return to xinstall.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / xinstall

Diff for /src/usr.bin/xinstall/xinstall.c between version 1.59 and 1.60

version 1.59, 2015/04/18 03:15:46 version 1.60, 2015/07/18 14:32:36
Line 49 
Line 49 
 #include <limits.h>  #include <limits.h>
 #include <sysexits.h>  #include <sysexits.h>
 #include <utime.h>  #include <utime.h>
   #include <libgen.h>
   
 #include "pathnames.h"  #include "pathnames.h"
   
Line 61 
Line 62 
   
 struct passwd *pp;  struct passwd *pp;
 struct group *gp;  struct group *gp;
 int dobackup, docompare, dodir, dopreserve, dostrip, safecopy;  int dobackup, docompare, dodest, dodir, dopreserve, dostrip, safecopy;
 int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;  int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
 char pathbuf[PATH_MAX], tempfile[PATH_MAX];  char pathbuf[PATH_MAX], tempfile[PATH_MAX];
 char *suffix = BACKUP_SUFFIX;  char *suffix = BACKUP_SUFFIX;
Line 90 
Line 91 
         char *flags, *to_name, *group = NULL, *owner = NULL;          char *flags, *to_name, *group = NULL, *owner = NULL;
   
         iflags = 0;          iflags = 0;
         while ((ch = getopt(argc, argv, "B:bCcdf:g:m:o:pSs")) != -1)          while ((ch = getopt(argc, argv, "B:bCcDdf:g:m:o:pSs")) != -1)
                 switch(ch) {                  switch(ch) {
                 case 'C':                  case 'C':
                         docompare = 1;                          docompare = 1;
Line 131 
Line 132 
                 case 's':                  case 's':
                         dostrip = 1;                          dostrip = 1;
                         break;                          break;
                   case 'D':
                           dodest = 1;
                           break;
                 case 'd':                  case 'd':
                         dodir = 1;                          dodir = 1;
                         break;                          break;
Line 168 
Line 172 
                 /* NOTREACHED */                  /* NOTREACHED */
         }          }
   
           if (dodest) {
                   char *dest = dirname(argv[argc - 1]);
                   if (dest == NULL)
                           errx(EX_OSERR, "cannot determine dirname");
                   install_dir(dest);
           }
   
         no_target = stat(to_name = argv[argc - 1], &to_sb);          no_target = stat(to_name = argv[argc - 1], &to_sb);
         if (!no_target && S_ISDIR(to_sb.st_mode)) {          if (!no_target && S_ISDIR(to_sb.st_mode)) {
                 for (; *argv != to_name; ++argv)                  for (; *argv != to_name; ++argv)
Line 603 
Line 614 
 usage(void)  usage(void)
 {  {
         (void)fprintf(stderr, "\          (void)fprintf(stderr, "\
 usage: install [-bCcdpSs] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner]\n             source ... target ...\n");  usage: install [-bCcDdpSs] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner]\n            source ... target ...\n");
         exit(EX_USAGE);          exit(EX_USAGE);
         /* NOTREACHED */          /* NOTREACHED */
 }  }

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60