chiark / gitweb /
Allow for the use of @ in remote host calls
[elogind.git] / src / hostname / hostnamectl.c
index d108a2489dfee175c3a3e2a747af1c5db763d97c..f7d844b9757ba5f7bd695c2e9c05805299c2474a 100644 (file)
@@ -44,7 +44,8 @@ static enum transport {
         TRANSPORT_POLKIT
 } arg_transport = TRANSPORT_NORMAL;
 static bool arg_ask_password = true;
-static const char *arg_host = NULL;
+static char *arg_host = NULL;
+static char *arg_user = NULL;
 static bool arg_set_transient = false;
 static bool arg_set_pretty = false;
 static bool arg_set_static = false;
@@ -421,7 +422,7 @@ static int parse_argv(int argc, char *argv[]) {
 
                 case 'H':
                         arg_transport = TRANSPORT_SSH;
-                        arg_host = optarg;
+                        parse_user_at_host(optarg, &arg_user, &arg_host);
                         break;
 
                 case ARG_SET_TRANSIENT: