Email:   


Home
In This Issue
Email a Friend
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.


BASIC SERVER TASKS
Coding Domino server tasks in C: beyond Windows
By Ian Cherrill

This article is part three in a series on coding Domino server tasks in C. If you haven't read the first two parts, you might be a little lost with this one, so you should go back and check them out. For the first article in this series, visit http://www.dominopower.com/issues/issue200012/coding001.html, and for the second article, visit http://www.dominopower.com/issues/issue200101/coding0101001.html.

Last month I took you through the source code for ACLHelp, a Domino server task written in C that lets you use the server console to add yourself into the ACL of a database as a manager.

Of course, in Windows it's possible to run the Notes client on the server and attempt to get manager access to a database you lost access to by mistake. It's not recommended, but it can be done. In UNIX it's even more of a problem, as there is no UNIX Notes client. So, can we make ACLHelp run on other platforms?

Because there isn't any Windows-specific code in ACLHelp, moving it to another platform is fairly straightforward. But there are a couple of things to remember. You'll notice I haven't used the // type of comment, which was introduced in the C++ language. It's not actually part of the original C language, and although Visual C++ and the Linux gcc compiler will accept it, others such as the IBM compilers on AIX will not. So you must stick to the /* and */ method of commenting code. There's also an additional library to include, as ctype.h is required in most programs on UNIX platforms.

Fortunately, Lotus uses a couple of flags to make it easy for us to #ifdef and #endif any changes. There's a generic UNIX flag to allow us to include "ctype.h" and make any UNIX-specific changes such as swapping \ for / in pathnames. There's also a platform-specific flag such as AIX or Linux, for example. This lets us specify any changes that are only for that one platform like this:

#ifdef UNIX
#include <ctype.h>
#endif

That way, the ctype.h library is only included on UNIX platforms. Incidentally, although Linux isn't technically UNIX, Lotus always includes the UNIX flag in the makefile of Linux programs, so changes made for UNIX generally apply to Linux too.

The code we used last month is ready to be compiled onto AIX or Linux. In case you're wondering, yes, there's only one change required to the source code, and that's the inclusion of <ctype.h> in the header file we've already discussed. Most Lotus code is inherently cross-platform, and unless you're making calls to the Win32 API (Application Programming Interface) or using some of the fairly complex Rich Text functions, you'll find it all works much the same way anywhere. Even the most notorious difference between Windows and UNIX is handled correctly by the Lotus software as the Windows-style back-slash is translated within Notes to the UNIX forward-slash, at least for Notes databases.





[ Next ]

-- Advertisement --

2-Minute Tutorials
How do I...

  • integrate MS Office or OpenOffice with Notes?
  • create cross-tab reports and charts?
  • print serial letters and mailing labels?
  • create PDFs in Lotus Notes?


Check out the 2-minute tutorials here.
-- Advertisement --

SECURTRAC - MONITOR AND CONTROL YOUR DOMINO ENVIRONMENT
When it comes to your business, how do you ensure compliance with SOX, HIPAA or other industry driven regulations? Use SecurTrac to monitor and audit the life cycle of all objects in your Domino environment.
  • Database Monitor
  • Mail Monitor
  • Domino Directory Monitor
  • Notes.ini File Monitor
  • Intrusion Detection Monitor


Click here for details and a free evaluation copy.
Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.