Skip to content

Commit

Permalink
add basic args check to [string]
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Nov 30, 2009
1 parent 79d9ee8 commit 552913c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/PmTcl/commands/string.pm
@@ -1,4 +1,9 @@
our sub string($cmd, *@args) {
our sub string(*@args) {
if +@args <1 {
error('wrong # args: should be "string subcommand ?argument ...?"');
}
my $cmd := @args.shift();

if $cmd eq 'toupper' {
return pir::upcase(@args[0]);
} elsif $cmd eq 'compare' {
Expand All @@ -12,6 +17,8 @@ our sub string($cmd, *@args) {
} else {
return 1;
}
} else {
return 'XXX';
}
}

Expand Down

0 comments on commit 552913c

Please sign in to comment.