Diff

Differences From Artifact [8abf7d803b]:

To Artifact [56b4842ff2]:


1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
16








-
+







#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>

struct options {
struct xvfs_options {
	char *name;
	char *directory;
};

struct xvfs_state {
	char **children;
	unsigned long child_count;
289
290
291
292
293
294
295
296

297
298
299
300
301
302
303
289
290
291
292
293
294
295

296
297
298
299
300
301
302
303







-
+







	fprintf(outfp, "\t\tif (strcmp(path, xvfs_example_data[pathIndex].name) == 0) {\n");
	fprintf(outfp, "\t\t\treturn(pathIndex);\n");
	fprintf(outfp, "\t\t}\n");
	fprintf(outfp, "\t}\n");
	return;
}

static void parse_xvfs_minirivet_handle_tcl_print(FILE *outfp, const struct options * const options, struct xvfs_state *xvfs_state, char *command) {
static void parse_xvfs_minirivet_handle_tcl_print(FILE *outfp, const struct xvfs_options * const options, struct xvfs_state *xvfs_state, char *command) {
	char *buffer_p, *buffer_e;

	buffer_p = command;
	while (*buffer_p && isspace(*buffer_p)) {
		buffer_p++;
	}

324
325
326
327
328
329
330
331

332
333
334
335
336
337
338
324
325
326
327
328
329
330

331
332
333
334
335
336
337
338







-
+







	} else {
		fprintf(outfp, "@INVALID@%s@INVALID@", buffer_p);
	}

	return;
}

static int parse_xvfs_minirivet(FILE *outfp, const char * const template, const struct options * const options) {
static int parse_xvfs_minirivet(FILE *outfp, const char * const template, const struct xvfs_options * const options) {
	struct xvfs_state xvfs_state;
	int ch, ch_buf;
	int template_idx = 0;
	char tcl_buffer[8192], *tcl_buffer_p;
	enum xvfs_minirivet_mode mode;

	xvfs_state.child_count = 0;
408
409
410
411
412
413
414
415

416
417
418
419
420
421
422
408
409
410
411
412
413
414

415
416
417
418
419
420
421
422







-
+







	}

#undef parse_xvfs_minirivet_getbyte

	return(1);
}

static int xvfs_create(FILE *outfp, const struct options * const options) {
static int xvfs_create(FILE *outfp, const struct xvfs_options * const options) {
	const int template_len = 65536;
	const char * const template_file = "lib/xvfs/xvfs.c.rvt";
	FILE *fp;
	char *template, *template_p;
	int template_remain;
	size_t fread_ret;
	int retval;
456
457
458
459
460
461
462
463

464
465
466
467
468
469
470
456
457
458
459
460
461
462

463
464
465
466
467
468
469
470







-
+








	return(retval);
}

/*
 * Parse command line options
 */
static int parse_options(int argc, char **argv, struct options *options) {
static int parse_options(int argc, char **argv, struct xvfs_options *options) {
	char *arg;
	char **option;
	int idx;
	int retval;

	for (idx = 0; idx < argc; idx++) {
		arg = argv[idx];
495
496
497
498
499
500
501
502

503
504
505
506
507
508
509
495
496
497
498
499
500
501

502
503
504
505
506
507
508
509







-
+







		retval = 0;
	}

	return(retval);
}

int main(int argc, char **argv) {
	struct options options = {0};
	struct xvfs_options options = {0};
	int parse_options_ret, xvfs_create_ret;

	argc--;
	argv++;

	parse_options_ret = parse_options(argc, argv, &options);
	if (!parse_options_ret) {