summaryrefslogtreecommitdiff
path: root/src/stty.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-04-04 09:38:47 +0000
committerJim Meyering <jim@meyering.net>1998-04-04 09:38:47 +0000
commit953c42bd52049ed9054e39c0b9655efd9ea5ad99 (patch)
treed7bec5d13011d47516f7139306dd6d14bf5b7a92 /src/stty.c
parent765122f55837d6ec835042d4c7b5029bbb082676 (diff)
downloadcoreutils-953c42bd52049ed9054e39c0b9655efd9ea5ad99.tar.xz
(valid_options): Parenthesize assignment in while expr.
(main): Remove dcl of unused `cp'.
Diffstat (limited to 'src/stty.c')
-rw-r--r--src/stty.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/stty.c b/src/stty.c
index 139b54add..e3a2a036f 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -669,7 +669,7 @@ valid_options (char *opt, const char *valid_opts,
if (*opt++ != '-')
return 0;
- while (ch = *opt)
+ while ((ch = *opt))
{
opt++;
if (strchr (valid_opts, ch))
@@ -681,7 +681,6 @@ valid_options (char *opt, const char *valid_opts,
return 1;
}
-
int
main (int argc, char **argv)
{
@@ -694,10 +693,10 @@ main (int argc, char **argv)
int recoverable_output;
int k;
int noargs = 1;
- char *file_name = NULL, *cp;
+ char *file_name = NULL;
int fd;
const char *device_name;
- const char *posixly_correct = getenv("POSIXLY_CORRECT");
+ const char *posixly_correct = getenv ("POSIXLY_CORRECT");
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -755,26 +754,26 @@ main (int argc, char **argv)
if (STREQ (argv[k], "--"))
{
argv[k] = 0;
- if (k < argc-1)
+ if (k < argc - 1)
noargs = 0;
break;
}
/* Handle "--file device" */
if (STREQ (argv[k], "--file"))
{
- argv[k+1] = 0;
+ argv[k + 1] = 0;
argv[k] = 0;
}
/* Handle "--all", "--save", and "--file=device" */
else if (STREQ (argv[k], "--all") ||
STREQ (argv[k], "--save") ||
- !strncmp(argv[k], "--file=", 7))
+ !strncmp (argv[k], "--file=", 7))
argv[k] = 0;
/* Handle "-a", "-ag", "-aF/dev/foo", "-aF /dev/foo", etc. */
- else if (valid_options(argv[k], "ag", "F"))
+ else if (valid_options (argv[k], "ag", "F"))
{
- if (STREQ (argv[k], "-file") || argv[k][strlen(argv[k])-1] == 'F')
- argv[k+1] = 0;
+ if (STREQ (argv[k], "-file") || argv[k][strlen (argv[k]) - 1] == 'F')
+ argv[k + 1] = 0;
argv[k] = 0;
}
/* Everything else must be a normal, non-option argument. */
@@ -800,7 +799,7 @@ mutually exclusive"));
{
int fdflags;
device_name = file_name;
- fd = open (device_name, O_RDONLY|O_NONBLOCK);
+ fd = open (device_name, O_RDONLY | O_NONBLOCK);
if (fd < 0)
error (1, errno, device_name);
if ((fdflags = fcntl (fd, F_GETFL)) == -1
@@ -1550,7 +1549,7 @@ display_all (struct termios *mode, int fd, const char *device)
#if VEOF == VMIN
if ((mode->c_lflag & ICANON) == 0
&& (STREQ (control_info[i].name, "eof")
- || STREQ(control_info[i].name, "eol")))
+ || STREQ (control_info[i].name, "eol")))
continue;
#endif
wrapf ("%s = %s;", control_info[i].name,