home *** CD-ROM | disk | FTP | other *** search
- /* vi:tabstop=4:shiftwidth=4:smartindent
- *
- * get.c - Obtains a line from the input, with or without
- * echoing. char *line should point to a 1K buffer.
- *
- */
- #include <stdio.h>
- #include <unistd.h>
-
- void get(char *prompt, char *line, int echo)
- {
- if (feof(stdin))
- {
- putchar('\n');
- freopen("/dev/tty", "r", stdin);
- }
-
- printf("%s", prompt);
- fflush(stdout);
-
- if (!echo)
- {
- os_vdu(21);
- }
-
- fgets(line, 1024, stdin);
- line[strlen(line)-1] = '\0';
-
- if (!echo)
- {
- os_vdu(6);
- putchar('\n');
- }
- }
-