summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/kanji.c36
-rw-r--r--source3/lib/time.c11
-rw-r--r--source3/lib/util.c4
3 files changed, 49 insertions, 2 deletions
diff --git a/source3/lib/kanji.c b/source3/lib/kanji.c
index 2027a344c2..d63798914e 100644
--- a/source3/lib/kanji.c
+++ b/source3/lib/kanji.c
@@ -693,7 +693,39 @@ static char *sj_to_hex(char *from, BOOL overwrite)
}
/*******************************************************************
- kanji/kana -> ":xx"
+ CAP <-> SJIS
+********************************************************************/
+/* ":xx" CAP -> a byte */
+static char *cap_to_sj(char *from, BOOL overwrite)
+{
+ char *sp, *dp;
+
+ sp = (char *) from;
+ dp = cvtbuf;
+ while (*sp) {
+ /*
+ * The only change between this and hex_to_sj is here. sj_to_cap only
+ * translates characters greater or equal to 0x80 - make sure that here
+ * we only do the reverse (that's why the strchr is used rather than
+ * isxdigit. Based on fix from ado@elsie.nci.nih.gov (Arthur David Olson).
+ */
+ if (*sp == hex_tag && (strchr ("89abcdefABCDEF", sp[1]) != NULL) && isxdigit (sp[2])) {
+ *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2]));
+ sp += 3;
+ } else
+ *dp++ = *sp++;
+ }
+ *dp = '\0';
+ if (overwrite) {
+ strcpy ((char *) from, (char *) cvtbuf);
+ return (char *) from;
+ } else {
+ return cvtbuf;
+ }
+}
+
+/*******************************************************************
+ kanji/kana -> ":xx" - CAP format.
********************************************************************/
static char *sj_to_cap(char *from, BOOL overwrite)
{
@@ -778,7 +810,7 @@ static int setup_string_function(int codes)
case CAP_CODE:
_dos_to_unix = sj_to_cap;
- _unix_to_dos = hex_to_sj;
+ _unix_to_dos = cap_to_sj;
break;
}
return codes;
diff --git a/source3/lib/time.c b/source3/lib/time.c
index f60af60c7a..62a7016994 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -499,3 +499,14 @@ time_t get_create_time(struct stat *st)
*/
return ret;
}
+
+/****************************************************************************
+ return the 'access time' under UNIX from a stat structure.
+ This function exists to allow modifications to be done depending
+ on what we want to return. Just return the normal atime (for now).
+****************************************************************************/
+
+time_t get_access_time(struct stat *st)
+{
+ return st->st_atime;
+}
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 1b9ed00c31..1d65269f95 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1990,6 +1990,10 @@ int write_socket(int fd,char *buf,int len)
ret = write_data(fd,buf,len);
DEBUG(6,("write_socket(%d,%d) wrote %d\n",fd,len,ret));
+ if(ret <= 0)
+ DEBUG(0,("write_socket: Error writing %d bytes to socket %d: ERRNO = %s\n",
+ len, fd, strerror(errno) ));
+
return(ret);
}