From f85439e42d68cc0d488b98f83404d45c880cf66f Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sat, 16 Mar 2013 00:00:00 -0500 Subject: [PATCH] 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 d50884788df5a9706ecba6a0966f48ef8f213f41 Signed-off-by: Jim Warner --- pmap.c | 3 +++ testsuite/pmap.test/pmap.exp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pmap.c b/pmap.c index d21517ae..d24fc663 100644 --- a/pmap.c +++ b/pmap.c @@ -994,6 +994,9 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); + if (argc < 2) + usage(stderr); + while ((c = getopt_long(argc, argv, "xXrdqA:hVcC:nN:p", longopts, NULL)) != -1) switch (c) { case 'x': diff --git a/testsuite/pmap.test/pmap.exp b/testsuite/pmap.test/pmap.exp index eac9483c..ffbdb4f6 100644 --- a/testsuite/pmap.test/pmap.exp +++ b/testsuite/pmap.test/pmap.exp @@ -21,8 +21,8 @@ set pmap_ext_footer "\[ -\]+\\s+total kB\\s+\\d+(\\s+\[\\d-\]+){2,3}\\s*\$" set test "pmap with no arguments" spawn $pmap -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" "^\(lt-\)\?pmap: argument missing" +expect_pass "$test" "Usage:\\s+\(lt-\)?pmap \\\[options\\\] pid \\\[pid \.\.\.\\\]" set test "pmap standard output" spawn $pmap $mypid