[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Argh! Sorry for the spam...
From: |
Brendan Byrd |
Subject: |
Argh! Sorry for the spam... |
Date: |
Thu, 02 Aug 2001 11:54:04 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010628 |
I try to run a "chmod 777 <thing>" command -without- the two new
switches and I realize that the if statement was broken. Sorry, but
this should be the last one. Again, the diff file contains the entire
patch.
--
Brendan Byrd (address@hidden)
System Administrator @ Mission Data
http://www.missiondata.com/
*** chmod-old.c Sun Nov 19 11:56:33 2000
--- chmod.c Thu Aug 2 11:50:00 2001
***************
*** 15,21 ****
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
! /* Written by David MacKenzie <address@hidden> */
#include <config.h>
#include <stdio.h>
--- 15,22 ----
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
! /* Written by David MacKenzie <address@hidden>
! -d/-D options by Brendan Byrd <address@hidden> */
#include <config.h>
#include <stdio.h>
***************
*** 53,58 ****
--- 54,71 ----
V_off
};
+ enum File_Dir
+ {
+ /* Include only files. */
+ FD_files,
+
+ /* Include only directories. */
+ FD_dirs,
+
+ /* Include both files and directories. */
+ FD_all
+ };
+
void strip_trailing_slashes ();
static int change_dir_mode PARAMS ((const char *dir,
***************
*** 68,74 ****
/* If nonzero, force silence (no error messages). */
static int force_silent;
! /* Level of verbosity. */
static enum Verbosity verbosity = V_off;
/* The argument to the --reference option. Use the owner and group IDs
--- 81,90 ----
/* If nonzero, force silence (no error messages). */
static int force_silent;
! /* Change only the permissions of files and/or directories. */
! static enum File_Dir files_dirs_only = FD_all;
!
! /* Level of verbosity. */
static enum Verbosity verbosity = V_off;
/* The argument to the --reference option. Use the owner and group IDs
***************
*** 85,90 ****
--- 101,108 ----
static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
+ {"dirsonly", no_argument, 0, 'd'},
+ {"filesonly", no_argument, 0, 'D'},
{"changes", no_argument, 0, 'c'},
{"silent", no_argument, 0, 'f'},
{"quiet", no_argument, 0, 'f'},
***************
*** 186,207 ****
}
#endif
! newmode = mode_adjust (file_stats.st_mode, changes);
!
! fail = chmod (file, newmode);
! saved_errno = errno;
!
! if (verbosity == V_high
! || (verbosity == V_changes_only
! && !fail && mode_changed (file, file_stats.st_mode)))
! describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
!
! if (fail)
! {
! if (force_silent == 0)
! error (0, saved_errno, _("changing permissions of %s"),
! quote (file));
! errors = 1;
}
if (recurse && S_ISDIR (file_stats.st_mode))
--- 204,230 ----
}
#endif
! if (files_dirs_only == FD_all
! || (files_dirs_only == FD_dirs && S_ISDIR (file_stats.st_mode))
! || (files_dirs_only == FD_files && !(S_ISDIR (file_stats.st_mode))))
! {
! newmode = mode_adjust (file_stats.st_mode, changes);
!
! fail = chmod (file, newmode);
! saved_errno = errno;
!
! if (verbosity == V_high
! || (verbosity == V_changes_only
! && !fail && mode_changed (file, file_stats.st_mode)))
! describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
!
! if (fail)
! {
! if (force_silent == 0)
! error (0, saved_errno, _("changing permissions of %s"),
! quote (file));
! errors = 1;
! }
}
if (recurse && S_ISDIR (file_stats.st_mode))
***************
*** 278,283 ****
--- 301,308 ----
-v, --verbose output a diagnostic for every file processed\n\
--reference=RFILE use RFILE's mode instead of MODE values\n\
-R, --recursive change files and directories recursively\n\
+ -d, --dirsonly Only change the permissions of directories\n\
+ -D, --filesonly Only change the permissions of files\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
***************
*** 314,320 ****
{
thisind = optind ? optind : 1;
! c = getopt_long (argc, argv, "RcfvrwxXstugoa,+-=", long_options, NULL);
if (c == -1)
break;
--- 339,345 ----
{
thisind = optind ? optind : 1;
! c = getopt_long (argc, argv, "DRcdfvrwxXstugoa,+-=", long_options,
NULL);
if (c == -1)
break;
***************
*** 354,359 ****
--- 379,390 ----
case 'c':
verbosity = V_changes_only;
break;
+ case 'd':
+ files_dirs_only = FD_dirs;
+ break;
+ case 'D':
+ files_dirs_only = FD_files;
+ break;
case 'f':
force_silent = 1;
break;
- Argh! Sorry for the spam...,
Brendan Byrd <=