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