Refactor commandline handling

- instead of having the list of commandline arguments, their handlers
   and their help strings in different places, unify them in a single
   array
 - this allows to only change one piece of code when adding new
   arguments
This commit is contained in:
josch
2014-09-16 12:40:52 +02:00
parent e8f3164374
commit 08b808f893
20 changed files with 199 additions and 177 deletions

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 Bryan Christ <bryan.christ@mediafire.com>
* 2014 Johannes Schauer <j.schauer@email.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2, as published by
@@ -27,13 +28,18 @@
#include "private.h"
int
mfshell_cmd_lpwd(mfshell_t *mfshell)
mfshell_cmd_lpwd(mfshell_t *mfshell, int argc, char **argv)
{
extern int term_width;
int trim_size;
if(mfshell == NULL) return -1;
if (argc != 1) {
fprintf(stderr, "Invalid number of argumens\n");
return -1;
}
if(mfshell->local_working_dir == NULL)
{
mfshell->local_working_dir = (char*)calloc(PATH_MAX + 1,sizeof(char));