Commit 6a1a59f9 authored by dscho's avatar dscho

fix cargs.c: arguments were not correctly purged.

parent 5df82de5
2004-03-22 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
* fix cargs.c (hopefully for the last time):
arguments were not correctly purged
2004-03-15 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
* fix libvncserver-config to again return a linker when
called with --link
......
......@@ -46,7 +46,6 @@ void rfbPurgeArguments(int* argc,int* position,int count,char *argv[])
if(amount)
memmove(argv+(*position),argv+(*position)+count,sizeof(char*)*amount);
(*argc)-=count;
(*position)--;
}
rfbBool
......@@ -127,11 +126,12 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
}
rfbScreen->progressiveSliceHeight = atoi(argv[++i]);
} else {
/* we just remove the processed arguments from the list */
if(i != i1)
rfbPurgeArguments(argc,&i1,i-i1,argv);
i++;
i1=i;
continue;
}
i1++;
/* we just remove the processed arguments from the list */
rfbPurgeArguments(argc,&i1,i-i1+1,argv);
i=i1;
}
return TRUE;
......@@ -157,12 +157,11 @@ rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[])
} else if (strcmp(argv[i], "-height") == 0) {
*height = atoi(argv[++i]);
} else {
/* we just remove the processed arguments from the list */
if(i != i1)
if(i != i1)
rfbPurgeArguments(argc,&i1,i-i1,argv);
i++;
i1=i;
continue;
}
i1++;
rfbPurgeArguments(argc,&i1,i-i1,argv);
i=i1;
}
return TRUE;
......
CFLAGS=-I.. -g -Wall
noinst_PROGRAMS=tight-1
noinst_PROGRAMS=tight-1 cargstest
LDADD = ../libvncserver.a ../libvncclient/libvncclient.a
#include <rfb/rfb.h>
int main(int argc,char** argv)
{
int fake_argc=6;
char* fake_argv[6]={
"dummy_program","-alwaysshared","-httpport","3002","-nothing","-dontdisconnect"
};
rfbScreenInfoPtr screen;
rfbBool ret=0;
screen = rfbGetScreen(&fake_argc,fake_argv,1024,768,8,3,1);
#define CHECK(a,b) if(screen->a!=b) { fprintf(stderr,#a " is %d (should be " #b ")\n",screen->a); ret=1; }
CHECK(width,1024);
CHECK(height,768);
CHECK(rfbAlwaysShared,TRUE);
CHECK(httpPort,3002);
CHECK(rfbDontDisconnect,TRUE);
if(fake_argc!=2) {
fprintf(stderr,"fake_argc is %d (should be 2)\n",fake_argc);
ret=1;
}
if(strcmp(fake_argv[1],"-nothing")) {
fprintf(stderr,"fake_argv[1] is %s (should be -nothing)\n",fake_argv[1]);
ret=1;
}
return ret;
}
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