New release of CRiSP ? Sunday, 28 November 2004  
Normally, new releases of CRiSP come out pretty frequently, maybe even weekly, in response to customer queries, bug fixes, improvements.

But the past 3 weeks has seen me grappling with SSH - missing public key exchange logic has caused me to upgrade to the latest PuTTY software and this in turn, has meant a re-integration, since PuTTY has changed so much. Just trying to get to the point where things work has been fiddly and tiring.

But its getting there, SSH behaviour of old is nearly working again, and there are a few new CRiSP enhancements and bug fixes waiting to go.

"set routines" will turn on a new mode to show the current function you are in - very useful and avoids having to do all the time.

More soon...

Posted at 21:23:46 by Paul Fox | Permalink
  NULL pointers Tuesday, 23 November 2004  
NULL pointers - a fact of life to C and C++ programmers. But what are they?

Well, typically in a program, zero is used to initialise a value to a default value. Pointers which are initialised with zero point to nothing - so a NULL pointer.

In C/C++, you need to manage memory carefully. If you allocate memory from the heap, then you will likely need to free it eventually (unless the program terminates). It is common to set the pointed to value to NULL.

If another piece of code assumes that pointer still points to memory and uses the pointer, then BOOM!

In high level languages like Perl, TCL, Python, memory is managed for you. So the concept of a null pointer doesn't exist.

But Perl does have an undefined value.

In C/C++, it would be typical to verify pointers before using them. In fact if this is done everywhere, then core dumps can be a thing of the past.

But thats not the end of the story...

Core dumps for C/C++ programs are common as a program evolves - assumptions about what a value holds at a point in time, may change as the code evolves. A routine is written that never gets a null pointer, so no check is necessary. But later on its called in a different way and the pointer is null.

So the way around this typically is to detect the null pointer and avoid causing a core dump.

In the end, the code is resilient to the null pointers in the same way Perl or TCL is.

But high level languages have different flaws, e.g. holding on to memory when you don't want to (memory consumption in languages like Perl and Java can be very high precisely because memory isn't managed by the programmer).

It doesn't really matter what language you use - each has its own quirks, and you get used to them.

Posted at 22:41:35 by Paul Fox | Permalink
  PuTTY - my first bug report! Monday, 22 November 2004  
I got my first bug report accepted by Simon Tatham - author of PuTTY today. Excellent product. As reported before, PuTTY is the current basis of CRiSP's SSH code.

Encryption software and algorithms are a pain - trying to debug whats wrong with code that doesn't core dump but deliberately generates random numbers is difficult - unless you have something else to compare to and have a regression suite.

Added to which SSH is a complex protocol (with two major variants - SSH1 and SSH2). PuTTY implements 'strange' (to me) co-routines to handle the nested state machines, and I feel unhappy trying to support and understand other peoples code.

As a programming practitioner, its my goal to maybe one day rewrite the code natively, in my own style. It doesn't really affect other people, just a private goal. SSH requires lots of encryption libraries (MD5, AES, Blowfish, DES) so its not for the faint-hearted.

PuTTY is excellent - a terminal emulator for remote access, along with lots of options. Everything that Microsoft should have built, but couldn't be bothered to.

Another package we support is CRT - again a powerful and flexible terminal emulator for Windows systems.

Maybe one day I'll port fcterm to Windows, but I have yet to see the point, since other people are doing such a good job on Windows.

Posted at 22:07:04 by Paul Fox | Permalink
  What laptop? Monday, 22 November 2004  
What laptop?! Theres so many to choose from and if you wait long enough, they are outdated and the price drops. This is good. But its impossible to buy the 'Ultimate machine' as it changes each month.

The best thing you can do to any machine is put minimum of 1GB of RAM into it. Processor speed (except for certain games) comes second. My 1.2GHz Pentium III has more than enough cpu power, and I really need a 3.6GHz Pentium M to make it worth upgrading.

What about screens? The primary attribute of any note book, and most manufacturers refuse to tell you what you get. I know what XGA is, but SXGA+, UWXGA? Silly people. I dont care if its 15.1" or 15.4". I want 1920x1200 or more.

