Source-code snippets by the derelict


  • These are all small, typically command-line utilities that I've found to be useful.
  • All are compiled using the MinGW compiler package. This is an excellent, *FREE* compiler package which is based on the GNU compiler, but links to Windows libraries.  MinGW is available from: http://www.mingw.org/
  • All are FREEWARE for any and all uses!!

    THE SOFTWARE
    ulocate - This was initially written for use under Linux, as a replacement for the obtuse find command.  It also works in Windows consoles.   ulocate searches all subdirectories below the specified starting point for any filename containing the provided string.  Optionally, it can also search the PATH for the same criteria.
    Last Update: November 14, 2009
    ULOCATE.EXE, Version 1.08
    Usage: ulocate [options] name_component start_path
    This program displays all filenames containing a specified
    name component, starting at directory [start_path].
    Default start_path is current location.
    
    options:
     -v  Verbose mode - show search paths
     -d  Debug mode - show other process information
     -l  follow symbolic links
     -w  match exact string (whole-word search)
    
     -p  Search for name_component in the directories in the PATH variable
         NOTE: This option replaces the normal ulocate functionality with
         alternate functionality.  In this mode, subdirectories are NOT searched!!
    			
    Download ulocate.cpp here
    printf2 - open-source implementation of printf/sprintf, with floating-point support, and no stdio.h dependencies
    Last Update: November 14, 2009
    Embedded firmware environments provide a variety of challenges to the software developer.  One of these challenges is that, typically, there is no "standard output" device to display messages on, so the archetypal printf function is not an option.  However, the sprintf function is often still very useful for generating formatted strings. Unfortunately, in most embedded environments, linking stdio libraries is not an option, so a non-stdio version of sprintf is very handy - but find such a function is very challenging, especially if floating-point support is required!!

    In 2002, Georges Menie distributed a version of printf which had no stdio/stdlib dependencies, and seems to support all of the various obtuse printf syntaxes.  His code is clean, short, efficient, and builds on modern gcc with almost no warnings!  Furthermore, it is distributed under LGPL, which means it can be used freely by anyone, for any purpose!  The only option missing from his function was floating-point support, which I need in my ARM9 implementation, so I added that capability to it.  This version has no dependencies on any standard headers or libraries.

    Updates:
    12/02/09 - fixed floating-point bug related to padding decimal portion with zeroes.

    Download printf2.c here
    C/C++ makefile-dependency generator
    Last Update: February 02, 2007
    This is the version of makedepend which is distributed with Xfree86.  It is Copyright (c) 1993, 1994, 1998 The Open Group and has a free-distribution message in each source file.  I made a couple of trivial changes to the source to make it compile with modern gcc, but otherwise it still works superbly and needs no changes.
    To use this utility, make the following changes to your makefile:

    1. Add this line to the end of the makefile:
    # DO NOT DELETE
    2. Add a rule for running makedepend:
    SRCS=file1.cpp file2.cpp file3.cpp
    depend:
      makedepend -I. $(SRCS)
    
    3. run
    make depend
    to update the dependencies.   That's it!! Your makefile now has the appropriate dependency list.

    Download the source code package here