gnats-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to gnats/gnats/cmds.c


From: Yngve Svendsen
Subject: Changes to gnats/gnats/cmds.c
Date: Mon, 14 Oct 2002 07:42:25 -0400

Index: gnats/gnats/cmds.c
diff -c gnats/gnats/cmds.c:1.69 gnats/gnats/cmds.c:1.70
*** gnats/gnats/cmds.c:1.69     Mon Aug 12 08:33:30 2002
--- gnats/gnats/cmds.c  Mon Oct 14 07:42:25 2002
***************
*** 318,328 ****
        printf ("%d %s\r\n", CODE_INFORMATION,
              access_level_str (user_access));
      }
!   else if (ac == 2)
      {
        if (databaseValid (currentDatabase))
        {
!         if (gnatsdChdb (databaseName (currentDatabase), av[0], av[1], 0,
                          &err) != 0)
            {
              print_server_errors (err);
--- 318,328 ----
        printf ("%d %s\r\n", CODE_INFORMATION,
              access_level_str (user_access));
      }
!   else if ((ac == 1) || (ac == 2))
      {
        if (databaseValid (currentDatabase))
        {
!         if (gnatsdChdb (databaseName (currentDatabase), av[0], ac == 2 ? 
av[1] : "", 0,
                          &err) != 0)
            {
              print_server_errors (err);
***************
*** 339,352 ****
              free (currentPassword);
            }
          currentUsername = xstrdup (av[0]);
!         currentPassword = xstrdup (av[1]);
          printf ("%d Current database is not valid; use CHDB to set the 
database\r\n",
                  CODE_OK);
        }
      }
    else
      {
!       printf ("%d Need two arguments, username and password\r\n", 
              CODE_CMD_ERROR);
      }
  }
--- 339,359 ----
              free (currentPassword);
            }
          currentUsername = xstrdup (av[0]);
!         if (ac == 2)
!           {
!             currentPassword = xstrdup (av[1]);
!           }
!         else
!           {
!             currentPassword = (char *)"";
!           }
          printf ("%d Current database is not valid; use CHDB to set the 
database\r\n",
                  CODE_OK);
        }
      }
    else
      {
!       printf ("%d Need one or two arguments, username and optionally a 
password\r\n", 
              CODE_CMD_ERROR);
      }
  }
***************
*** 591,605 ****
          free (currentUsername);
        }
        currentUsername = xstrdup (username);
!     }
! 
!   if (passwd != NULL)
!     {
        if (currentPassword != NULL)
        {
          free (currentPassword);
        }
!       currentPassword = xstrdup (passwd);
      }
  
    if (currentUsername == NULL)
--- 598,616 ----
          free (currentUsername);
        }
        currentUsername = xstrdup (username);
!       
        if (currentPassword != NULL)
        {
          free (currentPassword);
        }
!       if (passwd != NULL)
!       {
!         currentPassword = xstrdup (passwd);
!       }
!       else
!       {
!         currentPassword = NULL;
!       }
      }
  
    if (currentUsername == NULL)
***************
*** 670,678 ****
    const char *user = NULL;
    const char *passwd = NULL;
  
!   if (ac != 1 && ac != 3)
      {
!       printf ("%d One or three arguments required.\r\n", CODE_CMD_ERROR); 
        return;
      }
  
--- 681,689 ----
    const char *user = NULL;
    const char *passwd = NULL;
  
!   if (ac != 1 && ac != 2 && ac != 3)
      {
!       printf ("%d One, two, or three arguments required.\r\n", 
CODE_CMD_ERROR); 
        return;
      }
  
***************
*** 681,686 ****
--- 692,701 ----
        user = av[1];
        passwd = av[2];
      }
+   else if (ac == 2)
+     {
+       user = av[1];
+     }
  
    if (gnatsdChdb (av[0], user, passwd, 0, &err) != 0)
      {
***************
*** 1786,1796 ****
          CODE_INFORMATION);
    printf ("%d-   SUBM                    submit a new PR\r\n",
          CODE_INFORMATION);
!   printf ("%d-   CHDB <database> [<user> <passwd>]\r\n",
          CODE_INFORMATION);
    printf ("%d-                           change GNATS ROOT to <database>\r\n",
          CODE_INFORMATION);
!   printf ("%d-   USER <name> <passwd>    Sets the current user\r\n",
          CODE_INFORMATION);
    printf ("%d-   USER                    Report current access level\r\n",
          CODE_INFORMATION);
--- 1801,1811 ----
          CODE_INFORMATION);
    printf ("%d-   SUBM                    submit a new PR\r\n",
          CODE_INFORMATION);
!   printf ("%d-   CHDB <database> [<user> [<passwd>]]\r\n",
          CODE_INFORMATION);
    printf ("%d-                           change GNATS ROOT to <database>\r\n",
          CODE_INFORMATION);
!   printf ("%d-   USER <name> [<passwd>]  Sets the current user\r\n",
          CODE_INFORMATION);
    printf ("%d-   USER                    Report current access level\r\n",
          CODE_INFORMATION);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]