main.c
changeset 22 822094314703
parent 17 bd746609ba46
child 32 6dc2d52e4b13
equal deleted inserted replaced
21:3510b50c6694 22:822094314703
     1 /* vim: set noet nosta sw=4 ts=4 ft=c : */
     1 /* vim: set noet nosta sw=4 ts=4 ft=c : */
     2 /*
     2 /*
     3 Copyright (c) 2011, Mahlon E. Smith <mahlon@martini.nu>
     3 Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
     4 All rights reserved.
     4 All rights reserved.
     5 Redistribution and use in source and binary forms, with or without
     5 Redistribution and use in source and binary forms, with or without
     6 modification, are permitted provided that the following conditions are met:
     6 modification, are permitted provided that the following conditions are met:
     7 
     7 
     8     * Redistributions of source code must retain the above copyright
     8     * Redistributions of source code must retain the above copyright
    28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29 */
    29 */
    30 
    30 
    31 #include "volta.h"
    31 #include "volta.h"
    32 #include "db.h"
    32 #include "db.h"
       
    33 #include "lua.h"
    33 
    34 
    34 struct v_globals v;
    35 struct v_globals v;
    35 
    36 
    36 /*
    37 /*
    37  * Parse command line options, perform actions, and enter accept loop.
    38  * Parse command line options, perform actions, and enter accept loop.
    51 	strcpy( v.dbname, "volta.db" );
    52 	strcpy( v.dbname, "volta.db" );
    52 	char create_db[30]   = "";
    53 	char create_db[30]   = "";
    53 	v.timer.db_lastcheck = 0;
    54 	v.timer.db_lastcheck = 0;
    54 	v.timer.start        = time( NULL );
    55 	v.timer.start        = time( NULL );
    55 	v.timer.lines        = 0;
    56 	v.timer.lines        = 0;
       
    57 	v.lua                = luaV_setup();
    56 
    58 
    57 	/* get_opt vars */
    59 	/* get_opt vars */
    58 	int opt = 0;
    60 	int opt = 0;
    59 	extern char *optarg;
    61 	extern char *optarg;
    60 	extern int opterr, optind, optopt;
    62 	extern int opterr, optind, optopt;
   129  *
   131  *
   130  */
   132  */
   131 void
   133 void
   132 shutdown_actions( void )
   134 shutdown_actions( void )
   133 {
   135 {
       
   136 	lua_close( v.lua );
   134 	cdb_free( &v.db );
   137 	cdb_free( &v.db );
   135 	close( v.db_fd );
   138 	close( v.db_fd );
   136 	report_speed();
   139 	report_speed();
   137 }
   140 }
   138 
   141