Add files from parent branch HEAD:
[pkgsrcv2.git] / misc / dync / DESCR
1 The dync utility is a small, but quite useful utility, which allows
2 the use of C as a scripting language.  This can be quite useful
3 ****SOMETIMES****, allowing access to system calls and library functions
4 from the command line.  For example, there are occasions when I want
5 to see the struct stat for a directory entry, and want to be able to
6 access st_mtime values, without having to parse output from "ls -l".
7 A simple:
8
9 int main(int argc, char **argv)
10 {
11         struct stat     st;
12         if (stat(argv[1], &st) == 0) {
13                 printf("%lld\n", st.st_mtime);
14         }
15         exit(0);
16 }
17
18 will do the job.  If I was to try this by other means, I would either
19 have to install all of Perl, and then learn its idiosyncratic syntax,
20 or write a custom C program, which I would then have to compile on
21 each architecture I need.
22
23 This utility relies on there being a C compiler on the target machine,
24 and a working dlopen(3).