Skip to content

Commit

Permalink
fix: tr.586 and bit-8 stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes14 committed Mar 18, 2014
1 parent 412d157 commit 789a7e9
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions kernel/feread.cc
Expand Up @@ -180,7 +180,7 @@ char ** singular_completion (char *text, int start, int end)
#define x_rl_completion_matches rl_completion_matches
#define x_rl_filename_completion_function rl_filename_completion_function
#endif
if (x_rl_line_buffer[start-1]=='"')
if ((start>0) && (x_rl_line_buffer[start-1]=='"'))
return x_rl_completion_matches (text, (RL_PROC)x_rl_filename_completion_function);
char **m=x_rl_completion_matches (text, (RL_PROC)command_generator);
#undef x_rl_line_buffer
Expand All @@ -207,17 +207,16 @@ char * fe_fgets_stdin_rl(const char *pr,char *s, int size)
char *line;
line = readline (pr);

int i;
for (i=strlen(line)-1;i>=0;i--) line[i]=line[i]&127;

if (line==NULL)
return NULL;

int l=strlen(line);
for (int i=l-1;i>=0;i--) line[i]=line[i]&127;

if (*line!='\0')
{
add_history (line);
}
int l=strlen(line);
if (l>=size-1)
{
strncpy(s,line,size);
Expand Down Expand Up @@ -272,14 +271,13 @@ char * fe_fgets_stdin_drl(const char *pr,char *s, int size)
if (line==NULL)
return NULL;

int i;
for (i=strlen(line)-1;i>=0;i--) line[i]=line[i]&127;
int l=strlen(line);
for (int i=l-1;i>=0;i--) line[i]=line[i]&127;

if (*line!='\0')
{
(*fe_add_history) (line);
}
int l=strlen(line);
if (l>=size-1)
{
strncpy(s,line,size);
Expand Down Expand Up @@ -307,8 +305,8 @@ char * fe_fgets(const char *pr,char *s, int size)
}
mflush();
char *line=fgets(s,size,stdin);
int i;
for (i=strlen(line)-1;i>=0;i--) line[i]=line[i]&127;
if (line!=NULL)
for (int i=strlen(line)-1;i>=0;i--) line[i]=line[i]&127;
return line;
}

Expand Down

0 comments on commit 789a7e9

Please sign in to comment.