www.pudn.com > Linuxserial.zip > sdb.c
/* * File : sdb.c * Date : 2002-04-20 * Author : yfy001 * Description : Serial Debugger * Copyright (C) 2001, 2002 yfy001 */ #include// printf #include // open #include // bzero #include // exit #include // times #include // read, write, close #include // lstat #include "types.h" #include "tty.h" #include "args.h" #include "cmd.h" static pkginfo_t pkginfo = { "sdb", // program "serutils", // package "0.0.6", // version "yfy001", // author 0 // reserved }; static portinfo_t portinfo = { 0, // print prompt after receiving 115200, // baudrate: 115200 8, // databit: 8 0, // debug: off 0, // echo: off 1, // flow control: hardware 0, // tty: /dev/ttyS0 0, // parity: none 1, // stopbit: 1 0 // reserved }; static args_t args = { &pkginfo, &portinfo }; p_args_t p_args = &args; int main(int argc, char *argv[]) { args_parse(argc, argv, 0); // open comport atexit(tty_close); if (tty_open(p_args->p_portinfo)) { fprintf(stderr, "Make sure /dev/ttyS%d " "not in use or you have enough privilege.\n\n", p_args->p_portinfo->tty); exit(-1); } cmd(); exit(0); }