diff options
author | dscho <dscho> | 2004-05-25 09:05:09 +0000 |
---|---|---|
committer | dscho <dscho> | 2004-05-25 09:05:09 +0000 |
commit | 876868553da8f69ed1a368688b6d01a8a7bc1a39 (patch) | |
tree | 0bf872ebeadb746eec0f4695230c8777680ece9f /cargs.c | |
parent | 0130bdb9d6c61e0446ab514816041f1b9283410a (diff) | |
download | libtdevnc-876868553da8f69ed1a368688b6d01a8a7bc1a39.tar.gz libtdevnc-876868553da8f69ed1a368688b6d01a8a7bc1a39.zip |
move the library into libvncserver/, x11vnc into x11vnc/
Diffstat (limited to 'cargs.c')
-rw-r--r-- | cargs.c | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/cargs.c b/cargs.c deleted file mode 100644 index c26050e..0000000 --- a/cargs.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * This parses the command line arguments. It was seperated from main.c by - * Justin Dearing <jdeari01@longisland.poly.edu>. - */ - -/* - * LibVNCServer (C) 2001 Johannes E. Schindelin <Johannes.Schindelin@gmx.de> - * Original OSXvnc (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>. - * Original Xvnc (C) 1999 AT&T Laboratories Cambridge. - * All Rights Reserved. - * - * see GPL (latest version) for full details - */ - -#include <rfb/rfb.h> - -void -rfbUsage(void) -{ - fprintf(stderr, "-rfbport port TCP port for RFB protocol\n"); - fprintf(stderr, "-rfbwait time max time in ms to wait for RFB client\n"); - fprintf(stderr, "-rfbauth passwd-file use authentication on RFB protocol\n" - " (use 'storepasswd' to create a password file)\n"); - fprintf(stderr, "-passwd plain-password use authentication \n" - " (use plain-password as password, USE AT YOUR RISK)\n"); - fprintf(stderr, "-deferupdate time time in ms to defer updates " - "(default 40)\n"); - fprintf(stderr, "-desktop name VNC desktop name (default \"LibVNCServer\")\n"); - fprintf(stderr, "-alwaysshared always treat new clients as shared\n"); - fprintf(stderr, "-nevershared never treat new clients as shared\n"); - fprintf(stderr, "-dontdisconnect don't disconnect existing clients when a " - "new non-shared\n" - " connection comes in (refuse new connection " - "instead)\n"); - fprintf(stderr, "-httpdir dir-path enable http server using dir-path home\n"); - fprintf(stderr, "-httpport portnum use portnum for http connection\n"); - fprintf(stderr, "-enablehttpproxy enable http proxy support\n"); - fprintf(stderr, "-progressive height enable progressive updating for slow links\n"); -} - -/* purges COUNT arguments from ARGV at POSITION and decrements ARGC. - POSITION points to the first non purged argument afterwards. */ -void rfbPurgeArguments(int* argc,int* position,int count,char *argv[]) -{ - int amount=(*argc)-(*position)-count; - if(amount) - memmove(argv+(*position),argv+(*position)+count,sizeof(char*)*amount); - (*argc)-=count; -} - -rfbBool -rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]) -{ - int i,i1; - - if(!argc) return TRUE; - - for (i = i1 = 1; i < *argc;) { - if (strcmp(argv[i], "-help") == 0) { - rfbUsage(); - return FALSE; - } else if (strcmp(argv[i], "-rfbport") == 0) { /* -rfbport port */ - if (i + 1 >= *argc) { - rfbUsage(); - return FALSE; - } - rfbScreen->rfbPort = atoi(argv[++i]); - } else if (strcmp(argv[i], "-rfbwait") == 0) { /* -rfbwait ms */ - if (i + 1 >= *argc) { - rfbUsage(); - return FALSE; - } - rfbScreen->rfbMaxClientWait = atoi(argv[++i]); - } else if (strcmp(argv[i], "-rfbauth") == 0) { /* -rfbauth passwd-file */ - if (i + 1 >= *argc) { - rfbUsage(); - return FALSE; - } - rfbScreen->rfbAuthPasswdData = argv[++i]; - } else if (strcmp(argv[i], "-passwd") == 0) { /* -passwd password */ - char **passwds = malloc(sizeof(char**)*2); - if (i + 1 >= *argc) { - rfbUsage(); - return FALSE; - } - passwds[0] = argv[++i]; - passwds[1] = 0; - rfbScreen->rfbAuthPasswdData = (void*)passwds; - rfbScreen->passwordCheck = rfbCheckPasswordByList; - } else if (strcmp(argv[i], "-deferupdate") == 0) { /* -deferupdate milliseconds */ - if (i + 1 >= *argc) { - rfbUsage(); - return FALSE; - } - rfbScreen->rfbDeferUpdateTime = atoi(argv[++i]); - } else if (strcmp(argv[i], "-desktop") == 0) { /* -desktop desktop-name */ - if (i + 1 >= *argc) { - rfbUsage(); - return FALSE; - } - rfbScreen->desktopName = argv[++i]; - } else if (strcmp(argv[i], "-alwaysshared") == 0) { - rfbScreen->rfbAlwaysShared = TRUE; - } else if (strcmp(argv[i], "-nevershared") == 0) { - rfbScreen->rfbNeverShared = TRUE; - } else if (strcmp(argv[i], "-dontdisconnect") == 0) { - rfbScreen->rfbDontDisconnect = TRUE; - } else if (strcmp(argv[i], "-httpdir") == 0) { /* -httpdir directory-path */ - if (i + 1 >= *argc) { - rfbUsage(); - return FALSE; - } - rfbScreen->httpDir = argv[++i]; - } else if (strcmp(argv[i], "-httpport") == 0) { /* -httpport portnum */ - if (i + 1 >= *argc) { - rfbUsage(); - return FALSE; - } - rfbScreen->httpPort = atoi(argv[++i]); - } else if (strcmp(argv[i], "-enablehttpproxy") == 0) { - rfbScreen->httpEnableProxyConnect = TRUE; - } else if (strcmp(argv[i], "-progressive") == 0) { /* -httpport portnum */ - if (i + 1 >= *argc) { - rfbUsage(); - return FALSE; - } - rfbScreen->progressiveSliceHeight = atoi(argv[++i]); - } else { - i++; - i1=i; - continue; - } - /* we just remove the processed arguments from the list */ - rfbPurgeArguments(argc,&i1,i-i1+1,argv); - i=i1; - } - return TRUE; -} - -void rfbSizeUsage() -{ - fprintf(stderr, "-width sets the width of the framebuffer\n"); - fprintf(stderr, "-height sets the height of the framebuffer\n"); -} - -rfbBool -rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[]) -{ - int i,i1; - - if(!argc) return TRUE; - for (i = i1 = 1; i < *argc-1;) { - if (strcmp(argv[i], "-bpp") == 0) { - *bpp = atoi(argv[++i]); - } else if (strcmp(argv[i], "-width") == 0) { - *width = atoi(argv[++i]); - } else if (strcmp(argv[i], "-height") == 0) { - *height = atoi(argv[++i]); - } else { - i++; - i1=i; - continue; - } - rfbPurgeArguments(argc,&i1,i-i1,argv); - i=i1; - } - return TRUE; -} - |