From 91518de1ef77306ffa150dc178090e6fe5fcaf6f Mon Sep 17 00:00:00 2001 From: NotFound Date: Wed, 17 Aug 2011 09:07:58 +0200 Subject: [PATCH] die nicely if opendir fails in example ls.pir --- examples/nci/ls.pir | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/nci/ls.pir b/examples/nci/ls.pir index 2f79322f84..3107fd8447 100644 --- a/examples/nci/ls.pir +++ b/examples/nci/ls.pir @@ -34,6 +34,16 @@ In this encarnation it works on linux i386 and amd64 systems. .local pmc curdir curdir = opendir(dirname_c) + unless null curdir goto opened + + .local pmc err + getstderr err + print err, "Cannot open directory '" + print err, dirname + print err, "'\n" + exit 1 + +opened: .local pmc entry .include "datatypes.pasm"