Re: As a coding sample or for support staffs (278 Views)
Reply
Valued Contributor
Ph Vouters
Posts: 198
Registered: ‎10-29-2010
Message 1 of 4 (594 Views)
Accepted Solution

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

Valued Contributor
Ph Vouters
Posts: 198
Registered: ‎10-29-2010
Message 2 of 4 (510 Views)

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
Ph Vouters
Posts: 198
Registered: ‎10-29-2010
Message 3 of 4 (407 Views)

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
Ph Vouters
Posts: 198
Registered: ‎10-29-2010
Message 4 of 4 (278 Views)

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

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.