68 lines
1.5 KiB
C
68 lines
1.5 KiB
C
/* Library exports
|
|
*
|
|
* This file is part of the Pollcat Library.
|
|
* Copyright (C) 2022 Expatria Technologies Inc.
|
|
* Contact: Morgan Hughes <morgan@expatria.ca>
|
|
*
|
|
* The Pollcat Library is free software: you can redistribute it and/or modify it under
|
|
* the terms of the the GNU Lesser General Public License as published by the Free
|
|
* Software Foundation; either version 3 of the License, or (at your option) any later
|
|
* version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
*
|
|
* You should have received copies of the GNU General Public License and the GNU Lesser
|
|
* General Public License along with the Pollcat Library. If not, see
|
|
* https://www.gnu.org/licenses/
|
|
*
|
|
* vim:ts=4:noexpandtab
|
|
*/
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <fcntl.h>
|
|
#include <ctype.h>
|
|
#include <errno.h>
|
|
#include <unistd.h>
|
|
#include <termios.h>
|
|
|
|
#include <pollcat.h>
|
|
|
|
#include "terminal.h"
|
|
|
|
|
|
char command_char = '\01';
|
|
int command_mode = 0;
|
|
|
|
void command_help (void)
|
|
{
|
|
fprintf(stderr,
|
|
"\r\nMenu\r\n"
|
|
"Q - Quit\r\n"
|
|
"X - Exit\r\n"
|
|
"\r\n");
|
|
}
|
|
|
|
void command_recv (char c)
|
|
{
|
|
switch ( tolower(c) )
|
|
{
|
|
case 'q':
|
|
case 'x':
|
|
case '\x11':
|
|
case '\x18':
|
|
pollcat_loop_exit();
|
|
return;
|
|
|
|
case '\01':
|
|
serial_write(&c, sizeof(c));
|
|
return;
|
|
|
|
default:
|
|
command_help();
|
|
return;
|
|
}
|
|
}
|
|
|