summaryrefslogtreecommitdiffstats
path: root/db_demo/main.c
blob: 4ae8dbb31eb4e861b95c62a961a364094850e87a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "db.h"

// prints a new line
void newline(void) { printf("%s=> ", DBNAME); }

int main(int argc, char *argv[])
{
  char string[1024];

  printf("type exit and hit <enter> to quit the program...\n\n");

  db_init();
  newline();

  // parse user input
  while (gets(string))
  {
    if (!strcmp(string, "exit")) exit(0);
    else if (!strcmp(string, "")) {}
    else db_execute(string);
    newline();
  }

  db_close();

	return 0;

} // main