diff --git a/kordophone/main.m b/kordophone/main.m index 2f45503..169407c 100644 --- a/kordophone/main.m +++ b/kordophone/main.m @@ -17,6 +17,7 @@ void printUsage() fprintf(stderr, "\t-s \t Use SSL (requires -c option)\n"); fprintf(stderr, "\t-c \t SSL certificate path encoded as pkcs12\n"); fprintf(stderr, "\t-a \t Optional access control file\n"); + fprintf(stderr, "\t-p \t Specify port number (default: 5738)\n"); } BOOL acquireCredentials(bool encrypted, const char *accessFile, NSString **out_username, NSString **out_password) @@ -104,11 +105,12 @@ int main(int argc, char *const argv[]) { BOOL usesSSL = NO; BOOL showHelp = NO; BOOL usesAccessControl = NO; + long portNumber = -1; const char *certPath = NULL; const char *accessFilePath = NULL; int c = -1; - while ( (c = getopt(argc, argv, "hsc:a:")) != -1 ) { + while ( (c = getopt(argc, argv, "hsc:a:p:")) != -1 ) { switch (c) { case 's': usesSSL = YES; @@ -120,6 +122,9 @@ int main(int argc, char *const argv[]) { usesAccessControl = YES; accessFilePath = optarg; break; + case 'p': + portNumber = strtol(optarg, NULL, 10); + break; case 'h': showHelp = YES; break; @@ -181,6 +186,10 @@ int main(int argc, char *const argv[]) { bridge.sslCertPath = [NSString stringWithCString:certPath encoding:NSASCIIStringEncoding]; } + if (portNumber > 0) { + bridge.port = portNumber; + } + [bridge connect]; BOOL running = YES;