blob: 6c918247c04a7628c8957d96f020f8ddc65a6e6f (
plain) (
tree)
|
|
/* See LICENSE file for copyright and license details. */
#include "../libsyscalls.h"
#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(__clang__)
# pragma clang diagnostic ignored "-Wunsafe-buffer-usage" /* clang is just being silly */
#endif
int
main(int argc, char **argv)
{
int os, arch, width;
unsigned alignment = -1;
enum libsyscalls_error err;
if (argc != 6) {
fprintf(stderr, "usage error\n");
return 3;
}
os = atoi(argv[1]);
arch = atoi(argv[2]);
width = atoi(argv[3]);
err = libsyscalls_get_integer_alignment((enum libsyscalls_os)os, (enum libsyscalls_arch)arch,
(unsigned)width, &alignment);
if (err) {
fprintf(stderr, "libsyscalls_get_integer_alignment %s %s %s: ", argv[4], argv[5], argv[3]);
libsyscalls_perror(NULL, err);
return 1;
}
printf("%u\n", alignment);
if (fflush(stdout) || fclose(stdout)) {
perror(NULL);
return 1;
}
return 0;
}
|