Skip to content

Commit

Permalink
Merge pull request #10 from markwal/fixoldmachines
Browse files Browse the repository at this point in the history
Make the dir option work again
  • Loading branch information
dcnewman committed May 31, 2015
2 parents 42a3c04 + bd139bb commit 035cb12
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils/machines.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void usage(void)
printf("machines [-c] [dir]\n");
printf("\nOptions:\n");
printf("\t-c\talso create classic (wrong) machine ini files\n");
printf("\tdir\tdestination directory, must end with separator ('/' or '\\')\n");
}

int main(int argc, char * const argv[])
Expand Down Expand Up @@ -79,8 +80,8 @@ int main(int argc, char * const argv[])
// Directory path
// Must include "/" or "\". You supply it; code is
// a tad more portable that way.
if (argc == 2)
dlen = strlen(argv[1]);
if (argc > 0)
dlen = strlen(argv[0]);

do
{
Expand All @@ -95,7 +96,7 @@ int main(int argc, char * const argv[])
{
FILE *fp;

if (dlen) memcpy(fname, argv[1], dlen);
if (dlen) memcpy(fname, argv[0], dlen);
memcpy(fname + dlen, (*ptr)->type, len);
memcpy(fname + dlen + len, ".ini", 5);
fp = fopen(fname, "w");
Expand Down

0 comments on commit 035cb12

Please sign in to comment.