Changeset 1015
- Timestamp:
- 2000-03-06T11:49:42+13:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/packages/mg/src/text/read_line.c
r1014 r1015 49 49 } 50 50 #else 51 52 static FILE *rl_instream = NULL; 53 static FILE *rl_outstream = NULL; 54 51 55 void 52 56 Init_ReadLine (void) … … 55 59 rl_outstream = stdout; 56 60 } 57 #endif 58 59 60 61 62 static char * 63 readline (char *pmt) 64 { 65 static char buf[MAXLINEBUFFERLEN + 1]; 66 char *s; 67 68 fprintf (rl_outstream, "%s", pmt); 69 s = fgets (buf, sizeof (buf), rl_instream); 70 if (s) 71 { 72 char *s1 = strrchr (s, '\n'); 73 if (s1 && *(s1 + 1) == '\0') 74 *s1 = '\0'; 75 } 76 return s ? Xstrdup (s) : NULL; 77 } 78 #endif 61 79 62 80 /* WritePrompt() */ … … 112 130 #endif 113 131 114 115 #ifndef GNU_READLINE116 117 static FILE *rl_instream = NULL;118 static FILE *rl_outstream = NULL;119 120 static char *121 readline (char *pmt)122 {123 static char buf[MAXLINEBUFFERLEN + 1];124 char *s;125 126 fprintf (rl_outstream, "%s", pmt);127 s = fgets (buf, sizeof (buf), rl_instream);128 if (s)129 {130 char *s1 = strrchr (s, '\n');131 if (s1 && *(s1 + 1) == '\0')132 *s1 = '\0';133 }134 return s ? Xstrdup (s) : NULL;135 }136 #endif137 132 138 133 /*
Note:
See TracChangeset
for help on using the changeset viewer.