summaryrefslogtreecommitdiff
path: root/pico/osdep
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2017-11-20 23:24:58 -0700
committerEduardo Chappa <chappa@washington.edu>2017-11-20 23:24:58 -0700
commit570ada25db406ebe10d6aa454b4466fe47f34ff2 (patch)
treea7ac9f11de1490acfbce7f0ff7178da73cb79dad /pico/osdep
parent7fae026f633a89911e6be5bd2d7036a9face3557 (diff)
downloadalpine-570ada25db406ebe10d6aa454b4466fe47f34ff2.tar.xz
* Remove bell characted (\007) from status messages in Pico. This makes
it possible to translate them.
Diffstat (limited to 'pico/osdep')
-rw-r--r--pico/osdep/altedit.c11
-rw-r--r--pico/osdep/filesys.c48
-rw-r--r--pico/osdep/getkey.c2
-rw-r--r--pico/osdep/spell.c2
4 files changed, 34 insertions, 29 deletions
diff --git a/pico/osdep/altedit.c b/pico/osdep/altedit.c
index f7224136..4a8f8db6 100644
--- a/pico/osdep/altedit.c
+++ b/pico/osdep/altedit.c
@@ -74,7 +74,7 @@ alt_editor(int f, int n)
char *fn; /* tmp holder for file name */
char result[128]; /* result string */
char prmpt[128];
- int i, done = 0, ret = 0, rv, trv;
+ int i, done = 0, ret = 0, rv, trv, beep;
pid_t child, pid;
RETSIGTYPE (*ohup)(int);
RETSIGTYPE (*oint)(int);
@@ -82,6 +82,7 @@ alt_editor(int f, int n)
int status;
EML eml;
+ beep = 0;
eml.s = f ? "speller" : "editor";
if(gmode&MDSCUR){
@@ -288,7 +289,8 @@ alt_editor(int f, int n)
exit(-1);
}
else { /* error! */
- snprintf(result, sizeof(result), "\007Can't fork %%s: %s", errstr(errno));
+ snprintf(result, sizeof(result), _("Can't fork %%s: %s"), errstr(errno));
+ beep = 1;
ret = -1;
}
@@ -334,7 +336,10 @@ alt_editor(int f, int n)
ttopen(); /* reset the signals */
pico_refresh(0, 1); /* redraw */
update();
- emlwrite(result, &eml);
+ if(beep)
+ emlwwrite(result, &eml);
+ else
+ emlwrite(result, &eml);
return(ret);
#else /* _WINDOWS */
char eb[2 * PATH_MAX]; /* buf holding edit command */
diff --git a/pico/osdep/filesys.c b/pico/osdep/filesys.c
index 8796fecc..c69cde11 100644
--- a/pico/osdep/filesys.c
+++ b/pico/osdep/filesys.c
@@ -299,19 +299,19 @@ getfnames(char *dn, char *pat, int *n, char *e, size_t elen)
switch(errno){
case ENOENT : /* File not found */
if(e)
- snprintf(e, elen, "\007File not found: \"%s\"", dn);
+ snprintf(e, elen, _("File not found: \"%s\""), dn);
break;
#ifdef ENAMETOOLONG
case ENAMETOOLONG : /* Name is too long */
if(e)
- snprintf(e, elen, "\007File name too long: \"%s\"", dn);
+ snprintf(e, elen, _("File name too long: \"%s\""), dn);
break;
#endif
default: /* Some other error */
if(e)
- snprintf(e, elen, "\007Error getting file info: \"%s\"", dn);
+ snprintf(e, elen, _("Error getting file info: \"%s\""), dn);
break;
}
@@ -325,7 +325,7 @@ getfnames(char *dn, char *pat, int *n, char *e, size_t elen)
avail = alloced = MAX(sbuf.st_size, incr);
if((sbuf.st_mode&S_IFMT) != S_IFDIR){
if(e)
- snprintf(e, elen, "\007Not a directory: \"%s\"", dn);
+ snprintf(e, elen, _("Not a directory: \"%s\""), dn);
return(NULL);
}
@@ -333,7 +333,7 @@ getfnames(char *dn, char *pat, int *n, char *e, size_t elen)
if((names=(char *)malloc(alloced * sizeof(char))) == NULL){
if(e)
- snprintf(e, elen, "\007Can't malloc space for file names");
+ snprintf(e, elen, _("Can't malloc space for file names"));
return(NULL);
}
@@ -342,7 +342,7 @@ getfnames(char *dn, char *pat, int *n, char *e, size_t elen)
errno = 0;
if((dirp=opendir(fname_to_locale(dn))) == NULL){
if(e)
- snprintf(e, elen, "\007Can't open \"%s\": %s", dn, errstr(errno));
+ snprintf(e, elen, _("Can't open \"%s\": %s"), dn, errstr(errno));
free((char *)names);
return(NULL);
@@ -398,7 +398,7 @@ getfnames(char *dn, char *pat, int *n, char *e, size_t elen)
if((names=(char *)realloc((void *)names, alloced * sizeof(char)))
== NULL){
if(e)
- snprintf(e, elen, "\007Can't malloc enough space for file names");
+ snprintf(e, elen, _("Can't malloc enough space for file names"));
return(NULL);
}
@@ -440,31 +440,31 @@ fioperr(int e, char *f)
switch(e){
case FIOFNF: /* File not found */
- emlwrite("\007File \"%s\" not found", &eml);
+ emlwwrite(_("File \"%s\" not found"), &eml);
break;
case FIOEOF: /* end of file */
- emlwrite("\007End of file \"%s\" reached", &eml);
+ emlwwrite(_("End of file \"%s\" reached"), &eml);
break;
case FIOLNG: /* name too long */
- emlwrite("\007File name \"%s\" too long", &eml);
+ emlwwrite(_("File name \"%s\" too long"), &eml);
break;
case FIODIR: /* file is a directory */
- emlwrite("\007File \"%s\" is a directory", &eml);
+ emlwwrite(_("File \"%s\" is a directory"), &eml);
break;
case FIONWT:
- emlwrite("\007Write permission denied: %s", &eml);
+ emlwwrite(_("Write permission denied: %s"), &eml);
break;
case FIONRD:
- emlwrite("\007Read permission denied: %s", &eml);
+ emlwwrite(_("Read permission denied: %s"), &eml);
break;
case FIOPER:
- emlwrite("\007Permission denied: %s", &eml);
+ emlwwrite(_("Permission denied: %s"), &eml);
break;
case FIONEX:
- emlwrite("\007Execute permission denied: %s", &eml);
+ emlwwrite(_("Execute permission denied: %s"), &eml);
break;
default:
- emlwrite("\007File I/O error: %s", &eml);
+ emlwwrite(_("File I/O error: %s"), &eml);
}
}
@@ -787,13 +787,13 @@ copy(char *a, char *b)
if(!(fsb.st_mode&S_IREAD)){ /* can we read it? */
eml.s = a;
- emlwrite("\007Read permission denied: %s", &eml);
+ emlwwrite(_("Read permission denied: %s"), &eml);
return(-1);
}
if((fsb.st_mode&S_IFMT) == S_IFDIR){ /* is it a directory? */
eml.s = a;
- emlwrite("\007Can't copy: %s is a directory", &eml);
+ emlwwrite(_("Can't copy: %s is a directory"), &eml);
return(-1);
}
@@ -803,25 +803,25 @@ copy(char *a, char *b)
break; /* these are OK */
default:
eml.s = errstr(errno);
- emlwrite("\007Can't Copy: %s", &eml);
+ emlwwrite(_("Can't Copy: %s"), &eml);
return(-1);
}
}
else{
if(!(tsb.st_mode&S_IWRITE)){ /* can we write it? */
eml.s = b;
- emlwrite("\007Write permission denied: %s", &eml);
+ emlwwrite(_("Write permission denied: %s"), &eml);
return(-1);
}
if((tsb.st_mode&S_IFMT) == S_IFDIR){ /* is it directory? */
eml.s = b;
- emlwrite("\007Can't copy: %s is a directory", &eml);
+ emlwwrite(_("Can't copy: %s is a directory"), &eml);
return(-1);
}
if(fsb.st_dev == tsb.st_dev && fsb.st_ino == tsb.st_ino){
- emlwrite("\007Identical files. File not copied", NULL);
+ emlwwrite(_("Identical files. File not copied"), NULL);
return(-1);
}
}
@@ -939,13 +939,13 @@ ffclose(void)
|| ftruncate(fileno(g_pico_fio.fp),
(off_t) ftell(g_pico_fio.fp)) < 0)){
eml.s = errstr(errno);
- emlwrite("\007Error preparing to close file: %s", &eml);
+ emlwwrite(_("Error preparing to close file: %s"), &eml);
sleep(5);
}
if (fclose(g_pico_fio.fp) == EOF) {
eml.s = errstr(errno);
- emlwrite("\007Error closing file: %s", &eml);
+ emlwwrite(_("Error closing file: %s"), &eml);
return(FIOERR);
}
#else /* _WINDOWS */
diff --git a/pico/osdep/getkey.c b/pico/osdep/getkey.c
index e2a9d7b6..0f10cb4b 100644
--- a/pico/osdep/getkey.c
+++ b/pico/osdep/getkey.c
@@ -109,7 +109,7 @@ ReadyForKey(int timeout)
case BAIL_OUT:
case PANIC_NOW:
- emlwrite("\007Problem reading from keyboard!", NULL);
+ emlwwrite(_("Problem reading from keyboard!"), NULL);
kill(getpid(), SIGHUP); /* Bomb out (saving our work)! */
/* no return */
}
diff --git a/pico/osdep/spell.c b/pico/osdep/spell.c
index f05446b4..0ff6ed8c 100644
--- a/pico/osdep/spell.c
+++ b/pico/osdep/spell.c
@@ -142,7 +142,7 @@ spell(int f, int n)
if(ret != FIOSUC){
eml.s = sp;
- emlwrite(_("\007Spell-checking file \"%s\" not found"), &eml);
+ emlwwrite(_("Spell-checking file \"%s\" not found"), &eml);
return(-1);
}