- errbuf[0] = c;
- errbuf[1] = '\n';
- (void) write(STDERR_FILENO,argv[0],strlen(argv[0]));
- (void) write(STDERR_FILENO,s,strlen(s));
- (void) write(STDERR_FILENO,errbuf,sizeof errbuf);
+ char *ptr, outbuf[4096];
+
+ ptr = lutil_strncopy(outbuf, argv[0], sizeof(outbuf) - 2);
+ ptr = lutil_strncopy(ptr, s, sizeof(outbuf)-2 -(ptr-outbuf));
+ *ptr++ = c;
+ *ptr++ = '\n';
+#ifdef HAVE_EBCDIC
+ __atoe_l(outbuf, ptr - outbuf);
+#endif
+ (void) write(STDERR_FILENO,outbuf,ptr - outbuf);