+2021-08-15 Mark Geisert <mark@maxrnd.com>
+
+ * Makefile.am: Add -lkernel32 to src_clip_getclip_LDADD. This somehow
+ didn't make it into the released -3 package. Thank you Takashi Yano.
+ * Fix maintainer build environment issues that caused cygstart crash
+ on non-AVX user systems: Thank you Takashi Yano, Brian Inglis, Achim
+ Gratz and user Jay Abel for reporting the issue.
+ * src/cygdrop/cygdrop.cc: Fix crash with recent gcc and fix printf
+ format strings. Thank you Christian Franke.
+
+2021-07-05 Mark Geisert <mark@maxrnd.com>
+
+ * src/clip/getclip.c: Add Unicode support.
+
2017-07-03 Mark Geisert <mark@maxrnd.com>
Release 1.4.16
libuuid = `${CC} -print-file-name=w32api/libuuid.a`
src_banner_banner_LDADD = -lpopt -lkernel32 -lgdi32
-src_clip_getclip_LDADD = -lpopt
+src_clip_getclip_LDADD = -lpopt -lkernel32
src_clip_putclip_LDADD = -lpopt
src_conv_conv_LDADD = -lpopt
src_cygstart_cygstart_LDADD = -lpopt
* Minor formatting fixes to quash compiler warnings.
* Execute bits removed from files not needing them.
* Temporarily rename /usr/lib/libpopt.la while building package.
+ * Unicode support added to getclip.
1.4.15
New maintainer Mark Geisert <mark@maxrnd.com>.
NAME=cygutils
VERSION=1.4.16
-RELEASE=3
+RELEASE=4
SUMM="A collection of simple utilities"
DESC="A collection of simple (single source file) utilities, including"
#include <io.h>
#include <wchar.h>
#include <sys/cygwin.h>
-#include <w32api/ntstatus.h>
-/* This Windows 7+ function is not yet present in w32api/winternl.h */
-extern NTSYSAPI NTSTATUS RtlUnicodeToUTF8N(PCHAR, ULONG, PULONG, LPWSTR, ULONG);
+#include <w32api/stringapiset.h>
#define DEBUGGING 0 // Set 1 to display debug output on stderr
LPWSTR lpwstr = (LPWSTR) GlobalLock (hglb);
if (lpwstr)
{
- ULONG count;
- ULONG srclen = wcslen (lpwstr) * sizeof (wchar_t); // byte count
- ULONG dstlen = srclen + 32;
- PCHAR dst = (PCHAR) malloc (dstlen);
- NTSTATUS res = RtlUnicodeToUTF8N (dst, dstlen, &count,
- lpwstr, srclen);
+ int srclen = wcslen (lpwstr); // wide-char count
+ int dstlen = srclen << 2; // byte count
+ LPSTR dst = (LPSTR) malloc (dstlen);
+ int res = WideCharToMultiByte (CP_UTF8, 0, lpwstr, srclen,
+ dst, dstlen, NULL, NULL);
+ if (res > 0)
+ fwrite (dst, sizeof (char), res, out);
+ else if (res == 0)
+ {
#if DEBUGGING
- /* look up hex error code displayed here in w32api/ntstatus.h */
- fprintf (stderr, "RtlUnicodeToUTF8N returns 0x%X\n", res);
+ DWORD err = GetLastError ();
+ /* look up error code displayed here in w32api/winerror.h */
+ fprintf (stderr, "WideCharToMultiByte returns %d\n", err);
#endif
- if (res == STATUS_SUCCESS || res == STATUS_SOME_NOT_MAPPED)
- if (count > 0)
- fwrite (dst, sizeof (char), count, out);
+ }
free (dst);
GlobalUnlock (hglb);
}
static void version (FILE * f, const char *name);
static void license (FILE * f, const char *name);
-static int
+static void
usageCore (FILE * f, const char * name)
{
fprintf (f,
? " [logon_id]" : ""));
const struct group * g = strsid_to_group (strsid);
if (g)
- printf (" gid=%lu(%s)", g->gr_gid, g->gr_name);
+ printf (" gid=%u(%s)", (unsigned) g->gr_gid, g->gr_name);
printf ("\n");
}
printf ("r %s", strsid);
const struct group * g = strsid_to_group (strsid);
if (g)
- printf (" gid=%lu(%s)", g->gr_gid, g->gr_name);
+ printf (" gid=%u(%s)", (unsigned) g->gr_gid, g->gr_name);
printf ("\n");
}