pmap: restore a proper response when arguments missing

Ever since pmap was refactored via the reference below
(and sprinkled with those damn tabs), the response for
the absence of any argument has been an error message.

This patch restores the proper behavior ('usage' text)
and updates the dejagnu 'no arguments' expect pattern.

Reference(s):
commit d50884788d

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2013-03-16 00:00:00 -05:00 committed by Jaromir Capik
parent 088d77c3ae
commit f85439e42d
2 changed files with 5 additions and 2 deletions

3
pmap.c
View File

@ -994,6 +994,9 @@ int main(int argc, char **argv)
textdomain(PACKAGE); textdomain(PACKAGE);
atexit(close_stdout); atexit(close_stdout);
if (argc < 2)
usage(stderr);
while ((c = getopt_long(argc, argv, "xXrdqA:hVcC:nN:p", longopts, NULL)) != -1) while ((c = getopt_long(argc, argv, "xXrdqA:hVcC:nN:p", longopts, NULL)) != -1)
switch (c) { switch (c) {
case 'x': case 'x':

View File

@ -21,8 +21,8 @@ set pmap_ext_footer "\[ -\]+\\s+total kB\\s+\\d+(\\s+\[\\d-\]+){2,3}\\s*\$"
set test "pmap with no arguments" set test "pmap with no arguments"
spawn $pmap spawn $pmap
expect_pass "$test" "^\(lt-\)\?pmap: argument missing" #expect_pass "$test" "^\(lt-\)\?pmap: argument missing"
#expect_pass "$test" "^Usage: pmap \\\[-x | -d\\\] \\\[-q\\\] \\\[-A low,high\\\] pid\\.\\.\\.\\s+-x\\s+show details\\s+-d\\s+show offset and device number\\s+-q\\s+quiet; less header/footer info\\s+-V\\s+show the version number\\s+-A\\s+limit results to the given range\\s*" expect_pass "$test" "Usage:\\s+\(lt-\)?pmap \\\[options\\\] pid \\\[pid \.\.\.\\\]"
set test "pmap standard output" set test "pmap standard output"
spawn $pmap $mypid spawn $pmap $mypid