mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Fixed indentation in configfile.c, tty.c, options.c
This commit is contained in:
parent
1c29aac9fa
commit
f459a462c5
4 changed files with 46 additions and 48 deletions
|
|
@ -131,7 +131,7 @@ static int data_handler(void *user, const char *section, const char *name,
|
|||
else if ( !strcmp(name, "upcase"))
|
||||
{
|
||||
option.upcase = true;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(name, "dtr-pulse-duration"))
|
||||
{
|
||||
option.dtr_pulse_duration = atoi(value);
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ void print_help(char *argv[])
|
|||
printf(" -c, --color 0..255|none|list Colorize tio text (default: 15)\n");
|
||||
printf(" -S, --socket <socket> Redirect I/O to file or network socket\n");
|
||||
printf(" -x, --hexadecimal Enable hexadecimal mode\n");
|
||||
printf(" -U, --upcase Translate lower case alpha to upper case\n");
|
||||
printf(" -U, --upcase Translate lower case alpha to upper case\n");
|
||||
printf(" -v, --version Display version\n");
|
||||
printf(" -h, --help Display help\n");
|
||||
printf("\n");
|
||||
|
|
@ -208,8 +208,8 @@ void options_parse(int argc, char *argv[])
|
|||
{"stopbits", required_argument, 0, 's' },
|
||||
{"parity", required_argument, 0, 'p' },
|
||||
{"output-delay", required_argument, 0, 'o' },
|
||||
{"eol-delay", required_argument, 0, 'O' },
|
||||
{"upcase", no_argument, 0, 'U' },
|
||||
{"eol-delay", required_argument, 0, 'O' },
|
||||
{"upcase", no_argument, 0, 'U' },
|
||||
{"dtr-pulse-duration", required_argument, 0, OPT_DTR_PULSE_DURATION },
|
||||
{"no-autoconnect", no_argument, 0, 'n' },
|
||||
{"local-echo", no_argument, 0, 'e' },
|
||||
|
|
@ -274,9 +274,9 @@ void options_parse(int argc, char *argv[])
|
|||
option.output_delay = string_to_long(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
option.eol_delay = string_to_long(optarg);
|
||||
break;
|
||||
case 'O':
|
||||
option.eol_delay = string_to_long(optarg);
|
||||
break;
|
||||
|
||||
case OPT_DTR_PULSE_DURATION:
|
||||
option.dtr_pulse_duration = string_to_long(optarg);
|
||||
|
|
@ -353,9 +353,9 @@ void options_parse(int argc, char *argv[])
|
|||
option.hex_mode = true;
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
option.upcase = true;
|
||||
break;
|
||||
case 'U':
|
||||
option.upcase = true;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
printf("tio v%s\n", VERSION);
|
||||
|
|
@ -384,7 +384,7 @@ void options_parse(int argc, char *argv[])
|
|||
|
||||
/* Assume first non-option is the tty device name */
|
||||
if (strcmp(option.tty_device, ""))
|
||||
optind++;
|
||||
optind++;
|
||||
else if (optind < argc)
|
||||
option.tty_device = argv[optind++];
|
||||
|
||||
|
|
|
|||
70
src/tty.c
70
src/tty.c
|
|
@ -152,11 +152,11 @@ ssize_t tty_write(int fd, const void *buffer, size_t count)
|
|||
// Write byte by byte with output delay
|
||||
for (size_t i=0; i<count; i++)
|
||||
{
|
||||
// convert alpha to upper case
|
||||
if ( option.upcase )
|
||||
{
|
||||
*(unsigned char*)buffer = toupper(*(unsigned char*)buffer);
|
||||
}
|
||||
// convert alpha to upper case
|
||||
if ( option.upcase )
|
||||
{
|
||||
*(unsigned char*)buffer = toupper(*(unsigned char*)buffer);
|
||||
}
|
||||
ssize_t retval = write(fd, buffer, 1);
|
||||
if (retval < 0)
|
||||
{
|
||||
|
|
@ -165,15 +165,15 @@ ssize_t tty_write(int fd, const void *buffer, size_t count)
|
|||
break;
|
||||
}
|
||||
bytes_written += retval;
|
||||
if ( option.eol_delay && *(unsigned char*)buffer == '\r' )
|
||||
{
|
||||
delay( option.eol_delay );
|
||||
}
|
||||
if ( option.eol_delay && *(unsigned char*)buffer == '\r' )
|
||||
{
|
||||
delay( option.eol_delay );
|
||||
}
|
||||
fsync(fd);
|
||||
if ( option.output_delay )
|
||||
{
|
||||
delay(option.output_delay);
|
||||
}
|
||||
if ( option.output_delay )
|
||||
{
|
||||
delay(option.output_delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -184,14 +184,14 @@ ssize_t tty_write(int fd, const void *buffer, size_t count)
|
|||
tty_flush(fd);
|
||||
}
|
||||
|
||||
// convert lower case to upper case, in situ
|
||||
if ( option.upcase )
|
||||
{
|
||||
for ( size_t i = 0; i<count; i++ )
|
||||
{
|
||||
*((unsigned char*)buffer+i) = toupper(*((unsigned char*)buffer+i));
|
||||
}
|
||||
}
|
||||
// convert lower case to upper case, in situ
|
||||
if ( option.upcase )
|
||||
{
|
||||
for ( size_t i = 0; i<count; i++ )
|
||||
{
|
||||
*((unsigned char*)buffer+i) = toupper(*((unsigned char*)buffer+i));
|
||||
}
|
||||
}
|
||||
// Copy bytes to tty write buffer
|
||||
memcpy(tty_buffer_write_ptr, buffer, count);
|
||||
tty_buffer_write_ptr += count;
|
||||
|
|
@ -287,7 +287,7 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
|||
tio_printf(" ctrl-t s Show statistics");
|
||||
tio_printf(" ctrl-t t Send ctrl-t key code");
|
||||
tio_printf(" ctrl-t T Toggle line timestamp mode");
|
||||
tio_printf(" ctrl-t U Toggle upcase");
|
||||
tio_printf(" ctrl-t U Toggle upcase");
|
||||
tio_printf(" ctrl-t v Show version");
|
||||
break;
|
||||
|
||||
|
|
@ -397,16 +397,16 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
|
|||
}
|
||||
break;
|
||||
|
||||
case KEY_U:
|
||||
if ( option.upcase == true )
|
||||
{
|
||||
option.upcase = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
option.upcase = true;
|
||||
}
|
||||
break;
|
||||
case KEY_U:
|
||||
if ( option.upcase == true )
|
||||
{
|
||||
option.upcase = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
option.upcase = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_V:
|
||||
tio_printf("tio v%s", VERSION);
|
||||
|
|
@ -631,9 +631,9 @@ void tty_configure(void)
|
|||
}
|
||||
else if ( strcmp("mark", option.parity) == 0)
|
||||
{
|
||||
tio.c_cflag &= ~PARENB;
|
||||
tio.c_cflag |= PARODD;
|
||||
tio.c_cflag |= CMSPAR;
|
||||
tio.c_cflag &= ~PARENB;
|
||||
tio.c_cflag |= PARODD;
|
||||
tio.c_cflag |= CMSPAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue