summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-10-02Refactor fd closing into CloseFD helper functionAlan Coopersmith3-15/+21
All versions now perform same check for XtransConn data to decide whether to use _X11TransClose or regular close, which is needed for being able to read data from pre-recorded files instead of live sockets. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2012-10-02When Verbose == 0, don't print number of data items in unknown reply typesAlan Coopersmith2-0/+5
We don't print any other data from packet when Verbose == 0, just had a few random "data: (6)" type lines sneak through. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Add -I command line flag to enter interactive mode at startupAlan Coopersmith2-2/+12
Avoids having to try to time a ^C after the signal handler is set up but before any data is handled. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Add support for printing more types of property valueAlan Coopersmith1-2/+43
Prints atoms, cardinals, integers, and windows as formatted values instead of lists of bytes. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Print UTF8_STRING properties as text if locale uses UTF-8 charsetAlan Coopersmith4-6/+42
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2012-10-02Create PrintPropertyValues function for property requestsAlan Coopersmith3-11/+26
Currently used for core protocol window properties, but will be used for extensions that have similar property handling requests in the future. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Record atoms from InternAtom and GetAtomName requestsAlan Coopersmith5-28/+157
Uses them to display strings instead of just numeric ids for atoms beyond the builtin set in other requests, such as property lookups. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Convert ValueRec structures from unsigned long to uint32_t valuesAlan Coopersmith4-19/+19
Used for GC struct members, which are defined in the protocol as 32-bit, so no need to waste time and memory copying into 64-bit longs everywhere Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Handle big-requests when calculating request contents from length fieldAlan Coopersmith3-35/+49
Adds a getreqlen inline function to handle the big requests check. As noted in the comment, it must be called *before* the printreqlen macro does its own check, since printreqlen "fixes" the buf pointer when it's done to align all the remaining fields with their correct positions after skipping over the extra big requests 32-bit length field after the normal 16-bit length field. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02ILong: shift each byte individually, then OR them togetherAlan Coopersmith1-2/+2
instead of shifting the whole word as each byte is loaded into place Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Move ILong, IShort, etal to inline functions in x11.hAlan Coopersmith3-65/+58
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Convert ILong, IShort, etal to return C99 uint*_t typesAlan Coopersmith2-8/+10
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Convert remaining bcopy() calls to memcpy()Alan Coopersmith3-5/+5
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2012-10-02Add _X_NORETURN to additional functions suggested by gcc warningsAlan Coopersmith2-4/+4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-10-02Convert remaining sprintf calls to snprintfAlan Coopersmith4-9/+11
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2012-10-02SaveBytes: drop unnecessary casts in bcopy() callAlan Coopersmith1-3/+3
Clears gcc warning from casting a const char * to char *: server.c: In function `SaveBytes': server.c:203: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2012-10-02Move debug statement before panic() call, so it can actually runAlan Coopersmith1-1/+1
Fixes compiler warning: "fd.c", line 481: warning: statement not reached Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-21Define *HEADER constants as string pointers, not arraysAlan Coopersmith2-5/+5
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-21Combine usage message into single string for fprintfAlan Coopersmith1-12/+13
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-21Use local variable for ioctl argument instead of a staticAlan Coopersmith1-2/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-21Convert to X.Org standard indentation & cleanup whitespaceAlan Coopersmith43-12263/+11748
Performed with util/modular/x-indent-all.sh, followed by manual fixups Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-21Convert Keith's personal license notice to X.Org standard MIT license noticeAlan Coopersmith9-157/+103
Acked-by: Keith Packard <keithp@keithp.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-20Convert sources from ISO 8859-1 to UTF-8Alan Coopersmith11-14/+14
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-08Retry _X11TransConnect on TRANS_TRY_CONNECT_AGAINJeff Smith1-4/+7
Reading through Xtranssock.c reveals that when _X11TransConnect returns the value TRANS_TRY_CONNECT_AGAIN, it turns off the abstract socket flag, so that attempting _X11TransConnect might succeed the second time where it failed the first time. Now xscope will attempt the connection a second time when it receives the TRANS_TRY_CONNECT_AGAIN return value on the first connection attempt. Signed-off-by: Jeff Smith <whydoubt@yahoo.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-08Bug 46696 - Try alternate protocol on X11 connection failure.Peter Jeremy1-13/+23
In USE_XTRANS mode, MakeConnection() cycles through a selection of protocol choices until it finds one where it can open a socket to the server. It then attempts an X11 connection via that socket and aborts if one isn't possible. This patch modifies the code to try an alternate protocol if the X11 connection fails. https://bugs.freedesktop.org/show_bug.cgi?id=46696 Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-08Bug 46691 - xscope-1.3.1 deadlocks if client or server would blockPeter Jeremy1-1/+1
https://bugs.freedesktop.org/show_bug.cgi?id=46691 Use correct write FD to select() on. FlushFD() contains logic to handle the Xclient or Xserver blocking on a write() by changing the global read and write fd_set's so that MainLoop() will select() on the blocking write FD instead of the peer read FD. Unfortunately, the code contains a logic error so that it winds up select()ing for write on the peer FD instead of the blocked FD. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-08Use __XFDS_BITS macros from Xpoll.h instead of direct __fds_bits accessAlan Coopersmith1-2/+7
Different platforms use different names for the fd_set members, so use the existing Xpoll.h macros for greater portability. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-08Bug 46689 - xscope fd_set debug output is undefinedPeter Jeremy1-4/+3
https://bugs.freedesktop.org/show_bug.cgi?id=46689 Change fd_set debug output to display actual contents of first 32 or 64 bits. In xscope-1.3.1, MainLoop() contains debug(128,...) code that appears intended to display the fd_set contents before and after the main select() call. In most implementations, fd_set will be a struct though it is printed as an int, thus the actual debug output is unlikely to usefully reflect the actual fd_set contents. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-08Bug 46664 - xscope prints only half the characters in 16-bit stringsPeter Jeremy1-2/+2
https://bugs.freedesktop.org/show_bug.cgi?id=46664 The length fields for PolyText16 and ImageText16 represent the number of 16-bit characters in the request but PrintString16() and PrintTString16() treat the lengths as the number of octets in the string - thus printing only half of the characters. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-11Add link to original xscope paper in READMEAlan Coopersmith1-0/+4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-04Include <arpa/inet.h> for inet_addr in !USE_XTRANS caseJeremy Huddleston1-0/+3
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-02-21xscope 1.3.1xscope-1.3.1Alan Coopersmith1-1/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-01-15Check the right return value for malloc failureAlan Coopersmith1-1/+1
Error detected by Solaris Studio 12.3 code analyzer: WARNING 1 (MRC): missing null-pointer check after malloc: calloc(((ullong)MaxFD),48) at: InitializeFD() <app/xscope/fd.c : 107> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-01-15Mark panic() as _X_NORETURNAlan Coopersmith2-3/+6
Makes the dependency on x11proto explicit - it was already needed for the X11 headers included in various files, but now needs to be at least 7.0.17 for the _X_NORETURN definition in Xfuncproto.h Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Cyril Brulebois <kibi@debian.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-04Fix builds of scope.c with Solaris Studio compilersAlan Coopersmith1-0/+5
Required in order to build with Studio cc now that xorg-macros is setting -errwarn=E_FUNC_HAS_NO_RETURN_STMT since a bug in the Solaris system headers causes the noreturn attribute to not be correctly applied to the exit() prototype in <stdlib.h> when building with Studio instead of gcc. Otherwise compiler exits with error: "scope.c", line 643: Function has no return statement : CMDQuit Uses Studio-specific pragma instead of adding another exit() prototype with a noreturn attribute to avoid causing gcc to warn about having a redundant prototype for the exit() function. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-11-11Remove extra definition of ScopeEnabled from x11.hAlan Coopersmith1-2/+0
It's already defined in scope.h, which is more widely #included and a more logical home for it. Clears a bunch of gcc warnings of: scope.h:125:13: warning: redundant redeclaration of ‘ScopeEnabled’ x11.h:266:13: note: previous declaration of ‘ScopeEnabled’ was here Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-30Add const attributes to clear gcc -Wwrite-strings warningsAlan Coopersmith5-15/+15
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Store ClientNumber as int instead of converting back & forth to longAlan Coopersmith2-2/+2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30File descriptors should be stored in ints not shortsAlan Coopersmith3-7/+7
All OS routines take and return ints for file descriptors, so stop converting back and forth to shorts. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Remove StaticMaxFD now that all uses now allocate dynamicallyAlan Coopersmith2-8/+0
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Make FDinfo dynamically allocatedAlan Coopersmith3-2/+6
We still allocate one fdinfo struct for every possible FD up front instead of resizing as needed, but they're much smaller now that we just have a pointer to the 32k buffer instead of including it directly in the fdinfo. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Allocate buffers dynamically as needed instead of as part of fdinfo structAlan Coopersmith2-1/+17
Previously we'd allocate a buffer of 32k each for each fd up to the compiled in StaticMaxFD, which could be as large as 65535 on some systems (that's the Solaris 64-bit default FD_SETSIZE), resulting in gigabytes of bss allocation on startup. Now we don't allocate until we're actually setting up the fdinfo for use as part of a client<->server connection. Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Make ReplyQ dynamically allocatedAlan Coopersmith1-8/+5
We still allocate a QueueHeader (a struct containing 2 pointers) for every possible FD, instead of allocating only as needed. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Make CS dynamically allocatedAlan Coopersmith3-2/+5
We still allocate one ConnState struct for every possible FD up front instead of resizing as needed. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Ensure ScopeHost global is initialized when built with USE_XTRANSAlan Coopersmith1-8/+7
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Use strdup instead of malloc(strlen+1); strcpy();Alan Coopersmith1-2/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Use calloc() instead of malloc(); bzero();Alan Coopersmith1-2/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Call realloc() instead of open coding itAlan Coopersmith1-5/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Stop wrapping malloc & freeAlan Coopersmith9-48/+33
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-09-30Clean up existing malloc callsAlan Coopersmith3-3/+5
Remove unnecessary casts from (void *) Ensure return value is checked. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>