Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

As a coding sample or for support staffs

SOLVED
Go to Solution
Valued Contributor

As a coding sample or for support staffs

Dear everyone,

 

Here is a coding sample using getpwnam, glob, chown C calls which has been tested under both Linux Fedora 17 and OpenVMS IA64 V8.3-1H1.

 

Executed as is, the program in the URL below is purely useless. It only serves the purpose on how to use the getpwnam, glob and chown or for support staffs willing a ready to use program to troubleshoot these C calls. You will find all details at:

http://vouters.dyndns.org/tima/Linux-OpenVMS-C-Implementing_chown.html

 

You will find all details at http://vouters.dyndns.org/tima/Linux-OpenVMS-C-Implementing_chown.html

 

In the hope this can help you in your daily work.

Regards,

Philippe

1 ACCEPTED SOLUTIONS
Valued Contributor

Re: As a coding sample or for support staffs

I just added the Windows environment to my Chown.java. Now both the the C and Java code indifferently run on Windows/OpenVMS/Linux. There two differences between the two codes. One is that the C version handles symlinks and fully dereferences them whereas the Java code is unable to (File class not designed for). The other is that the Java code indifferently accepts a Unix/OpenVMS/Windows input file syntax indifferently on Linux/OpenVMS/Windows.

 

Wish you fun with both codes.

Philippe

3 REPLIES
Highlighted
Valued Contributor

Re: As a coding sample or for support staffs

Dear everyone,

 

The same functionality using the Java language :

http://vouters.dyndns.org/tima/Linux-OpenVMS-Java-Implementing_chown_in_Java.html

This code sample serves the same purposes as its C counterpart.

 

It works on both Linux Fedora 17 and OpenVMS IA64 V8.3-1H1. It uses Java/JNA to interface the getpwnam, chown and perror C calls. Because it uses JNA which can't be built using Java 1.5,  this code only runs on OpenVMS Integrity servers.

 

Wish you fun with.

Yours truly,

Philippe

 

Valued Contributor

Re: As a coding sample or for support staffs

I just added the Windows environment to my Chown.java. Now both the the C and Java code indifferently run on Windows/OpenVMS/Linux. There two differences between the two codes. One is that the C version handles symlinks and fully dereferences them whereas the Java code is unable to (File class not designed for). The other is that the Java code indifferently accepts a Unix/OpenVMS/Windows input file syntax indifferently on Linux/OpenVMS/Windows.

 

Wish you fun with both codes.

Philippe

Valued Contributor

Re: As a coding sample or for support staffs

As a quick personal exercise, here is the equivalent in Perl of the C program. You will find the Perl code at http://vouters.dyndns.org/tima/Linux-Windows-Cygwin-Perl-Implementing_chown_in_Perl.html

 

Perl/VMS as shipped by HP being fairly old and not supporting symlinks, the code in URL above is totally unrunnable on OpenVMS using HP's provided software.

 

In the hope this work can interest someone.

Philippe