Hi everyone,
I think I’ve found a way to get Samba 3.0.21c to compile on QNX6. Once I compiled it I did a:
make install
…and it seemed to install on my QNX6 box. Haven’t had a chance to see how well this build runs yet. Anyone else tried this yet? Here’s what I did to get the compile:
- Download 3.0.21c from www.samba.org
- Install autoconf from QNX 3rd party CD
- Install perl at /usr/bin
- Run from samba/source directory: ./autogen.sh
- Run ./configure
- Run make
Here I get 4 problems – and here’s how I fixed them:
-
Gawk error:
- Edit mkproto.sh
- Look for line with proto_src=…
- Replace \n with \012 in the tr command
-
Parse error before uint:
- Add the following to the beginning of proto.h just below the #define PROTO_H:
typedef unsigned int uint;
- Add the following to the beginning of proto.h just below the #define PROTO_H:
-
Error in auth_script.c
- Edit auth_script.c
- At the end of the file, remove #if/#else/#endif lines, but keep the source that’s inside those #if/#else/#endif lines.
-
strptime not found
- Append the following source to …/source/utils/pdbedit.c
#include <ctype.h>
#include <string.h>
#include <time.h>
#ifndef HAVE_STRPTIME
void lowercase_string(char * x)
{
while(*x != ‘\0’)
{
*x = (char)tolower((int)*x);
x++;
}
}
#define asizeof(a) (sizeof (a) / sizeof ((a)[0]))
struct dtconv {
char *abbrev_month_names[12];
char *month_names[12];
char *abbrev_weekday_names[7];
char *weekday_names[7];
char *time_format;
char *sdate_format;
char *dtime_format;
char *am_string;
char *pm_string;
char *ldate_format;
};
static struct dtconv En_US = {
{ “Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”,
“Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec” },
{ “January”, “February”, “March”, “April”,
“May”, “June”, “July”, “August”,
“September”, “October”, “November”, “December” },
{ “Sun”, “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat” },
{ “Sunday”, “Monday”, “Tuesday”, “Wednesday”,
“Thursday”, “Friday”, “Saturday” },
“%H:%M:%S”,
“%m/%d/%y”,
“%a %b %e %T %Z %Y”,
“AM”,
“PM”,
“%A, %B, %e, %Y”
};
char *
strptime(const char *buf_p, const char *fmt, struct _CSTD tm *tm)
{
char c, *ptr, *buf;
int i, j, len;
char bf[100] = {0};
char fm[100] = {0};
strncpy(fm,fmt,strlen(fmt));
ptr = fm;
strncpy(bf, buf_p,strlen(buf_p));
buf = bf;
while (*ptr != 0) {
if (*buf == 0)
break;
c = *ptr++;
if (c != '%') {
if (isspace(c))
while (*buf != 0 && isspace(*buf))
buf++;
else if (c != *buf++)
return 0;
continue;
}
c = *ptr++;
switch (c) {
case 0:
case '%':
if (*buf++ != '%')
return 0;
break;
case 'C':
buf = strptime(buf, En_US.ldate_format, tm);
if (buf == 0)
return 0;
break;
case 'c':
buf = strptime(buf, "%x %X", tm);
if (buf == 0)
return 0;
break;
case 'D':
buf = strptime(buf, "%m/%d/%y", tm);
if (buf == 0)
return 0;
break;
case 'R':
buf = strptime(buf, "%H:%M", tm);
if (buf == 0)
return 0;
break;
case 'r':
buf = strptime(buf, "%I:%M:%S %p", tm);
if (buf == 0)
return 0;
break;
case 'T':
buf = strptime(buf, "%H:%M:%S", tm);
if (buf == 0)
return 0;
break;
case 'X':
buf = strptime(buf, En_US.time_format, tm);
if (buf == 0)
return 0;
break;
case 'x':
buf = strptime(buf, En_US.sdate_format, tm);
if (buf == 0)
return 0;
break;
case 'j':
if (!isdigit(*buf))
return 0;
for (i = 0; *buf != 0 && isdigit(*buf); buf++) {
i *= 10;
i += *buf - '0';
}
if (i > 365)
return 0;
tm->tm_yday = i;
break;
case 'M':
case 'S':
if (*buf == 0 || isspace(*buf))
break;
if (!isdigit(*buf))
return 0;
for (j=0,i = 0; *buf != 0 && isdigit(*buf) && j<2; j++,buf++) {
i *= 10;
i += *buf - '0';
}
if (i > 59)
return 0;
if (c == 'M')
tm->tm_min = i;
else
tm->tm_sec = i;
if (*buf != 0 && isspace(*buf))
while (*ptr != 0 && !isspace(*ptr))
ptr++;
break;
case 'H':
case 'I':
case 'k':
case 'l':
if (!isdigit(*buf))
return 0;
for (j=0,i = 0; *buf != 0 && isdigit(*buf) && j<2; j++,buf++) {
i *= 10;
i += *buf - '0';
}
if (c == 'H' || c == 'k') {
if (i > 23)
return 0;
} else if (i > 11)
return 0;
tm->tm_hour = i;
if (*buf != 0 && isspace(*buf))
while (*ptr != 0 && !isspace(*ptr))
ptr++;
break;
case 'p':
len = strlen(En_US.am_string);
lowercase_string( buf );
if (strncmp(buf, En_US.am_string, len) == 0) {
if (tm->tm_hour > 12)
return 0;
if (tm->tm_hour == 12)
tm->tm_hour = 0;
buf += len;
break;
}
len = strlen(En_US.pm_string);
if (strncmp(buf, En_US.pm_string, len) == 0) {
if (tm->tm_hour > 12)
return 0;
if (tm->tm_hour != 12)
tm->tm_hour += 12;
buf += len;
break;
}
return 0;
case 'A':
case 'a':
for (i = 0; i < asizeof(En_US.weekday_names); i++) {
len = strlen(En_US.weekday_names[i]);
lowercase_string( buf );
if (strncmp(buf,
En_US.weekday_names[i],
len) == 0)
break;
len = strlen(En_US.abbrev_weekday_names[i]);
if (strncmp(buf,
En_US.abbrev_weekday_names[i],
len) == 0)
break;
}
if (i == asizeof(En_US.weekday_names))
return 0;
tm->tm_wday = i;
buf += len;
break;
case 'd':
case 'e':
if (!isdigit(*buf))
return 0;
for (j=0,i = 0; *buf != 0 && isdigit(*buf) && j<2; j++,buf++) {
i *= 10;
i += *buf - '0';
}
if (i > 31)
return 0;
tm->tm_mday = i;
if (*buf != 0 && isspace(*buf))
while (*ptr != 0 && !isspace(*ptr))
ptr++;
break;
case 'B':
case 'b':
case 'h':
for (i = 0; i < asizeof(En_US.month_names); i++) {
len = strlen(En_US.month_names[i]);
lowercase_string( buf );
if (strncmp(buf, En_US.month_names[i],len) == 0)
break;
len = strlen(En_US.abbrev_month_names[i]);
if (strncmp(buf,
En_US.abbrev_month_names[i],
len) == 0)
break;
}
if (i == asizeof(En_US.month_names))
return 0;
tm->tm_mon = i;
buf += len;
break;
case 'm':
if (!isdigit(*buf))
return 0;
for (j=0,i = 0; *buf != 0 && isdigit(*buf) && j<2; j++,buf++) {
i *= 10;
i += *buf - '0';
}
if (i < 1 || i > 12)
return 0;
tm->tm_mon = i - 1;
if (*buf != 0 && isspace(*buf))
while (*ptr != 0 && !isspace(*ptr))
ptr++;
break;
case 'Y':
case 'y':
if (*buf == 0 || isspace(*buf))
break;
if (!isdigit(*buf))
return 0;
for (j=0,i = 0; *buf != 0 && isdigit(*buf) && j<((c=='Y')?4:2); j++,buf++) {
i *= 10;
i += *buf - '0';
}
if (c == 'Y')
i -= 1900;
else if (i < 69) /*c=='y', 00-68 is for 20xx, the rest is for 19xx*/
i += 100;
if (i < 0)
return 0;
tm->tm_year = i;
if (*buf != 0 && isspace(*buf))
while (*ptr != 0 && !isspace(*ptr))
ptr++;
break;
}
}
return buf;
}
#endif /* ndef HAVE_STRPTIME */