summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-01-07 03:02:13 +0000
committerAndrew Tridgell <tridge@samba.org>2000-01-07 03:02:13 +0000
commit112faa49e60d56bfd5fb0a5d2d40442c607577d9 (patch)
tree3d1d8f51e25d1ba8d3c121138bb46b4a848dda48
parente91ceacb6c71ae05a82583c78af896051b7a88fe (diff)
downloadsamba-112faa49e60d56bfd5fb0a5d2d40442c607577d9.tar.gz
samba-112faa49e60d56bfd5fb0a5d2d40442c607577d9.tar.bz2
samba-112faa49e60d56bfd5fb0a5d2d40442c607577d9.zip
don't require readline
(This used to be commit 2dbe70da8db548b3423c6c0de0f282fdf82f0fad)
-rw-r--r--source3/tdb/tdbtool.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source3/tdb/tdbtool.c b/source3/tdb/tdbtool.c
index 428bae84c2..b1c7e2774f 100644
--- a/source3/tdb/tdbtool.c
+++ b/source3/tdb/tdbtool.c
@@ -158,12 +158,24 @@ static void info_tdb(void)
printf("%d records totalling %d bytes\n", count, total_bytes);
}
+static char *getline(char *prompt)
+{
+ static char line[1024];
+ char *p;
+ fputs(prompt, stdout);
+ line[0] = 0;
+ p = fgets(line, sizeof(line)-1, stdin);
+ if (p) p = strchr(p, '\n');
+ if (p) *p = 0;
+ return p?line:NULL;
+}
+
int main(int argc, char *argv[])
{
char *line;
char *tok;
- while ((line=readline("tdb> "))) {
+ while ((line=getline("tdb> "))) {
tok = strtok(line," ");
if (strcmp(tok,"create") == 0) {
create_tdb();