43
linein.c
43
linein.c
@@ -1,4 +1,4 @@
|
||||
/* $Id: linein.c,v 1.13 2001/12/07 07:20:26 ukai Exp $ */
|
||||
/* $Id: linein.c,v 1.14 2001/12/07 07:24:22 ukai Exp $ */
|
||||
#include "fm.h"
|
||||
#include "local.h"
|
||||
#include "myctype.h"
|
||||
@@ -855,37 +855,50 @@ next_dcompl(int next)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Str
|
||||
escape_spaces(Str s)
|
||||
{
|
||||
Str tmp = NULL;
|
||||
char *p;
|
||||
|
||||
if (s == NULL)
|
||||
return;
|
||||
p = s->ptr;
|
||||
s = Strnew();
|
||||
while(*p) {
|
||||
if (*p == ' ')
|
||||
Strcat_char(s, '\\');
|
||||
Strcat_char(s, *p++);
|
||||
return s;
|
||||
for (p = s->ptr; *p; p++) {
|
||||
if (*p == ' ' || *p == CTRL_I) {
|
||||
if (tmp == NULL)
|
||||
tmp = Strnew_charp_n(s->ptr, (int)(p - s->ptr));
|
||||
Strcat_char(tmp, '\\');
|
||||
}
|
||||
if (tmp)
|
||||
Strcat_char(tmp, *p);
|
||||
}
|
||||
if (tmp)
|
||||
return tmp;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
Str
|
||||
unescape_spaces(Str s)
|
||||
{
|
||||
Str tmp = NULL;
|
||||
char *p;
|
||||
|
||||
if (s == NULL)
|
||||
return;
|
||||
p = s->ptr;
|
||||
s = Strnew();
|
||||
while (*p) {
|
||||
if (!(*p == '\\' && *(p+1) && *(p+1) == ' '))
|
||||
Strcat_char(s, *p);
|
||||
p++;
|
||||
return s;
|
||||
for (p = s->ptr; *p; p++) {
|
||||
if (*p == '\\' && (*(p+1) == ' ' || *(p+1) == CTRL_I)) {
|
||||
if (tmp == NULL)
|
||||
tmp = Strnew_charp_n(s->ptr, (int)(p - s->ptr));
|
||||
}
|
||||
else {
|
||||
if (tmp)
|
||||
Strcat_char(tmp, *p);
|
||||
}
|
||||
}
|
||||
if (tmp)
|
||||
return tmp;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user