This file is indexed.

/usr/lib/ats-anairiats-0.2.11/libc/SATS/stdlib.sats is in ats-lang-anairiats 0.2.11-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
(***********************************************************************)
(*                                                                     *)
(*                         Applied Type System                         *)
(*                                                                     *)
(*                              Hongwei Xi                             *)
(*                                                                     *)
(***********************************************************************)

(*
** ATS - Unleashing the Potential of Types!
** Copyright (C) 2002-2008 Hongwei Xi, Boston University
** All rights reserved
**
** ATS is free software;  you can  redistribute it and/or modify it under
** the  terms of the  GNU General Public License as published by the Free
** Software Foundation; either version 2.1, or (at your option) any later
** version.
** 
** ATS is distributed in the hope that it will be useful, but WITHOUT ANY
** WARRANTY; without  even  the  implied  warranty  of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License
** for more details.
** 
** You  should  have  received  a  copy of the GNU General Public License
** along  with  ATS;  see the  file COPYING.  If not, please write to the
** Free Software Foundation,  51 Franklin Street, Fifth Floor, Boston, MA
** 02110-1301, USA.
*)

(* ****** ****** *)

(* author: Hongwei Xi (hwxi AT cs DOT bu DOT edu) *)

(* ****** ****** *)

%{#
#include "libc/CATS/stdlib.cats"
%} // end of [%{#]

(* ****** ****** *)

staload FCNTL = "libc/SATS/fcntl.sats" // for [mkstemp]
stadef open_v = $FCNTL.open_v

(* ****** ****** *)

macdef EXIT_SUCCESS = $extval (int, "EXIT_SUCCESS")
macdef EXIT_FAILURE = $extval (int, "EXIT_FAILURE")

(* ****** ****** *)

fun atoi (inp: string):<> int = "mac#atslib_atoi"
fun atof (inp: string):<> double = "mac#atslib_atof"
fun atol (inp: string):<> lint = "mac#atslib_atol"
fun atoll (inp: string):<> llint = "mac#atslib_atoll"

(* ****** ****** *)

fun strtoi_errnul (
  inp: string, base: intBtw (2, 36+1)
) :<> int = "mac#atslib_strtoi_errnul"

fun strtol_errnul (
  inp: string, base: intBtw (2, 36+1)
) :<> lint = "mac#atslib_strtol_errnul"

fun strtoll_errnul (
  inp: string, base: intBtw (2, 36+1)
) :<> llint = "mac#atslib_strtoll_errnul"

(* ****** ****** *)

fun getenv (
  name: string
) : [l:addr] (
  strptr l -<lin,prf> void | strptr l
) = "mac#atslib_getenv"
// end of [getenv]

//
// HX-201-09-29:
// [nameval] is copied and put into the environment.
// potential memory leak!!! 
//
fun putenv {l:agz} (nameval: !strptr l): int // 0/nz : succ/fail

//
// HX-2010-09-29:
// [name] and [value] are copied into the environment
// also note that the original value may be leaked out!!!
//
fun setenv ( // 0/-1 : succ/fail
  name: string, value: string, overwrite: int
) : int = "mac#atslib_setenv" // end of [atslib_setenv]

fun unsetenv
  (name: string): int = "mac#atslib_unsetenv" // 0/-1: succ/fail
// end of [unsetenv]

(* ****** ****** *)

fun system (cmd: string): int = "mac#atslib_system"

(* ****** ****** *)

fun abort (): void = "mac#atslib_abort"

(* ****** ****** *)

fun _Exit (status: int): void = "mac#atslib__Exit"
fun atexit (f: () -> void): int = "mac#atslib_atexit"

(* ****** ****** *)
(*
// HX: [mktemp] is not given an interface as it is BAD!!!
*)
(* ****** ****** *)
//
// HX: the last six characters of path much be XXXXXX
//
fun mkstemp
  {m,n:int | n >= 6} (
  path: &strbuf (m, n)
) : [i:int] (
  open_v (i) | int i
) = "mac#atslib_mkstemp"
// end of [mkstemp]

fun mkdtemp
  {m,n:int | n >= 6} {l:addr} (
  pf: !strbuf (m, n) @ l | p: ptr l
) : [l1:addr | l1==l || l1==null] ptr (l1)
  = "mac#atslib_mkdtemp" // null/nonnull: fail/succ
// end of [mkdtemp]

(* ****** ****** *)
//
// HX: this one returns an integer (not a pointer)!
//
fun bsearch {a:viewt@ype} {n:nat} (
  key: &a
, base: &(@[a][n]), nmemb: size_t n, size: sizeof_t a
, compar: (&a, &a) -<fun> int
) :<> intBtw (~1, n)
  = "atslib_bsearch" // function!
// end of [bsearch]

(* ****** ****** *)
//
// HX: a generic quicksort function
//
fun qsort
  {a:viewt@ype} {n:nat} (
  base: &(@[a][n])
, nmemb: size_t n, size: sizeof_t a
, compar: (&a, &a) -<fun> int
) :<> void
  = "atslib_qsort" // function!
// end of [qsort]

(* ****** ****** *)

(* end of [stdlib.sats] *)