frobnicate parameters handling

This commit is contained in:
tTh 2023-04-28 00:02:04 +02:00
parent 85f1867424
commit 895e61cbb6
1 changed files with 11 additions and 10 deletions

View File

@ -73,13 +73,13 @@ return 0; /* allway success ? */
}
/* --------------------------------------------------------------------- */
/* EXPERIMENTAL GRUIK-CODE !!! */
int load_and_printf_evblob(char *filename, int mode)
int load_and_printf_evblob(char *filename, char *outmode)
{
EdgesAndVertices eav;
int foo;
int foo, mode;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, filename, mode);
fprintf(stderr, ">>> %s ( '%s' %s )\n", __func__, filename, outmode);
#endif
memset(&eav, 0, sizeof(EdgesAndVertices));
@ -98,13 +98,17 @@ if (verbosity > 1) {
eav.Elist->fidx);
}
mode = 666;
if (! strcasecmp("edges", outmode)) { mode = 0; }
else if (! strcasecmp("vertices", outmode)) { mode = 1; }
switch (mode) {
case 0:
printf_the_edges(&eav); break;
case 1:
printf_the_vertices(&eav); break;
default:
fprintf(stderr, "no way to do %d\n", mode);
fprintf(stderr, "no way to do '%s'\n", outmode);
exit(1);
break;
}
@ -124,7 +128,7 @@ exit(0);
int main(int argc, char *argv[])
{
int opt, foo;
int outmode = 0;
char *outmode = "vertices";
fprintf(stderr, "### Export EVblob (%s %s)\n", __DATE__, __TIME__);
@ -137,11 +141,8 @@ while ((opt = getopt(argc, argv, "ht:v")) != -1) {
case 'v':
verbosity++; break;
case 't':
// fprintf(stderr, "t -> %s\n", optarg);
switch(optarg[0]) {
case 'e': outmode=0; break;
case 'v': outmode=1; break;
}
fprintf(stderr, "type -> '%s'\n", optarg);
outmode = optarg;
break;
default:
exit(1);