Changeset - 9c7a6746bc2a
[Not reviewed]
default
0 1 0
ethanzonca@zserver2 - 16 years ago 2009-12-22 23:22:23

Cruddy menu options, needs editing
1 file changed with 22 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/client/distren.c
Show inline comments
 
@@ -40,12 +40,15 @@
 

	
 
int main(int argc, char *argv[])
 
{
 

	
 
  int doLogin = 0;
 

	
 
  char *input;
 
  char *output;
 
  char *jobid;
 

	
 
  char *username;
 
  char *password;
 

	
 
  char curopt;
 

	
 
  distren_t distren;
 
@@ -54,7 +57,7 @@ int main(int argc, char *argv[])
 
  input = NULL;
 
  output = NULL;
 

	
 
  while(-1 != (curopt = getopt(argc, argv, "i:o:h")))
 
  while(-1 != (curopt = getopt(argc, argv, "i:o:u:p:h")))
 
    {
 
      if(curopt == ':')
 
	{
 
@@ -68,7 +71,7 @@ int main(int argc, char *argv[])
 
	}
 
      else if(curopt == 'h')
 
	{
 
	  fprintf(stderr, "Usage: %s -i <inputfile> -o <outputfile>\n", argv[0]);
 
	  fprintf(stderr, "Usage: %s -i <inputfile> -o <outputfile> [ -u <username> -p <password> ]\n", argv[0]);
 
	  fprintf(stderr, "\t-i\tSpecifies the input file\n\
 
\t-o\tSpecifies the output file\n\
 
\t-h\tShows this help message\n");
 
@@ -77,6 +80,14 @@ int main(int argc, char *argv[])
 
	  //  options help page
 
	  
 
	}
 
      else if(curopt == 'u') {
 
        doLogin = 1;
 
        username = strdup(optarg);
 
      }
 
      else if(curopt == 'p') {
 
        doLogin = 1;
 
        password = strdup(optarg);
 
      }
 
      else if(curopt == 'i')
 
	
 
	 //  TODO: is strdup good or bad? what about
 
@@ -91,7 +102,14 @@ int main(int argc, char *argv[])
 
  
 
     // give this error after the general arguments parsing so that
 
     // the general help from options_init can have effect
 
  
 
  if(!username || !password){
 
    fprintf(stderr, "Username and password must be specified");
 
    return 1;
 
  }
 
  if(doLogin == 1){
 
    fprintf(stderr, "Trying username and password on server...");
 
    return 0;
 
  }
 
  if(!input
 
     || !output)
 
    {
0 comments (0 inline, 0 general)