sdb.c

来自「linux下的一个串口调试程序的源代码」· C语言 代码 · 共 61 行

C
61
字号
/* * Program:     sdb * Funtcion:    Serial Debugger  * Date:        2002-02-19 * Version:     0.0.5 * Author:      Paul Dean */#include <stdio.h>              //* printf */#include <fcntl.h>              //* open */#include <string.h>             //* bzero */#include <stdlib.h>             //* exit */#include <sys/times.h>          //* times */#include <unistd.h>             //* read, write, close */#include <sys/stat.h>           //* lstat */#include "types.h"#include "serial.h"#include "args.h"#include "cmd.h"static PACKAGE_INFO pkgInfo = {    "sdb",                      //* program */    "serutils",                 //* package */    "0.0.4",                    //* version */    "Paul Dean",                //* author */    0                           //* reserved */},             *pPkgInfo = &pkgInfo;static PORT_INFO portInfo = {    0,                          //* debug */    0,                          //* echo */    115200,                     //* baudrate */    0,                          //* port */    8,                          //* databit */    1,                          //* flow control: hardware */    'N',                        //* no parity check */    "1",                        //* stopbit */    NULL,                       //* device */    0                           //* reserved */},             *pPortInfo = &portInfo;static ARGUMENTS args = { &pkgInfo, &portInfo };P_ARGUMENTS     pArgs = &args;int main (int argc, char *argv[]){    parse_arguments (argc, argv, 0, pPkgInfo, pPortInfo);    //* open comport */    if (OpenComPort (pPortInfo)) {        fprintf (stderr,                 "Make sure /dev/ttyS%d "                 "not in use or you have enough privilege.\n\n",                 pPortInfo->port);        exit (-1);    }    cmd ();    CloseComPort ();    exit (0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?