Fortunately the most expensive laptops are those with the silly DVD widescreens. You lot can pay more for those, and the actual good laptops (subnotes and high resolution screens) are left to those who have real work to do :-)

Posted at 21:56:48 by Paul Fox | Permalink
  WinXP2 ? Monday, 22 November 2004  
Why does my laptop, after reinstalling WinXP and then WinXP2 no longer resume from hibernate properly?

God only knows. Microsoft certainly couldn't give a hoot. Between, Microsoft, nVidia, Dell, well, I have them in as high regard as the kitchen fitters who couldn't fit a kitchen properly. (FYI, OptiPlan in Farnham/Camberley...there I've said it). A bunch of incompetents, together with Microsoft.

And whats with the music industry? Film industry? So carefully scared of losing the inanimate objects of their warez. I can see some point in them suing everyone, as they have to take on the role of Marshalls in the Wild West. But they are trying to force new technology down peoples throats, such as DRM to ensure that people never actually own the property they have paid for. Gosh, life must be so tough for them.

Hollywood and the music industry has spent 100 years selling 'dreams' and now they are coming to steal them back. Good luck to them. I'm too old to play their silly games. I stopped buying any form of copy-protect CD - I had enough pain with SONY ATRAC and copying to and from a PC. In 10 years time, nothing will play these silly pieces of technology.

What becomes of your music collection or Photo collection, or Video collection when we hit Blu-Ray or its successor in 10-15 years, and WinXP is a distant dream and all your digital rights get sent to the trash heap along with your dated PC?

Posted at 21:53:12 by Paul Fox | Permalink
  Sun, Sun, Sun, ... oh well Tuesday, 16 November 2004  
Sun Solaris 10 are still in the news and will continue to be so for some time. Its not clear whether Solaris 10 is the saviour of Sun or not.

It certainly shouldn't be - never has anyone marketed an OS on technical merits like Sun have. Microsoft's OS upgrades have had real user improvements and stability over the years. Theres lots to like in Microsoft (and to hate!). But Sun have treated their followers dreadfully over the years.

Back in the late 80's/early 90's there was the compiler unbundling which received very stark reception from many SunOS/Solaris followers. Even today the compiler is vastly overpriced (especially as everyone has moved to Java...poor them :-) ).

Even Microsofts MSDN program - brilliant technical product, has waned in recent years. It used to be for a large wad of money, you got everything - Operating Systems, Compilers, Servers. You decided how much you wanted to pay and the basic MSDN library was a brilliant success.

