Subversion Repositories Tewi

Rev

Rev 116 | Rev 119 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 116 Rev 117
Line 1... Line 1...
1
/* $Id: main.c 116 2024-09-21 08:40:13Z nishi $ */
1
/* $Id: main.c 117 2024-09-21 08:47:51Z nishi $ */
2
 
2
 
3
#define SOURCE
3
#define SOURCE
4
 
4
 
5
#include "../config.h"
5
#include "../config.h"
6
 
6
 
Line 110... Line 110...
110
					if(argv[i] == NULL) {
110
					if(argv[i] == NULL) {
111
						fprintf(stderr, "Missing argument\n");
111
						fprintf(stderr, "Missing argument\n");
112
						return 1;
112
						return 1;
113
					}
113
					}
114
					confpath = argv[i];
114
					confpath = argv[i];
-
 
115
				} else if(strcmp(argv[i], "--logfile") == 0 || strcmp(argv[i], "-l") == 0) {
-
 
116
					i++;
-
 
117
					if(argv[i] == NULL) {
-
 
118
						fprintf(stderr, "Missing argument\n");
-
 
119
						return 1;
-
 
120
					}
-
 
121
					if(logfile != NULL && logfile != stderr) {
-
 
122
						fclose(logfile);
-
 
123
					}
-
 
124
					logfile = fopen(argv[i], "a");
-
 
125
					if(logfile == NULL) {
-
 
126
						fprintf(stderr, "Failed to open logfile\n");
-
 
127
						return 1;
-
 
128
					}
115
				} else if(strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "-V") == 0) {
129
				} else if(strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "-V") == 0) {
116
					printf("Tewi HTTPd Tewi/%s\n", tw_get_version());
130
					printf("Tewi HTTPd Tewi/%s\n", tw_get_version());
117
					printf("Under public domain.\n");
131
					printf("Under public domain.\n");
118
					printf("Original by 2024 Nishi\n");
132
					printf("Original by 2024 Nishi\n");
119
					printf("\n");
133
					printf("\n");