view uptools/libcoding/ucs2_bigend.c @ 405:ed9b67e7e741

fcup-smsend: fixed bug in the handling of -W with no dest address argument The original code checked for argv[optind+1] when argv[optind] is NULL; on most systems this bogus code gets the first line of the environment, which is clearly not what we are after. Fixed the code to check argc instead.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 Aug 2018 18:59:54 +0000
parents f7228c18463a
children
line wrap: on
line source

/*
 * This library module implements the function for converting a UCS-2
 * string from native 16-bit words into a byte buffer for SMS.
 */

#include <sys/types.h>

ucs2_out_bigend(inbuf, outbuf, nuni)
	u_short *inbuf;
	u_char *outbuf;
	unsigned nuni;
{
	u_short *ip = inbuf;
	u_char *op = outbuf;
	unsigned n, uni;

	for (n = 0; n < nuni; n++) {
		uni = *ip++;
		*op++ = uni >> 8;
		*op++ = uni;
	}
}