Sun tried this for about one year and failed abysmally. How many times have I had to sign up to join some Sun program or not - it never remembers who I am, or what I have bought. Their website is a marketers dream and very difficult to navigate. (One loses the will to live on Sun's website).

Microsofts is a dream of stuff (too much alas).

Yet I still prefer Unix. I would never trust my data to a Microsoft operating system.


Because every OS revision and every application has decided that my data should be stored all over the disk, plus the dreaded registry. You cannot backup your data with a simple:

tar cf /dev/cdwriter .

No, you have to buy 3rd party software and hope the company stays in business for 10 years so you can read your backups.

Of course, with Cygwin, nearly everything detestable about Win XP is cured. (Except the dreaded registration program - XP's that is).

I wish Sun well, they're not as marketing-arrogant as they once were, and only time will tell.

Posted at 19:51:24 by Paul Fox | Permalink
  Solaris 10 Monday, 15 November 2004  
Today Sun finally released Sun Solaris 10. Possibly an exciting event. As a low level programmer, I look forward to playing with the new dtrace facility for tracing kernel events using a high level language.

I'll eventually get around to installing it - on a VMware session. Avoids having to dedicate a PC to the purposes of evaluation, and it might prove useful.

VMware is an excellent virtual machine architecture for running multiple x86 operating systems (such as Solaris, FreeBSD, OpenBSD, etc) on a Linux or WinXP machine. Especially good for a high powered laptop where sometimes I need one or the other.

That leaves Mac OS X - for which PearPC is a (free) alternative to get the 3 major categories of OS onto a single machine.

My preferred debugger is gdb. Microsoft's Visual Studio is an impressive feat, but its slow - slow on the fastest machines on the planet due to the bloat. Waiting 30 seconds to launch the debugger as it reads stuff from hard disk is silly. gdb - written nearly 20 years ago, now runs on machines 100+ times faster than the original 25MHz 80386's and is just so fast. Of course it lacks a decent GUI, but theres only a handle of commands to learn to do most types of debugging.

Then theres Valgrind - a Purify replacement for Linux. Not quite as polished as Purify (but then Purify cheats and has always been an enterprise solution). By the way, their prime patents run out some time towards the end of this decade, but by then, IBM will probably give it away for free, as we all switch to slower more bloated languages.

Posted at 22:50:28 by Paul Fox | Permalink
  Why write an editor? Saturday, 13 November 2004  
Why write an editor? Everyone does it. Writing an editor is an interesting intellectual exercise and is one of those applications that allows not only immediate feedback of effect and implementation, but can be used to write itself. Compilers come close in terms of inherent functionality - writing a compiler to compile itself. Maybe I should have done a compiler instead!

CRiSP started life as GRIEF, a pun on BRIEF. I have always been a Unix devotee (apart from when I was a DECsystem-10 devotee or a Z80 or a Z8000 devotee). And vi on Unix has pretty much remained unchanged - only the clone editors (VIM being one of the best), adding value.

For nearly 20 years or so, vi on SunOS and Solaris has remained unchanged, buggy, quirky and black on white. Only with the advent of Microsoft world domination and Microsoft's insistence on color, graphics, video have Sun seen any point in moving away from Unix's inherent black and whiteness.

GRIEF started out as a clone of BRIEF for Unix -- running on 80286 Unix systems (Microport I think was the grand mother of CRiSP).

A few years on and Underware, Inc (proprietors of BRIEF), that we change our name to avoid product confusion (they were going to release a Unix version of BRIEF after all). GRIEF was still in nappies at this stage.

So, CRiSP - a synonym for BRIEF and 5 characters long.

Now you know.

Posted at 22:26:21 by Paul Fox | Permalink
  SSH and setting it up Saturday, 13 November 2004  
Setting up SSH daemon on a Linux box requires a lot of fiddly hacking around. I have always resisted using SSH, since rlogin and X11 has done me fine for around 20 years or more (and I have written my own rlogin and telnet on numerous occasions a long while ago).

I am playing with these purely to figure out whats missing inside CRiSP and become more expert in it so I can support it.

OpenSSH is so typical of many Unix tools (and why CRiSP was born). A lot of power and flexibility and requires intimate knowledge of the source code and RFCs to even begin to understand what is going on.

Why does the Open Source community think this is acceptable? As much as I like Unix/Linux and dislike certain things about Microsoft, having to browse code and detailed implementations to even begin to understand whats going on is silly.

E.g. ever try figuring out why the SSH daemon cannot startup? Well, it needs to be root (pretty obvious). But if you forget, it doesn't tell you that, simply that it cannot find its config files. Duh!

Posted at 18:48:07 by Paul Fox | Permalink
  Decorating... Saturday, 13 November 2004  
Been painting and decorating today (lots to go). Keep thinking about the PuTTY issue.

As much as it's great having free and open source software in the world, in can be a nuisance when incorporating other peoples code into your software. You have to track their changes, and cope with the differing coding styles, and maybe their code isn't as portable as your own.

In the case of PuTTY, the version originally chosen didn't expect or allow multiple parallel SSH threads to run (hundreds of global variables).

This was solved in CRiSP by a context-switching mechanism. Later versions of PuTTY do incorporate parallel threads support, and this is different to my solution. The net result is that diffing the code releases results in lots of changes.

Posted at 14:04:56 by Paul Fox | Permalink
  fcterm -- color terminal emulators Friday, 12 November 2004  
CRiSP started life as a character mode editor. When I first learnt X-Windows programming, I wrote a color terminal emulator (monochrome xterms are soo boring, and its taken the likes of GNOME and KDE to push monochrome into X's history).

But I still persist with it even although there are more modern alternatives. Because it does exactly what I want it to do - small, efficient, runs character mode crisp, and has some very useful features (for me and programmers), like a very light-weight multiterminal approach. (You can download an older version from the main site).

Give it a try - its free.

Posted at 22:51:53 by Paul Fox | Permalink
  MacOS X Friday, 12 November 2004  
MacOS X...what can I say? Some people love it, some people prod it. I prod it. Its a nice OS and provides a quality feel to Unix systems, comparable to Windows, but its different. To an end user, its a great system.

To a programmer, well .. its just different .. but the same. Apple seem to be excelling themselves in providing lots of APIs (a rats nest of APIs really) which map to the same thing, and trying to figure out which API to use (Carbon, Cocoa, Quartz) is confusing for no easy to understand benefit.

At a later date I may chat about some of the issues which tweak my interest as a programmer.

Posted at 22:48:05 by Paul Fox | Permalink
  PuTTY & Pagent Friday, 12 November 2004  
For a while now CRiSP has supported SSH access over FTP (otherwise known as SFTP). This has worked well, and is useful in certain environments where FTP cannot work.

A few weeks ago a customer contacted me to tell me there was a problem with the SSH and he couldnt contact his server correctly. After going through the usual events, it transpired there is a hole in the implementation.

CRiSP uses internally the source code for PuTTY provide by Simon Tatham. In porting this to the environment for CRiSP - a number of changes needed to be made, but the whole PAGENT thing eluded me and a lot of code was stubbed out.

In summary, if you have to rely on public keys for logging into remote hosts, then this won't presently work in CRiSP. Bits of code are missing (replaced by stubs), and to get it to work either involves taking the PAGENT code (and ensuring it works on Unix properly) or rewriting with the sole aim of supporting CRiSP. (We don't need many of the advanced features, e.g. X11 Port forwarding anyhow).

Or, one could just rely on talking to the PuTTY's install of PAGENT. Or ... (to be filled in later when I know what I am going to do).

Posted at 22:13:31 by Paul Fox | Permalink
  Nanoblogger Friday, 12 November 2004  
Nanoblogger is a very cool piece of shell script which is used to create Web Blog entries, as shown by this blog itself. Its available from, and is very lightweight and simple in design, but powerful.

I have been meaning to do this for years, and now this has given me the impetus to try something out.

I have potential plans for a blog interface inside CRiSP (thats where you are going to do your editing after all).

Posted at 20:50:27 by Paul Fox | Permalink
  Hello .. and welcome Friday, 12 November 2004  
Welcome to the CRiSP Editor Blog. This blog will contain a mixture of information regarding CRiSP, software development, gadgets, or anything that interests me and you.

Posted at 20:41:56 by Paul Fox | Permalink
  Welcome to NanoBlogger! Sunday, 07 November 2004  

The basic syntax is: nb [-b blog_dir] [options]

How to ...
  • create a new weblog (directory) = nb -b [blog_dir] -a
  • create a new entry = nb -a
  • create a new category = nb -c new -a
  • create a new entry for a category = nb -c [cat_id] -a
  • list current entries = nb -l [current|all]
  • list categories = nb -l cat
  • list entries by category = nb -c [cat_id] -l [current|all]
  • edit an entry = nb -e [entry_id]
  • move an entry to a category = nb -c [cat_id] -m [entry_id]
  • delete an entry = nb -d [entry_id]
  • delete a category = nb -c [cat_id] -d cat
  • delete an entry from a category = nb -c [cat_id] -d [entry_id]
  • force update of weblog = nb -u [current|all|main]

Thank you for trying NanoBlogger. Please direct comments and suggestions to the mailing list or submit a bug report to the project page on

Posted at 18:52:16 by n1xt3r | Permalink