Presumably you want to do this to avoid suid script restrictions. Here are a couple of options.
#!/usr/bin/perl die Usage: ldap-group [-p] trans \n" unless @ARGV; for my $arg(@ARGV) { die "Invalid $arg\n" unless $arg =~ m/^[A-Za-z]+$/; } exec("/opt/bin/techweb-changes.pl",@ARGV);
To do it in C it would be easiest to use a regex library
#include <regex.h> /* * Match string against the extended regular expression in * pattern, treating errors as no match. * * return 1 for match, 0 for no match */ int match(const char *string, char *pattern) { int status; regex_t re; if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) != 0) { return(0); /* report error */ } status = regexec(&re, string, (size_t) 0, NULL, 0); regfree(&re); if (status != 0) { return(0); /* report error */ } return(1); }
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: passing c agruments to Perl
by tachyon
in thread passing c agruments to Perl
by koryw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |