intfiction.org

The Interactive Fiction Community Forum
It is currently Mon Aug 21, 2017 6:28 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 12 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed Aug 09, 2017 6:08 pm 
Offline
User avatar

Joined: Sat Jun 25, 2016 12:13 pm
Posts: 135
Hi, nice update.

I made some changes in `GetFileNames`, there are some bugfixes, but the usage message is optional but helpful.

Code:
int32_t GetFileNames(nr_args, args, input, output)
 int  nr_args;
 char **args;
 char *input;
 char *output;
{
  int i = 1;
  int ok = 1;

  /* the command 'compiler' itself is stored in argv[0] */

  input[0]  = '\0';
  output[0] = '\0';

  while (i<nr_args) {
    if (strcmp(args[i], "-i") == 0) {
      if (nr_args > i+1) {
        /* inputfile was specified */
        strncpy(input, args[++i], MAX_ID_LENGTH);
      }
    }
    else
      if (strcmp(args[i], "-o") == 0) {
        if (nr_args > i+1) {
          /* outputfile was specified */
          strncpy(output, args[++i], MAX_ID_LENGTH);
        }
      }
      else {
        if (strcmp(args[i], "-d") == 0) {
          /* set debug compile mode */
          /* implement this later   */
        }
        else {
          printf("Unknown commandline option: %s\n\n", args[i]);
          ok = 0;
        }
      }
    ++i;
  }

  if (!ok)
  {
      printf("Usage: %s [-i <inputfile>] [-o <outputfile>] [-d <level>]\n",
             args[0]);
      return ERROR;
  }


Top
 Profile Send private message  
 
PostPosted: Tue Aug 15, 2017 7:29 am 
Offline

Joined: Wed Aug 26, 2015 11:18 am
Posts: 71
Location: The Netherlands
Thanks for pointing that out. I feel really stupid, don know how that could have slipped through :-(


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group