diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2006-03-21 04:46:08 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-03-21 23:04:25 -0500 |
commit | 584fc6d111c34a9a2512f6c7652dff29232bf70d (patch) | |
tree | 80d67b3c6902eff8309106be6291dd84a14d8ab7 | |
parent | 00611c5cfc8dea0914c65134f62948a484780a30 (diff) |
[PATCH] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII
Add strne2a() which converts a string from EBCDIC to ASCII.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/lib/e2a.c | 10 | ||||
-rw-r--r-- | include/asm-powerpc/system.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/powerpc/lib/e2a.c b/arch/powerpc/lib/e2a.c index 4f88f4cc21e8..4b72ed8fd50e 100644 --- a/arch/powerpc/lib/e2a.c +++ b/arch/powerpc/lib/e2a.c | |||
@@ -103,4 +103,14 @@ unsigned char e2a(unsigned char x) | |||
103 | } | 103 | } |
104 | EXPORT_SYMBOL(e2a); | 104 | EXPORT_SYMBOL(e2a); |
105 | 105 | ||
106 | unsigned char* strne2a(unsigned char *dest, const unsigned char *src, size_t n) | ||
107 | { | ||
108 | int i; | ||
109 | |||
110 | n = strnlen(src, n); | ||
106 | 111 | ||
112 | for (i = 0; i < n; i++) | ||
113 | dest[i] = e2a(src[i]); | ||
114 | |||
115 | return dest; | ||
116 | } | ||
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index 41b7a5b3d701..65f5a7b2646b 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h | |||
@@ -171,6 +171,8 @@ extern u32 booke_wdt_period; | |||
171 | 171 | ||
172 | /* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */ | 172 | /* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */ |
173 | extern unsigned char e2a(unsigned char); | 173 | extern unsigned char e2a(unsigned char); |
174 | extern unsigned char* strne2a(unsigned char *dest, | ||
175 | const unsigned char *src, size_t n); | ||
174 | 176 | ||
175 | struct device_node; | 177 | struct device_node; |
176 | extern void note_scsi_host(struct device_node *, void *); | 178 | extern void note_scsi_host(struct device_node *, void *); |