[PATCH 1/19] ppc64: Add strne2a() to convert a string from EBCDIC to ASCII
Michael Ellerman
michael at ellerman.id.au
Tue Jul 26 18:58:39 EST 2005
This patch adds strne2a() which converts a string from EBCDIC to ASCII.
---
arch/ppc64/lib/e2a.c | 10 ++++++++++
include/asm-ppc64/system.h | 2 ++
2 files changed, 12 insertions(+)
Index: work/arch/ppc64/lib/e2a.c
===================================================================
--- work.orig/arch/ppc64/lib/e2a.c
+++ work/arch/ppc64/lib/e2a.c
@@ -105,4 +105,14 @@ unsigned char e2a(unsigned char x)
}
EXPORT_SYMBOL(e2a);
+unsigned char* strne2a(unsigned char *dest, const unsigned char *src, size_t n)
+{
+ int i;
+ n = min(n, strlen(src));
+
+ for (i = 0; i < n; i++)
+ dest[i] = e2a(src[i]);
+
+ return dest;
+}
Index: work/include/asm-ppc64/system.h
===================================================================
--- work.orig/include/asm-ppc64/system.h
+++ work/include/asm-ppc64/system.h
@@ -132,6 +132,8 @@ extern int mem_init_done; /* set on boot
/* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */
extern unsigned char e2a(unsigned char);
+extern unsigned char* strne2a(unsigned char *dest,
+ const unsigned char *src, size_t n);
extern struct task_struct *__switch_to(struct task_struct *,
struct task_struct *);
More information about the Linuxppc64-dev
mailing list