Automatically format file with LSP via LLVM.

This commit is contained in:
Murilo Pereira 2020-06-01 15:43:53 +02:00
parent 456b66d008
commit 0ce1526c81

View File

@ -1,12 +1,12 @@
#include <stdlib.h>
#include <ncurses.h>
#include <locale.h>
#include <getopt.h>
#include <errno.h>
#include <getopt.h>
#include <locale.h>
#include <ncurses.h>
#include <stdlib.h>
#include "common.h"
#include "game.h"
#include "keyboard.h"
#include "common.h"
#ifndef VERSION
#define VERSION "n/a"
@ -25,16 +25,16 @@ int main(int argc, char *argv[]) {
int passes_through_deck = 3;
int color = 1;
static const struct option options[] = {
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
{"passes", required_argument, NULL, 'p'},
{"color", required_argument, NULL, 'c'},
{0, 0, 0, 0}
};
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
{"passes", required_argument, NULL, 'p'},
{"color", required_argument, NULL, 'c'},
{0, 0, 0, 0}};
program_name = argv[0];
while ((option = getopt_long(argc, argv, "hvpc:", options, &option_index)) != -1) {
while ((option = getopt_long(argc, argv, "hvpc:", options, &option_index)) !=
-1) {
switch (option) {
case 'v':
version();
@ -60,10 +60,9 @@ int main(int argc, char *argv[]) {
start_color();
curs_set(FALSE);
set_escdelay(0);
if(color) {
if (color) {
assume_default_colors(COLOR_WHITE, COLOR_GREEN);
}
else {
} else {
use_default_colors();
}
init_pair(1, COLOR_BLACK, COLOR_WHITE);
@ -79,7 +78,7 @@ int main(int argc, char *argv[]) {
refresh();
if ((key = getch()) == 'q' || key == 'Q') {
endwin();
return(0);
return (0);
}
}
@ -90,7 +89,7 @@ int main(int argc, char *argv[]) {
for (;;) {
if ((key = getch()) == 'q' || key == 'Q') {
endwin();
return(0);
return (0);
}
if (term_size_ok()) {
clear();
@ -117,7 +116,7 @@ int main(int argc, char *argv[]) {
game_end();
printf("You won.\n");
return(0);
return (0);
}
void draw_greeting() {
@ -130,14 +129,13 @@ void draw_greeting() {
}
void usage(const char *program_name) {
printf("usage: %s [-v|--version] [-h|--help] [-p|--passes=NUMBER]\n", program_name);
printf("usage: %s [-v|--version] [-h|--help] [-p|--passes=NUMBER]\n",
program_name);
printf(" -v, --version Show version\n");
printf(" -h, --help Show this message\n");
printf(" -p, --passes Number of passes through the deck\n");
printf(" -c, --color 1 (default) - use suggested colors\n");
printf(" 0 - use terminal colors\n");
printf(" 0 - use terminal colors\n");
}
void version() {
printf("%s\n", VERSION);
}
void version() { printf("%s\n", VERSION); }