Jeffrey R. (Sydd) Souza
The obligatory "digger" logoIm Aufbau - A bunch of free C subroutines and utilities:

Legend


Coming SoonBasically, if you see the embossed ducky with an item (like at left) it means that item exists somewhere on my computer, I just have to fish it out and upload it to my page in a publicly usable form (i.e. I have to attach the disclaimer that saves my butt should you use one of my goodies to power your space vehicle & it runs out of gas half way to the moon).
My DuckyIf you see the full color ducky then it's a link to download the item (I hid the linkbox border around it, as it sullies my ducky).

Note: Items marked by an asterisk are utilities that are buildable to command line execuatbles. Those ending in .c or .h extension are simple source files. Don't worry, everything is supplied in source code form and, where applicable, makefiles are provided (see mkmk in the Shellscripts section).


Now Available!My Ducky[Added 9 Jan 1996] lcntc - A C/SQL/UIL Source Line of Code counter. Supports C source and include files, OSF/Motif UIL source, and SQL files (Sybase stored procedures, & any other similarly formatted SQL). Uses my and my colleagues' definition of what a line of code is (EVERYONE has their own definition & they're all right). Source code included so YOU decide the definition of a "line of code". To get your own gzipped (24.8K) self extracting shell archive copy of lcntc click on the ducky at the beginning of this paragraph.

Now Available!Now Available[Added 9 Jan 1996] mktags - A UIL/C tag generator that allows you to use names and ignore the numbers. Just keep a list of the names you use, and freely use them in C and UIL. You can re-sort the list anytime, then just run mktags & you get a C include file with define constants with the tag names, and a UIL include file with value definitions. Both files will have like tag names defined to the same value. To get your own gzipped (16.3K) self extracting shell archive copy of mktags click on the ducky at the beginning of this paragraph.

Now Available!Now Available[Added 10 Mar 1996] LLMacros_.h - Are you tired of having to rewrite & redebug linked list manipulation code every time you need it? This file is a collection of C macros used to create and maintain a linked list of any type. You supply a typedef that has, at a minimum, a pointer to that type named next. The structure can contain anything else you like and change as often you like without effecting these macros. To get your gzipped (5.8K) C binding (include file) click on the ducky at the beginning of this paragraph.

Now Available!Now Available[Added 10 Mar 1996] sydd.h - This is simply a collection of constants an macros, including some very useful debugging macros, that's in my standard bag of tricks. Some of my other sources may need some of this stuff, but it's handy in it's own right. To get your gzipped (6.5K) C binding (include file) click on the ducky at the beginning of this paragraph.

Now Available!Now Available[Added 10 Mar 1996] Libc_.h - This is a collection of ANSI prototypes for Unix libc.a routines. I used this as a reference when attempting to compile ANSI C compatible code in a non-ANSI environment (like SunOS 4.1.x which does not include ANSI prototypes to its system calls). To get your gzipped (4.1K) C binding (include file) click on the ducky at the beginning of this paragraph.

Now Available!Now Available[Added 10 Mar 1996] swapper.c - This unix filter (i.e. it takes from stdin and outputs to stdout) gives you the capability of doing any or all of the following bit/byte order swapping to a data file:

To get your gzipped (2.2K) C source click on the ducky at the beginning of this paragraph.

Now Available!Now Available[Added 10 Mar 1996] libsydd - A library of handy C string manipuation routines, etc. Snag the gzipped (12.8K) tar file (complete with Makefile) by clicking on the ducky at the beginning of this paragraph. Here's what's in there:

dump()
Hex and ASCII dump any block of memory to the file of your choosing. Handy debug utility. Like Unix od(1) octal dump in a C call. See also Filedump* & UnDump* below.
firstword()
Returns a value equal to the relative position of the first word of string src if string find is the first word in src, otherwise -1 is returned. For Example: stat = firstword(" hello sailor","hello"); returns 3 (it's hard to see but there are 3 spaces before the word hello in the first string) and stat = firstword("eat at joes","joes"); returns -1. The program skips over leading whitespace only in string src.
get_username()
Get the username of the owner of the current process. This is ONE of a few ways to do it.
emptyline()
Returns 0 if a string contains any non-whitespace characters [uses isspace()], non zero if it ONLY contains whitespace.
secondword()
Returns a value equal to the position of the second word in string src if string find is the 2nd word in src, otherwise -1 is returned. For Example: stat = secondword(" hello there sailor","there"); returns 9 and stat = secondword("eat at joes","eat"); returns -1. The program skips over leading whitespace in string src, then skips non-whitespace (the first word), then all whitespace before comparing. Leading whitespace in string find is not ignored.
s_isdigit()
String version of isdigit() macro - returns TRUE if all chars in input string cause isdigit() to return TRUE, FALSE otherwise.
strip_whitespace()
Strips whitespace from BOTH the beginning AND end of string.
s_toupper() & s_tolower()
Convert all the characters of lower/upper case respectively found in a string to upper/lower case respectively. Basically these are string versions of toupper() and tolower(). Everybody's written one; if YOU haven't, snag these.
s_truncate()
Truncates num bytes off the front of string str. Strings must be <= 255 characters (though, hey, you have the source - set the limit to what you want) & null terminated. If num > strlen(str) then str becomes a null string. [The reason for the s_ prefix is there's a UN*X routine by the name of truncate() that does something different.]
s_insert()
This routine inserts string ins at the beginning of string str, shifting str to the right as many characters as is needed. Kind of assumes that str has the room to hold string ins.


Now Available!Now Available[Added 10 Mar 1996]Filedump* & UnDump* - An alternative to Unix's OD and the poor man's hex binary file editor. Command line version of dump() from libsydd. Snag the gzipped (15.4K) tar file (complete with makefiles generated by mkmk) by clicking on the ducky at the beginning of this paragraph.

Now Available!Now Available[Added 10 Mar 1996]cursor_mgmt.c - This X Window System routine changes a screen's cursor either to a stop cursor or back to the screen's original cursor. This is based upon the put_up_stop flag that is passed in as an input argument. If the original cursor is put back up, all pending X events, except EXPOSE ones, are flushed without being dispatched. This is so that while the cursor is the stop cursor, the operator may do nothing in the current application. Snag the gzipped (1.3K) C source by clicking on the ducky at the beginning of this paragraph.

Now Available!Now Available[Added 10 Mar 1996]isolate_bits.c - Given any bit offset from an address (not limited to 1-8, 1-16, 1-32 - try bit offset 1056 for example, it doesn't matter) isolate any number of bits thereafter to any bit offset from any other address. If you do ANY bit manipulation of data, especially when the data starts at odd bit positions and exists as odd bit sizes, this rotuine handles them all. Comes with a bunch of macros for the more common uses. Snag the gzipped (2.3K) C source by clicking on the ducky at the beginning of this paragraph.

Now Available!Now Available[Added 11 Mar 1996]catlen.c - Performs the same function as a call to strcat but returns the length of the string concatenated to the original. Effectively it performs the following, although faster: stat=catlen(a,b); is the same as strcat(a,b); stat=strlen(b); (875 bytes gzipped)

Now Available!Now Available[Added 11 Mar 1996]spcncpy.c - Copies source to dest and fills with spaces to make dest a string of size characters in length. Sort of a strncpy() that not only guarantees that dest is size characters long when done, but that any length deficiencies in source are taken care of by space padding. (1.1K gzipped)

Now Available!Now Available[Added 13 Sep 1996]Combinatorics routines - Remember from statistics class the "n choose m" function. It tells you the number of combinations of m items from a set of N items. For example 4 choose 2 is 6 comprising the set {1,2 1,3 1,4 2,3 2,4 3,4}. These routines will give you the count up to 35 choose 17 for long int, and [I forget] for double. Also there's an iterative routine that will deliver you all the combinations in a set, one per call. I wrote this for a satellite orbit error calculation application. (2.5K gzipped)

Coming Soonjulian_day.c - No, not as in Day-of-Year. This returns the date in terms of the calendar setup by Julius Caeser way back when. The number returned is the number of days since noon 1/1/4713 BC and properly takes into account leap years and the Gregorian adjustment done in 1582 (when Oct 15 followed Oct 4). The value returned is a double so that you can use the fractional part to hold the time. I used this in a satellite orbit calculation to change the date/time to an easy to use number with an established epoch. See also calendar_day.c

Coming Sooncalendar_day.c - Returns Gregorian calendar month (1-12) day (1-31) and year (-4713 to -1, 1 to ????, yes there's no such thing as year 0 in the Gregorian calendar) given a Julian Calendar date. See also julian_day.c

Coming Soonisleapyear.c - Returns 0 if the year supplied is NOT a leap year, non-zero if it is. Since leap years were adopted in 1582 according to the Gregorian calendar, all years before this are not leap years.

Coming Soonday_of_year.c - Now THIS is the one that tells you the day of year (from 1-366) given a date. See also month_and_day_of_month.c

Coming Soonmonth_and_day_of_month.c - Given a day of year and yeaer, this returns the month and day of month corresponding to that day of year. See also day_of_year.c

Coming SoonDATE_TIME_T package - Provides definition of a C typedef (below) and utilities for manipulating dates in this format, including addition of a delta to a date (currently at the hour level of granularity but can go as fine as hundredths of a second), returning the system date/time in DATE_TIME_T format, comparing two DATE_TIME_T structures returning results in the strcmp() style, conversion of a DATE_TIME_T to string format, and validation of the contents of a DATE_TIME_T. Since the year field is held in a single byte, some convention would need to be decided upon when the century rolls over. On the project we used this, we decided that 1992 was the earliest date of any data on our project, so any year (0-99) less than 92 must require the century value 2000 be added, any in the range 92-99 must require 1900 be added. As we didn't expect the project to have a life for that long, this was more than adequate & kept the DATE_TIME_T size to 8 bytes while giving us granularity down to the hundredth of a second. The structure definition follows:
typedef struct DATE_TIME
{
unsigned char year;
unsigned char month;
unsigned char day;
unsigned char hour;
unsigned char minute;
unsigned char second;
unsigned char hsec;
unsigned char usage; /* DT_DATETIME, DT_DATEONLY, DT_TIMEONLY, DT_UNUSED */
} DATE_TIME_T;


... and many more little useful items from SyddWare.

To Contact SyddWare email info@syddware.com SyddWare MiniLogo

Jump to the Syte Map
SyteMap
SyddWare Logo DuckyPage © SyddWare, Jeffrey R. (Sydd) Souza *