summaryrefslogtreecommitdiff
path: root/coreutils/stty.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-01 18:18:04 +0000
committerDenis Vlasenko2007-01-01 18:18:04 +0000
commitb2abef3e54de606ced5082d82e381dbafef1bf72 (patch)
tree9082c2b4d0091f108432b2a41b7ee33152c9240f /coreutils/stty.c
parente27f15615f93065265209e26ff07cf9b4ae8658c (diff)
downloadbusybox-b2abef3e54de606ced5082d82e381dbafef1bf72.zip
busybox-b2abef3e54de606ced5082d82e381dbafef1bf72.tar.gz
stty: fix width of a field for ppc32
sort: fix -u to match coreutils 6.3 msh: compile fix (my fault)
Diffstat (limited to 'coreutils/stty.c')
-rw-r--r--coreutils/stty.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 22784a2..b489414 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -158,13 +158,18 @@ static const char stty_dec [] = "dec";
/* Each mode */
struct mode_info {
- const char *name; /* Name given on command line */
- char type; /* Which structure element to change */
- char flags; /* Setting and display options */
- unsigned short mask; /* Other bits to turn off for this mode */
- unsigned long bits; /* Bits to set for this mode */
+ const char *name; /* Name given on command line */
+ char type; /* Which structure element to change */
+ char flags; /* Setting and display options */
+ /* were using short here, but ppc32 was unhappy: */
+ tcflag_t mask; /* Other bits to turn off for this mode */
+ tcflag_t bits; /* Bits to set for this mode */
};
+/* We can optimize it further by using name[8] instead of char *name */
+/* but beware of "if (info->name == evenp)" checks! */
+/* Need to replace them with "if (info == &mode_info[EVENP_INDX])" */
+
#define MI_ENTRY(N,T,F,B,M) { N, T, F, M, B }
static const struct mode_info mode_info[] = {
@@ -319,9 +324,9 @@ enum {
/* Control character settings */
struct control_info {
- const char *name; /* Name given on command line */
+ const char *name; /* Name given on command line */
unsigned char saneval; /* Value to set for 'stty sane' */
- unsigned char offset; /* Offset in c_cc */
+ unsigned char offset; /* Offset in c_cc */
};
/* Control characters */
@@ -968,9 +973,9 @@ static void set_mode(const struct mode_info *info, int reversed,
if (bitsp) {
if (reversed)
- *bitsp = *bitsp & ~((unsigned long)info->mask) & ~info->bits;
+ *bitsp = *bitsp & ~info->mask & ~info->bits;
else
- *bitsp = (*bitsp & ~((unsigned long)info->mask)) | info->bits;
+ *bitsp = (*bitsp & ~info->mask) | info->bits;
return;
}