|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done.
Native to Lotus Domino. The User Experience unseen for Lotus Domino.
Do more with less. Really.
See the possibilities Docova unleashes for Lotus Domino. |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|