Commit 35784444 authored by dscho's avatar dscho

fixed cargs (segmentation fault!)

parent 49c2d82d
fixed long standing cargs bug
Even better x11vnc from Karl J. Runge! (supports different kbd layouts of
client/server)
Better x11vnc from Karl J. Runge! Better x11vnc from Karl J. Runge!
fixed severe bug (Const Kaplinsky) fixed severe bug (Const Kaplinsky)
got patch from Const Kaplisnky with CursorPosUpdate encoding and some Docs got patch from Const Kaplisnky with CursorPosUpdate encoding and some Docs
......
...@@ -53,7 +53,7 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]) ...@@ -53,7 +53,7 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
if(!argc) return; if(!argc) return;
for (i = i1 = 1; i < *argc; i++) { for (i = i1 = 1; i < *argc;) {
if (strcmp(argv[i], "-help") == 0) { if (strcmp(argv[i], "-help") == 0) {
rfbUsage(); rfbUsage();
exit(1); exit(1);
...@@ -73,7 +73,7 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]) ...@@ -73,7 +73,7 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
passwds[1] = 0; passwds[1] = 0;
rfbScreen->rfbAuthPasswdData = (void*)passwds; rfbScreen->rfbAuthPasswdData = (void*)passwds;
rfbScreen->passwordCheck = rfbCheckPasswordByList; rfbScreen->passwordCheck = rfbCheckPasswordByList;
} else if (strcmp(argv[i], "-deferupdate") == 0) { /* -desktop desktop-name */ } else if (strcmp(argv[i], "-deferupdate") == 0) { /* -deferupdate milliseconds */
if (i + 1 >= *argc) rfbUsage(); if (i + 1 >= *argc) rfbUsage();
rfbScreen->rfbDeferUpdateTime = atoi(argv[++i]); rfbScreen->rfbDeferUpdateTime = atoi(argv[++i]);
} else if (strcmp(argv[i], "-desktop") == 0) { /* -desktop desktop-name */ } else if (strcmp(argv[i], "-desktop") == 0) { /* -desktop desktop-name */
...@@ -85,19 +85,14 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]) ...@@ -85,19 +85,14 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
rfbScreen->rfbNeverShared = TRUE; rfbScreen->rfbNeverShared = TRUE;
} else if (strcmp(argv[i], "-dontdisconnect") == 0) { } else if (strcmp(argv[i], "-dontdisconnect") == 0) {
rfbScreen->rfbDontDisconnect = TRUE; rfbScreen->rfbDontDisconnect = TRUE;
} else if (strcmp(argv[i], "-width") == 0) {
rfbScreen->width = atoi(argv[++i]);
} else if (strcmp(argv[i], "-height") == 0) {
rfbScreen->height = atoi(argv[++i]);
} else { } else {
/* we just remove the processed arguments from the list */ /* we just remove the processed arguments from the list */
if(i != i1) if(i != i1)
rfbPurgeArguments(argc,&i,i1-i,argv); rfbPurgeArguments(argc,&i1,i-i1,argv);
i1++;
i++;
} }
i1++;
i=i1;
} }
*argc -= i-i1;
} }
void rfbSizeUsage() void rfbSizeUsage()
...@@ -113,7 +108,7 @@ rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[]) ...@@ -113,7 +108,7 @@ rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[])
int i,i1; int i,i1;
if(!argc) return; if(!argc) return;
for (i = i1 = 1; i < *argc-1; i++) { for (i = i1 = 1; i < *argc-1;) {
if (strcmp(argv[i], "-bpp") == 0) { if (strcmp(argv[i], "-bpp") == 0) {
*bpp = atoi(argv[++i]); *bpp = atoi(argv[++i]);
} else if (strcmp(argv[i], "-width") == 0) { } else if (strcmp(argv[i], "-width") == 0) {
...@@ -122,14 +117,12 @@ rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[]) ...@@ -122,14 +117,12 @@ rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[])
*height = atoi(argv[++i]); *height = atoi(argv[++i]);
} else { } else {
/* we just remove the processed arguments from the list */ /* we just remove the processed arguments from the list */
if(i != i1) { if(i != i1)
memmove(argv+i1,argv+i,sizeof(char*)*(*argc-i)); if(i != i1)
*argc -= i-i1; rfbPurgeArguments(argc,&i1,i-i1,argv);
} }
i1++; i1++;
i = i1-1; i=i1;
}
} }
*argc -= i-i1;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment