run OpenBSDindent(1) to fix coding style

This commit is contained in:
Solene Rapenne 2020-12-02 13:32:39 +01:00
parent 25977754ac
commit 24aa4ba284
1 changed files with 47 additions and 50 deletions

17
main.c
View File

@ -65,14 +65,14 @@ display_file(char *path)
ssize_t nread;
struct stat sb;
// this is to check if path is a directory
/* this is to check if path is a directory */
stat(path, &sb);
FILE *fd = fopen(path, "r");
if (fd != NULL && S_ISDIR(sb.st_mode) != 1) {
// check if directory
/* check if directory */
ok_status();
/* read the file and write it to stdout */
@ -100,10 +100,8 @@ main(int argc, char **argv)
int option;
char *pos;
while((option = getopt(argc, argv, ":d:")) != -1)
{
switch(option)
{
while ((option = getopt(argc, argv, ":d:")) != -1) {
switch (option) {
case 'd':
strlcpy(path, optarg, sizeof(path));
break;
@ -144,7 +142,6 @@ main(int argc, char **argv)
request, start_with_gemini);
exit(1);
}
/* remove the gemini:// part */
strlcpy(buffer, request + GEMINI_PART, sizeof(buffer) - GEMINI_PART);
strlcpy(request, buffer, sizeof(request));
@ -170,9 +167,9 @@ main(int argc, char **argv)
strlcpy(hostname, request, position);
strlcpy(file, request + position + 1, sizeof(request));
/* use a default file if no file are requested
* this can happen in two cases
* gemini://hostname/
/*
* use a default file if no file are requested this
* can happen in two cases gemini://hostname/
* gemini://hostname/directory/
*/
if (strlen(file) == 0)