Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
5dfb46e1
Commit
5dfb46e1
authored
Aug 26, 2011
by
Hisham Muhammad
Browse files
Stricter checks for command-line options
(thanks to Sebastian Pipping)
parent
7eeb52df
Changes
2
Show whitespace changes
Inline
Side-by-side
ChangeLog
View file @
5dfb46e1
...
...
@@ -4,6 +4,8 @@ What's new in version 0.9.1
* Option for counting CPUs from zero
(thanks to Sean Noonan)
* Meters update in every screen (no longer halting while on Setup, etc.)
* Stricter checks for command-line options
(thanks to Sebastian Pipping)
* BUGFIX: Support larger numbers for process times.
(thanks to Tristan Nakagawa for the report.)
* BUGFIX: Segfault in BarMeterMode_draw() for small terminal widths
...
...
htop.c
View file @
5dfb46e1
...
...
@@ -228,12 +228,14 @@ static void addUserToVector(int key, void* userCast, void* panelCast) {
Panel_add
(
panel
,
(
Object
*
)
ListItem_new
(
user
,
key
));
}
static
void
setUserOnly
(
const
char
*
userName
,
bool
*
userOnly
,
uid_t
*
userId
)
{
static
bool
setUserOnly
(
const
char
*
userName
,
bool
*
userOnly
,
uid_t
*
userId
)
{
struct
passwd
*
user
=
getpwnam
(
userName
);
if
(
user
)
{
*
userOnly
=
true
;
*
userId
=
user
->
pw_uid
;
return
true
;
}
return
false
;
}
static
inline
void
setSortKey
(
ProcessList
*
pl
,
ProcessField
sortKey
,
Panel
*
panel
,
Settings
*
settings
)
{
...
...
@@ -295,16 +297,25 @@ int main(int argc, char** argv) {
}
break
;
case
'd'
:
sscanf
(
optarg
,
"%d"
,
&
delay
)
;
if
(
sscanf
(
optarg
,
"%d"
,
&
delay
)
==
1
)
{
if
(
delay
<
1
)
delay
=
1
;
if
(
delay
>
100
)
delay
=
100
;
}
else
{
fprintf
(
stderr
,
"Error: invalid delay value
\"
%s
\"
.
\n
"
,
optarg
);
exit
(
1
);
}
break
;
case
'u'
:
setUserOnly
(
optarg
,
&
userOnly
,
&
userId
);
if
(
!
setUserOnly
(
optarg
,
&
userOnly
,
&
userId
))
{
fprintf
(
stderr
,
"Error: invalid user
\"
%s
\"
.
\n
"
,
optarg
);
exit
(
1
);
}
break
;
case
'C'
:
usecolors
=
0
;
break
;
default:
exit
(
1
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment