/* Generate a package from system header definitions
--  Copyright (C) 2011 Stephane Carrez
--  Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
--  Licensed under the Apache License, Version 2.0 (the "License");
--  you may not use this file except in compliance with the License.
--  You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
--  Unless required by applicable law or agreed to in writing, software
--  distributed under the License is distributed on an "AS IS" BASIS,
--  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--  See the License for the specific language governing permissions and
--  limitations under the License.
*/

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

int main(void)
{
  printf("--  Generated by utildgen.c from system bfd.h\n");

  printf("with Interfaces.C;\n");
  printf("package Util.Systems.Constants is\n");
  printf("\n");

  printf("\n   --  Flags used when opening a file with open/creat.\n");
  printf("   O_RDONLY                      : constant Interfaces.C.int := 8#%06o#;\n", O_RDONLY);
  printf("   O_WRONLY                      : constant Interfaces.C.int := 8#%06o#;\n", O_WRONLY);
  printf("   O_RDWR                        : constant Interfaces.C.int := 8#%06o#;\n", O_RDWR);
  printf("   O_CREAT                       : constant Interfaces.C.int := 8#%06o#;\n", O_CREAT);
  printf("   O_EXCL                        : constant Interfaces.C.int := 8#%06o#;\n", O_EXCL);
  printf("   O_TRUNC                       : constant Interfaces.C.int := 8#%06o#;\n", O_TRUNC);
  printf("   O_APPEND                      : constant Interfaces.C.int := 8#%06o#;\n", O_APPEND);

  printf("\n");

  printf("   --  Flags used by fcntl\n");
  printf("   F_SETFL                       : constant Interfaces.C.int := %d;\n", F_SETFL);
  printf("   FD_CLOEXEC                    : constant Interfaces.C.int := %d;\n", FD_CLOEXEC);

  printf("\n");

  printf("end Util.Systems.Constants;\n");
  return 0;
}

Add a support tool to generate Util.Systems.Constants package
Add a support tool to generate Util.Systems.Constants package
