do not write in strings: they could reside in ROM
This commit is contained in:
parent
3e0eb5d58a
commit
2684a45cc5
2 changed files with 18 additions and 18 deletions
|
@ -59,7 +59,6 @@ catch(trapno)
|
||||||
char *errmessage;
|
char *errmessage;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
register char *p, *s;
|
register char *p, *s;
|
||||||
char *q;
|
|
||||||
|
|
||||||
while (ep->errno != trapno && ep->errmes != 0) ep++;
|
while (ep->errno != trapno && ep->errmes != 0) ep++;
|
||||||
if (p = ep->errmes) {
|
if (p = ep->errmes) {
|
||||||
|
@ -68,8 +67,8 @@ catch(trapno)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int i = trapno;
|
int i = trapno;
|
||||||
|
static char q[] = "error number xxxxxxxxxxxxx";
|
||||||
|
|
||||||
q = "error number xxxxxxxxxxxxx";
|
|
||||||
p = &q[13];
|
p = &q[13];
|
||||||
s = buf;
|
s = buf;
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
#include <pc_err.h>
|
#include <pc_err.h>
|
||||||
#include <pc_file.h>
|
#include <pc_file.h>
|
||||||
|
|
||||||
#define MESLEN 30
|
|
||||||
#define PATHLEN 100
|
|
||||||
|
|
||||||
/* to make it easier to patch ... */
|
/* to make it easier to patch ... */
|
||||||
extern struct file *_curfil;
|
extern struct file *_curfil;
|
||||||
|
|
||||||
|
@ -97,8 +94,8 @@ _catch(erno) unsigned erno; {
|
||||||
char buf[20];
|
char buf[20];
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int j = erno;
|
int j = erno;
|
||||||
char *pp[10];
|
char *pp[11];
|
||||||
char mes[MESLEN];
|
char xbuf[100];
|
||||||
|
|
||||||
qq = pp;
|
qq = pp;
|
||||||
if (p = FILN)
|
if (p = FILN)
|
||||||
|
@ -107,14 +104,19 @@ _catch(erno) unsigned erno; {
|
||||||
*qq++ = _pargv[0];
|
*qq++ = _pargv[0];
|
||||||
|
|
||||||
while (ep->errno != erno && ep->errmes != 0) ep++;
|
while (ep->errno != erno && ep->errmes != 0) ep++;
|
||||||
p = &("xxxxx: "[5]);
|
p = buf;
|
||||||
|
s = xbuf;
|
||||||
if (i = LINO) {
|
if (i = LINO) {
|
||||||
*qq++ = ", ";
|
*qq++ = ", ";
|
||||||
do
|
do
|
||||||
*--p = i % 10 + '0';
|
*p++ = i % 10 + '0';
|
||||||
while (i /= 10);
|
while (i /= 10);
|
||||||
|
while (p > buf) *s++ = *--p;
|
||||||
}
|
}
|
||||||
*qq++ = p;
|
*s++ = ':';
|
||||||
|
*s++ = ' ';
|
||||||
|
*s++ = '\0';
|
||||||
|
*qq++ = xbuf;
|
||||||
if ((erno & ~037) == 0140 && (_curfil->flags&0377)==MAGIC) {
|
if ((erno & ~037) == 0140 && (_curfil->flags&0377)==MAGIC) {
|
||||||
/* file error */
|
/* file error */
|
||||||
*qq++ = "file ";
|
*qq++ = "file ";
|
||||||
|
@ -123,19 +125,18 @@ _catch(erno) unsigned erno; {
|
||||||
}
|
}
|
||||||
if (ep->errmes) *qq++ = ep->errmes;
|
if (ep->errmes) *qq++ = ep->errmes;
|
||||||
else {
|
else {
|
||||||
q = "error number xxxxxxxxxxxxx";
|
*qq++ = "error number ";
|
||||||
p = &q[13];
|
*qq++ = s;
|
||||||
s = buf;
|
p = buf;
|
||||||
if (j < 0) {
|
if (j < 0) {
|
||||||
j = -j;
|
j = -j;
|
||||||
*p++ = '-';
|
*s++ = '-';
|
||||||
}
|
}
|
||||||
do
|
do
|
||||||
*s++ = j % 10 + '0';
|
*p++ = j % 10 + '0';
|
||||||
while (j /= 10);
|
while (j /= 10);
|
||||||
while (s > buf) *p++ = *--s;
|
while (p > buf) *s++ = *--p;
|
||||||
*p = 0;
|
*s = 0;
|
||||||
*qq++ = q;
|
|
||||||
}
|
}
|
||||||
*qq++ = "\n";
|
*qq++ = "\n";
|
||||||
*qq = 0;
|
*qq = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue