Skip to content
Snippets Groups Projects
Commit 5ae23869 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

slightly optimized

Rev: lib/modules/Stdio.pmod:1.2
parent fd0fdf6d
No related branches found
No related tags found
No related merge requests found
...@@ -42,10 +42,12 @@ class FILE { ...@@ -42,10 +42,12 @@ class FILE {
/* Public functions. */ /* Public functions. */
string gets() string gets()
{ {
int p; int p,tmp=bpos;
while((p=search(b, "\n", bpos)) == -1) while((p=search(b, "\n", tmp)) == -1)
if(!get_data()) {
return 0; tmp=strlen(b);
if(!get_data()) return 0;
}
return extract(p-bpos, 1); return extract(p-bpos, 1);
} }
...@@ -213,3 +215,14 @@ void perror(string s) ...@@ -213,3 +215,14 @@ void perror(string s)
stderr->write(s+": errno: "+predef::errno()+"\n"); stderr->write(s+": errno: "+predef::errno()+"\n");
#endif #endif
} }
mixed `[](string index)
{
mixed x=`->(this_object(),index);
if(x) return x;
switch(index)
{
case "readline": return master()->resolv("readline");
default: return ([])[0];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment