compiler.h: add 'gcc' secific 'GCCISM' wrapper

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
debug.h: mark 'printf'-alike functions as such for 'gcc'

Allows catching format argument mismatch like those:

    cvsps.c:238:9: warning: format '%s' expects a matching 'char *' argument [-Wformat]
    cvsps.c:242:9: warning: format '%s' expects a matching 'char *' argument [-Wformat]

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
cvsps.c: fixed argument format mismatch

cvsps.c:238:9: warning: format «%s» expects a matching «char *» argument [-Wformat]
cvsps.c:242:9: warning: format «%s» expects a matching «char *» argument [-Wformat]
cvsps.c:2955:5: warning: format «%d» expects argument of type «int», but argument 3 has type «time_t» [-Wformat]
cvsps.c:2955:5: warning: format «%d» expects argument of type «int», but argument 4 has type «time_t» [-Wformat]

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
cvsclient.c: don't return trash buffer when 'E ' is returned from first 'cvs rlog' entries

Found by valgrind:

    $ valgrind ./cvsps --fast-export --root $CVSROOT -p z/ --debuglvl 0xff Kernel

    cvsps: cvsclient: rlog: read E cvs rlog: Logging Kernel
    cvsps: cvs rlog: Logging Kernel
    ==27619== Conditional jump or move depends on uninitialised value(s)
    ==27619==    at 0x50938F2: vfprintf (vfprintf.c:1642)
    ==27619==    by 0x514361F: __vsnprintf_chk (vsnprintf_chk.c:63)
    ==27619==    by 0x10B7D4: vdebug (stdio2.h:77)
    ==27619==    by 0x10CFED: debug (debug.h:52)
    ==27619==    by 0x11095B: load_from_cvs (cvsps.c:338)
    ==27619==    by 0x10AA19: main (cvsps.c:197)
    ==27619==  Uninitialised value was created by a stack allocation
    ==27619==    at 0x11089F: load_from_cvs (cvsps.c:301)

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
cvsps.c: speedup blob dumping by using block-size I/O

Patch reduces libc overhead:
  around 20% CPU time is wasted by fgetc()/putchar()
  before the patch according to perf.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
cvsclient.c: switch to binary (non-pipe mode for received files

The problem:

  When text file is stored without a trailing newline
  GNU CVSNT server (on windows) refuses to
  return "ok\n" in a separate line on 'cvs -p up' command.

  In this situation 'cvsps' gets last line like "M <hello>ok\n"
  and hangs as it waits for separate "ok\n" line.

  pipe mode also does not allow importing binary files
  if client does not support 'Mbinary'.

This patch solves the problem by switching to non-pipe mode
for 'cvs update'.

In this mode every checkout is prepended by amount of bytes
in response.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Call strftime() in context of committer's TZ.

The initial patch for calculating the fast-export timestamp using the
TZ field of the authors file was broken.  strftime() should have been
called in the context of the committer's timezone along with
localtime().

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Fix authors map when -C <git_repository> is specified.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Remove redundant "cvsps: " prefix from messages.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
cvsclient.c: mark 'send_string' as printf-alike and fix found errors

cvsclient.c: In function 'open_cvs_server':
cvsclient.c:130:2: warning: too many arguments for format [-Wformat-extra-args]
cvsclient.c: In function 'cvs_diff':
cvsclient.c:879:2: warning: too many arguments for format [-Wformat-extra-args]

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
tcpsocket.c: fix actual error on name resolution failure

Found by gcc:

tcpsocket.c: In function 'convert_address':
tcpsocket.c:227:7: warning: too many arguments for format [-Wformat-extra-args]

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
tcpsocket.c: disable Nagle's algorithm for sent commands

Sent commands are very short, like "cvs co foo", "cvs co bar".
We pair them with large receive commands.
The faster we will send them out the faster we will receive
the result. Nagle's algorithm does not allow sending
requests faster, than 5 checkouts per second.

The patch speedups importing my real repository
(30 000 checkouts) from 90 minutes down to 5 minutes.

It means patch speedups from 5 checkouts to
100 checkouts per second.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Test load needed to be rebuilt for Chris Rorvick's fix.
Version bump for 3.7 release.
Avoid a compiler warning.
Explain some magic.
More fun with test loads, sigh.  Timezones suck.