+void txxputheader(const char *c)
+{
+ int cnt = 0;
+
+ while(*c != 0) {
+ myputchar(*c);
+ cnt++;
+ c++;
+ }
+
+ while(cnt < 512) {
+ putchar('\0');
+ cnt++;
+ }
+}
+
+void txxputnameoffset(const char *c)
+{
+ int pos = 0;
+ int cnt = 0;
+ char b;
+ unsigned char *prefx;
+
+ prefx = prefix;
+
+ if(*prefx != 0) {
+ while(*prefx != 0) {
+ if(*prefx == '/') {
+ pos = cnt;
+ }
+ cnt++;
+ prefx++;
+ }
+
+ cnt--; // skip the leading dot of the filepath
+ }
+
+ while(*c != 0) {
+ if(*c == '/') {
+ pos = cnt;
+ }
+ cnt++;
+ c++;
+ }
+
+ pos += 2;
+
+ b = (pos & 0xFF00) >> 8;
+ putchar(b);
+ b = (pos & 0x00FF);
+ putchar(b);
+}
+
+void txxputstr(const char *c)
+{
+ int cnt = 0;
+ int pos;
+ unsigned char *prefx;
+
+ txxputnameoffset(c);
+
+ prefx = prefix;
+ fprintf(stderr, "prefix: '%s'\n", prefx);
+
+ if(*prefx != 0) {
+ while(*prefx != 0) {
+ myputchar('\0');
+ cnt++;
+
+ if(*prefx == '/')
+ putchar(separator);
+ else
+ myputchar(*prefx);
+ cnt++;
+
+ prefx++;
+ }
+
+ c++; // skip the leading dot
+ }
+
+ while(*c != 0) {
+ myputchar('\0');
+ cnt++;
+
+ if(*c == '/')
+ putchar(separator);
+ else
+ myputchar(*c);
+ cnt++;
+
+ c++;
+ }
+
+ while(cnt < 510) {
+ myputchar('\0');
+ cnt++;
+ }
+}
+
+void txxputcounter(int c)
+{
+ int b;
+
+ rewind(stdout);
+
+ b = (c & 0xFF000000) >> 24;
+ putchar(b);
+ b = (c & 0x00FF0000) >> 16;
+ putchar(b);
+ b = (c & 0x0000FF00) >> 8;
+ putchar(b);
+ b = (c & 0x000000FF);
+ putchar(b);
+}
+
+/* remove spaces at beginning and end of string */
+void trim(char *c)
+{
+ char *p;
+ /* remove spaces at beginning ... */
+ while(*c == ' ') {
+ p = c;
+ while(*p != '\0') {
+ *p = *(p + 1);
+ p++;
+ }
+ }
+ /* ... and end of string */
+ p = c + strlen(c);
+ while(--p > c && *p == ' ')
+ *p = '\0';
+}
+