mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
6e72370fd7
This imports licensing clarifications and updates as discussed on samba-technical ("Subject: Re: ccan code breaks older build farm systems"). In particular, the recent version have per-file license markers, and some modules are relicenced more liberally: in particular Simo pointed out that htable was GPL, and indirectly included by libtdb2, which would have made that GPL as well. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Mon Jul 25 12:03:40 CEST 2011 on sn-devel-104
54 lines
1.3 KiB
Plaintext
54 lines
1.3 KiB
Plaintext
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "config.h"
|
|
|
|
/**
|
|
* endian - endian conversion macros for simple types
|
|
*
|
|
* Portable protocols (such as on-disk formats, or network protocols)
|
|
* are often defined to be a particular endian: little-endian (least
|
|
* significant bytes first) or big-endian (most significant bytes
|
|
* first).
|
|
*
|
|
* Similarly, some CPUs lay out values in memory in little-endian
|
|
* order (most commonly, Intel's 8086 and derivatives), or big-endian
|
|
* order (almost everyone else).
|
|
*
|
|
* This module provides conversion routines, inspired by the linux kernel.
|
|
*
|
|
* Example:
|
|
* #include <stdio.h>
|
|
* #include <err.h>
|
|
* #include <ccan/endian/endian.h>
|
|
*
|
|
* //
|
|
* int main(int argc, char *argv[])
|
|
* {
|
|
* uint32_t value;
|
|
*
|
|
* if (argc != 2)
|
|
* errx(1, "Usage: %s <value>", argv[0]);
|
|
*
|
|
* value = atoi(argv[1]);
|
|
* printf("native: %08x\n", value);
|
|
* printf("little-endian: %08x\n", cpu_to_le32(value));
|
|
* printf("big-endian: %08x\n", cpu_to_be32(value));
|
|
* printf("byte-reversed: %08x\n", bswap_32(value));
|
|
* exit(0);
|
|
* }
|
|
*
|
|
* License: LGPL (v2.1 or any later version)
|
|
* Author: Rusty Russell <rusty@rustcorp.com.au>
|
|
*/
|
|
int main(int argc, char *argv[])
|
|
{
|
|
if (argc != 2)
|
|
return 1;
|
|
|
|
if (strcmp(argv[1], "depends") == 0)
|
|
/* Nothing */
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|