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