projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From Derek Price:
[gnulib.git]
/
lib
/
modechange.c
diff --git
a/lib/modechange.c
b/lib/modechange.c
index
8cec11d
..
991235b
100644
(file)
--- a/
lib/modechange.c
+++ b/
lib/modechange.c
@@
-1,7
+1,7
@@
/* modechange.c -- file mode manipulation
/* modechange.c -- file mode manipulation
- Copyright (C) 1989, 1990, 1997, 1998, 1999, 2001, 2003
Free Softwar
e
- Foundation, Inc.
+ Copyright (C) 1989, 1990, 1997, 1998, 1999, 2001, 2003
, 2004 Fre
e
+
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
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
@@
-33,13
+33,9
@@
#include "modechange.h"
#include <sys/stat.h>
#include "xstrtol.h"
#include "modechange.h"
#include <sys/stat.h>
#include "xstrtol.h"
+#include <stdbool.h>
#include <stddef.h>
#include <stddef.h>
-
-#if STDC_HEADERS
-# include <stdlib.h>
-#else
-char *malloc ();
-#endif
+#include <stdlib.h>
#if STAT_MACROS_BROKEN
# undef S_ISDIR
#if STAT_MACROS_BROKEN
# undef S_ISDIR
@@
-215,24
+211,21
@@
mode_compile (const char *mode_string, unsigned int masked_ops)
umask_value = umask (0);
umask (umask_value); /* Restore the old value. */
umask_value = umask (0);
umask (umask_value); /* Restore the old value. */
- --mode_string;
/* One loop iteration for each "ugoa...=+-rwxXstugo...[=+-rwxXstugo...]". */
/* One loop iteration for each "ugoa...=+-rwxXstugo...[=+-rwxXstugo...]". */
- do
+ for (;; mode_string++)
{
/* Which bits in the mode are operated on. */
mode_t affected_bits = 0;
/* `affected_bits' modified by umask. */
mode_t affected_masked;
/* Operators to actually use umask on. */
{
/* Which bits in the mode are operated on. */
mode_t affected_bits = 0;
/* `affected_bits' modified by umask. */
mode_t affected_masked;
/* Operators to actually use umask on. */
- unsigned ops_to_mask = 0;
+ unsigned
int
ops_to_mask = 0;
-
int
who_specified_p;
+
bool
who_specified_p;
- affected_bits = 0;
- ops_to_mask = 0;
/* Turn on all the bits in `affected_bits' for each group given. */
/* Turn on all the bits in `affected_bits' for each group given. */
- for (
++mode_string;; ++mode_string
)
+ for (
;; mode_string++
)
switch (*mode_string)
{
case 'u':
switch (*mode_string)
{
case 'u':
@@
-255,10
+248,10
@@
mode_compile (const char *mode_string, unsigned int masked_ops)
/* If none specified, affect all bits, except perhaps those
set in the umask. */
if (affected_bits)
/* If none specified, affect all bits, except perhaps those
set in the umask. */
if (affected_bits)
- who_specified_p =
1
;
+ who_specified_p =
true
;
else
{
else
{
- who_specified_p =
0
;
+ who_specified_p =
false
;
affected_bits = CHMOD_MODE_BITS;
ops_to_mask = masked_ops;
}
affected_bits = CHMOD_MODE_BITS;
ops_to_mask = masked_ops;
}
@@
-355,7
+348,11
@@
mode_compile (const char *mode_string, unsigned int masked_ops)
}
no_more_values:;
}
}
no_more_values:;
}
- } while (*mode_string == ',');
+
+ if (*mode_string != ',')
+ break;
+ }
+
if (*mode_string == 0)
return head;
invalid:
if (*mode_string == 0)
return head;
invalid: