Skip to content

Commit 4842299

Browse files
committed
More argument handling.
1 parent 4dc51cd commit 4842299

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# option. This file may not be copied, modified, or distributed
88
# except according to those terms.
99

10-
CFLAGS = -Wall -Wextra -std=c11
10+
CFLAGS = -Wall -Wextra -std=c11 -I../encoding-rs/target/include/
1111
OBS = recode_c.o
1212

1313
recode_c: $(OBJS)

recode_c.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
#include <stdio.h>
1111
#include <stdlib.h>
1212
#include <getopt.h>
13+
#include <stdbool.h>
14+
15+
typedef struct _Encoding Encoding;
16+
typedef struct _Decoder Decoder;
17+
typedef struct _Encoder Encoder;
18+
#include "encoding_rs.h"
1319

1420
int
1521
main(int argc, char** argv)
@@ -22,9 +28,14 @@ main(int argc, char** argv)
2228
{ "help", no_argument, NULL, 'h' },
2329
{ 0, 0, 0, 0 }
2430
};
31+
32+
bool use_utf16 = false;
33+
Encoding* input_encoding = NULL; // TODO: default to UTF-8
34+
Encoding* output_encoding = NULL; // TODO: default to UTF-8
35+
FILE* output = stdout;
36+
2537
for (;;) {
2638
int option_index = 0;
27-
2839
int c = getopt_long(argc, argv, "o:e:g:uh", long_options, &option_index);
2940
if (c == -1) {
3041
break;
@@ -35,12 +46,14 @@ main(int argc, char** argv)
3546
}
3647
switch (c) {
3748
case 'o':
49+
3850
case 'e':
3951
case 'g':
4052
case 'u':
4153
case 'h':
4254
case '?':
4355
default:
56+
break;
4457
}
4558
}
4659
}

0 commit comments

Comments
 (0)