Linux Tips #12



---------------------------------------------------------------

If you like Tip of the Day please share it with friends and 
co-workers, and encourage them to sign up! It's free. You can
unsubscribe or change your e-mail address at any time.

To subscribe to or unsubscribe from this newsletter:
* Use your browser to visit our Newsletter Subscription Center:
  http://www.winmag.com/subscribe/
* Scroll down to the Tip of the Day section.
* Click "Choose an option," and select Subscribe or Unsubscribe.
* Scroll to the top of the page, and type your e-mail address 
  in the "E-mail" field.
* Click the Submit button below your e-mail address.

Copyright 2000 CMP Media Inc. A service of Winmag.com.
http://www.winmag.com/

Distributed by MessageMedia Inc. - http://www.messagemedia.com

---------------------------------------------------------------


*1. THE POPT LIBRARY                 
        
While the getopt() and getopt_long() functions perform the basic
 operations of parsing command-line options, you can use the
 popt library in applications that need more sophisticated
 manipulation of command-line options. Popt is a free, open
 source library specifically developed for that purpose. It
 enables users to add new command-line options. In addition, it
 can read command-line options from any source (such as a file).
 You can download the popt library from: 

http://cvs.labs.redhat.com/lxr/source/popt


*2. THE POPT LIBRARY                 
        
While the getopt() and getopt_long() functions perform the basic
 operations of parsing command-line options, you can use the popt
 library in applications that need more sophisticated
 manipulation of command-line options. Popt is a free, open
 source library specifically developed for that purpose. It
 enables users to add new command-line options. In addition, it
 can read command-line options from any source (such as a file).
 You can download the popt library from: 

http://cvs.labs.redhat.com/lxr/source/popt


*3. THE GAWK SCRIPTING LANGUAGE                 
        
Gawk is GNU's version of the Awk scripting language, which is a
 powerful tool for performing pattern matching, record
 processing, file parsing, and other similar tasks. The following
 Web page provides information on Gawk distributions,
 installation, and bug reports.

http://www.debian.org/Packages/unstable/interpreters/gawk.html


*4. AMAYA: A FREE WYSIWYG HTML EDITOR/BROWSER                 
        
Amaya is a free browsing and authoring tool that can edit and
 display multiple documents simultaneously. Using its rich API,
 Amaya can be easily extended to support new features as well.
 Amaya is a free, open source tool. You can download it from 

http://www.w3.org/Amaya


*5. THE ENLIGHTENMENT WINDOW MANAGER                 
        
Enlightenment is a free, configurable window manager for the
 Linux desktop. Enlightenment enables you to control every aspect
 of how your Linux desktop looks and acts. The last stable
 release is always available at 

http://www.enlightenment.org


*6. GCC EXTENSIONS: THE __FUNCTION__ MACRO                 
        
In addition to the macros __DATE__, __LINE__, and __FILE__, which
 are defined by ANSI C, GCC also defines the macro __FUNCTION__.
 __FUNCTION__ is expanded as the actual name of the function in
 which it is used, which makes it useful for reporting runtime
 errors and assertions. For example, 
 
void do_something() 
{ 
  if (successful != OK) 
    printf("failed in %s", __FUNCTION__); 
  else 
  {/*...*/} 
}


*7. ADAPTIVE SERVER ENTERPRISE 11.9.2                 
        
Adaptive Server Enterprise (ASE) Development Kit version 11.9.2
 is now available for Linux. The package includes the standard
 features of ASE and all related connectivity components.
 Adaptive Server Enterprise 11.9.2 is offered free (but requires
 registration) from the Sybase ASE 11.9.2 download page: 

http://www.sybase.com:80/products/databaseservers/linux/linux1192_reg.html


*8. THE CRYSTAL SPACE 3D ENGINE                 
        
Crystal Space is a free and portable 3D engine written in C++ and
 distributed under GPL terms. It supports colored lights,
 portals, mirrors, reflecting surfaces, 3D sprites, scripting,
 8-bit, 16-bit, and 32-bit display support, and various hardware
 accelerators. You can find more detail about Crystal Space and
 download the latest release from 

http://crystal.linuxgames.com/


*9. SEEKABLE AND NONSEEKABLE FILES                 
        
Linux files can be divided into two major categories: seekable
 and nonseekable. In a seekable file, read and write operations
 may occur anywhere in the file. Furthermore, data can be re-read
 or overwritten in a seekable file. In contrast, a nonseekable
 file is a first-in/first-out data channel that does not support
 random access. Data cannot be re-read or overwritten in a
 nonseekable file. 

Sockets and pipes are instances of nonseekable files. Ordinary
 files and block devices are instances of seekable files.


*10. GIVE MEANINGFUL NAMES TO MAGIC NUMBERS                 
        
Magic numbers are arbitrary constant values that indicate array
 bounds, maximal number of open files, the size of a memory page,
 and similar environment and program-specific constants. Consider
 the following example: 

lseek(fd, n, 0); /* proceed n bytes from file's beginning */ 

The magical value 0 happens to indicate the beginning of the file
 on a particular platform. However, readers of this code have to
 guess what this magic number represents. Furthermore, the use of
 a hard-coded literal also compromises code portability, since on
 other implementations, the file's beginning can be indicated by
 another arbitrary number. 

The preferred method of handling magic numbers is to give them a
 meaningful name, which renders the code both more readable and
 easier to maintain: 

lseek(fd, n, SEEK_SET);  /* SEEK_SET is defined in stdio.h */
