<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16">
  <compounddef id="strtol_8c" kind="file" language="C++">
    <compoundname>strtol.c</compoundname>
    <includes refid="cdefs_8h" local="no">sys/cdefs.h</includes>
    <incdepgraph>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/lib/strtol.c</label>
        <link refid="strtol_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
    </incdepgraph>
      <sectiondef kind="define">
      <memberdef kind="define" id="strtol_8c_1a50fece4db74f09568b2938db583c5655" prot="public" static="no">
        <name>LONG_MAX</name>
        <initializer>0x7fffffffL</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/lib/strtol.c" line="35" column="9" bodyfile="C:/Dev/git/UbixOS/sys/lib/strtol.c" bodystart="35" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="strtol_8c_1ae8a44c5a7436466221e0f3859d02420f" prot="public" static="no">
        <name>LONG_MIN</name>
        <initializer>(-0x7fffffffL - 1)</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/lib/strtol.c" line="34" column="9" bodyfile="C:/Dev/git/UbixOS/sys/lib/strtol.c" bodystart="34" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="strtol_8c_1a23a80e470a9dae66d16e7d25fbba122a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>long</type>
        <definition>long strtol</definition>
        <argsstring>(const char *__restrict nptr, char **__restrict endptr, int base)</argsstring>
        <name>strtol</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> char *<ref refid="cdefs_8h_1a4127c12268159bf73f8e69b23c34c610" kindref="member">__restrict</ref></type>
          <declname>nptr</declname>
        </param>
        <param>
          <type>char **<ref refid="cdefs_8h_1a4127c12268159bf73f8e69b23c34c610" kindref="member">__restrict</ref></type>
          <declname>endptr</declname>
        </param>
        <param>
          <type>int</type>
          <declname>base</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/lib/strtol.c" line="37" column="6" bodyfile="C:/Dev/git/UbixOS/sys/lib/strtol.c" bodystart="37" bodyend="128"/>
        <references refid="strtol_8c_1a50fece4db74f09568b2938db583c5655" compoundref="strtol_8c" startline="35">LONG_MAX</references>
        <references refid="strtol_8c_1ae8a44c5a7436466221e0f3859d02420f" compoundref="strtol_8c" startline="34">LONG_MIN</references>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="comment">/*-</highlight></codeline>
<codeline lineno="2"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2002-2018<sp/>The<sp/>UbixOS<sp/>Project.</highlight></codeline>
<codeline lineno="3"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="5"><highlight class="comment"><sp/>*<sp/>This<sp/>was<sp/>developed<sp/>by<sp/>Christopher<sp/>W.<sp/>Olsen<sp/>for<sp/>the<sp/>UbixOS<sp/>Project.</highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="7"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/>modification,<sp/>are<sp/>permitted</highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>*<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/>1)<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/>notice,<sp/>this<sp/>list<sp/>of</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>conditions,<sp/>the<sp/>following<sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors.</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*<sp/>2)<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,<sp/>this<sp/>list<sp/>of</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>conditions,<sp/>the<sp/>following<sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors<sp/>in<sp/>the<sp/>documentation<sp/>and/or</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/>3)<sp/>Neither<sp/>the<sp/>name<sp/>of<sp/>the<sp/>UbixOS<sp/>Project<sp/>nor<sp/>the<sp/>names<sp/>of<sp/>its<sp/>contributors<sp/>may<sp/>be<sp/>used<sp/>to</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>endorse<sp/>or<sp/>promote<sp/>products<sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>permission.</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>AND<sp/>CONTRIBUTORS<sp/>&quot;AS<sp/>IS&quot;<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS</highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>*<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>THE<sp/>COPYRIGHT<sp/>OWNER<sp/>OR<sp/>CONTRIBUTORS</highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES</highlight></codeline>
<codeline lineno="23"><highlight class="comment"><sp/>*<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,</highlight></codeline>
<codeline lineno="24"><highlight class="comment"><sp/>*<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline>
<codeline lineno="25"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT</highlight></codeline>
<codeline lineno="26"><highlight class="comment"><sp/>*<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="27"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="cdefs_8h" kindref="compound">sys/cdefs.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="comment">//#include<sp/>&lt;limits.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight><highlight class="comment">//#include<sp/>&lt;ctype.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight><highlight class="comment">//#include<sp/>&lt;stdlib.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"></highlight></codeline>
<codeline lineno="34" refid="strtol_8c_1ae8a44c5a7436466221e0f3859d02420f" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LONG_MIN<sp/><sp/><sp/><sp/><sp/><sp/>(-0x7fffffffL<sp/>-<sp/>1)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="35" refid="strtol_8c_1a50fece4db74f09568b2938db583c5655" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LONG_MAX<sp/><sp/><sp/><sp/><sp/><sp/>0x7fffffffL</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight></codeline>
<codeline lineno="37" refid="strtol_8c_1a23a80e470a9dae66d16e7d25fbba122a" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/><ref refid="strtol_8c_1a23a80e470a9dae66d16e7d25fbba122a" kindref="member">strtol</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<sp/><ref refid="cdefs_8h_1a4127c12268159bf73f8e69b23c34c610" kindref="member">__restrict</ref><sp/>nptr,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**<sp/><ref refid="cdefs_8h_1a4127c12268159bf73f8e69b23c34c610" kindref="member">__restrict</ref><sp/>endptr,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>base)<sp/>{</highlight></codeline>
<codeline lineno="38"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*s;</highlight></codeline>
<codeline lineno="39"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/>acc;</highlight></codeline>
<codeline lineno="40"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>c<sp/>=<sp/>0x0;<sp/></highlight><highlight class="comment">/*<sp/>to<sp/>remove<sp/>warning<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">long</highlight><highlight class="normal"><sp/>cutoff;</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>neg,<sp/>any,<sp/>cutlim;</highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="45"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Skip<sp/>white<sp/>space<sp/>and<sp/>pick<sp/>up<sp/>leading<sp/>+/-<sp/>sign<sp/>if<sp/>any.</highlight></codeline>
<codeline lineno="46"><highlight class="comment"><sp/><sp/><sp/>*<sp/>If<sp/>base<sp/>is<sp/>0,<sp/>allow<sp/>0x<sp/>for<sp/>hex<sp/>and<sp/>0<sp/>for<sp/>octal,<sp/>else</highlight></codeline>
<codeline lineno="47"><highlight class="comment"><sp/><sp/><sp/>*<sp/>assume<sp/>decimal;<sp/>if<sp/>base<sp/>is<sp/>already<sp/>16,<sp/>allow<sp/>0x.</highlight></codeline>
<codeline lineno="48"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/>s<sp/>=<sp/>nptr;</highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="51"><highlight class="comment"><sp/><sp/><sp/>do<sp/>{</highlight></codeline>
<codeline lineno="52"><highlight class="comment"><sp/><sp/><sp/>c<sp/>=<sp/>*s++;</highlight></codeline>
<codeline lineno="53"><highlight class="comment"><sp/><sp/><sp/>}<sp/>while<sp/>(isspace((unsigned<sp/>char)c));</highlight></codeline>
<codeline lineno="54"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="55"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>==<sp/></highlight><highlight class="charliteral">&apos;-&apos;</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/>neg<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="57"><highlight class="normal"><sp/><sp/><sp/><sp/>c<sp/>=<sp/>*s++;</highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/>neg<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>==<sp/></highlight><highlight class="charliteral">&apos;+&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>c<sp/>=<sp/>*s++;</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((base<sp/>==<sp/>0<sp/>||<sp/>base<sp/>==<sp/>16)<sp/>&amp;&amp;<sp/>c<sp/>==<sp/></highlight><highlight class="charliteral">&apos;0&apos;</highlight><highlight class="normal"><sp/>&amp;&amp;<sp/>(*s<sp/>==<sp/></highlight><highlight class="charliteral">&apos;x&apos;</highlight><highlight class="normal"><sp/>||<sp/>*s<sp/>==<sp/></highlight><highlight class="charliteral">&apos;X&apos;</highlight><highlight class="normal">))<sp/>{</highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/>c<sp/>=<sp/>s[1];</highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><sp/><sp/>s<sp/>+=<sp/>2;</highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/>base<sp/>=<sp/>16;</highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(base<sp/>==<sp/>0)</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/>base<sp/>=<sp/>c<sp/>==<sp/></highlight><highlight class="charliteral">&apos;0&apos;</highlight><highlight class="normal"><sp/>?<sp/>8<sp/>:<sp/>10;</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/>acc<sp/>=<sp/>any<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(base<sp/>&lt;<sp/>2<sp/>||<sp/>base<sp/>&gt;<sp/>36)</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>noconv;</highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="76"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Compute<sp/>the<sp/>cutoff<sp/>value<sp/>between<sp/>legal<sp/>numbers<sp/>and<sp/>illegal</highlight></codeline>
<codeline lineno="77"><highlight class="comment"><sp/><sp/><sp/>*<sp/>numbers.<sp/><sp/>That<sp/>is<sp/>the<sp/>largest<sp/>legal<sp/>value,<sp/>divided<sp/>by<sp/>the</highlight></codeline>
<codeline lineno="78"><highlight class="comment"><sp/><sp/><sp/>*<sp/>base.<sp/><sp/>An<sp/>input<sp/>number<sp/>that<sp/>is<sp/>greater<sp/>than<sp/>this<sp/>value,<sp/>if</highlight></codeline>
<codeline lineno="79"><highlight class="comment"><sp/><sp/><sp/>*<sp/>followed<sp/>by<sp/>a<sp/>legal<sp/>input<sp/>character,<sp/>is<sp/>too<sp/>big.<sp/><sp/>One<sp/>that</highlight></codeline>
<codeline lineno="80"><highlight class="comment"><sp/><sp/><sp/>*<sp/>is<sp/>equal<sp/>to<sp/>this<sp/>value<sp/>may<sp/>be<sp/>valid<sp/>or<sp/>not;<sp/>the<sp/>limit</highlight></codeline>
<codeline lineno="81"><highlight class="comment"><sp/><sp/><sp/>*<sp/>between<sp/>valid<sp/>and<sp/>invalid<sp/>numbers<sp/>is<sp/>then<sp/>based<sp/>on<sp/>the<sp/>last</highlight></codeline>
<codeline lineno="82"><highlight class="comment"><sp/><sp/><sp/>*<sp/>digit.<sp/><sp/>For<sp/>instance,<sp/>if<sp/>the<sp/>range<sp/>for<sp/>longs<sp/>is</highlight></codeline>
<codeline lineno="83"><highlight class="comment"><sp/><sp/><sp/>*<sp/>[-2147483648..2147483647]<sp/>and<sp/>the<sp/>input<sp/>base<sp/>is<sp/>10,</highlight></codeline>
<codeline lineno="84"><highlight class="comment"><sp/><sp/><sp/>*<sp/>cutoff<sp/>will<sp/>be<sp/>set<sp/>to<sp/>214748364<sp/>and<sp/>cutlim<sp/>to<sp/>either</highlight></codeline>
<codeline lineno="85"><highlight class="comment"><sp/><sp/><sp/>*<sp/>7<sp/>(neg==0)<sp/>or<sp/>8<sp/>(neg==1),<sp/>meaning<sp/>that<sp/>if<sp/>we<sp/>have<sp/>accumulated</highlight></codeline>
<codeline lineno="86"><highlight class="comment"><sp/><sp/><sp/>*<sp/>a<sp/>value<sp/>&gt;<sp/>214748364,<sp/>or<sp/>equal<sp/>but<sp/>the<sp/>next<sp/>digit<sp/>is<sp/>&gt;<sp/>7<sp/>(or<sp/>8),</highlight></codeline>
<codeline lineno="87"><highlight class="comment"><sp/><sp/><sp/>*<sp/>the<sp/>number<sp/>is<sp/>too<sp/>big,<sp/>and<sp/>we<sp/>will<sp/>return<sp/>a<sp/>range<sp/>error.</highlight></codeline>
<codeline lineno="88"><highlight class="comment"><sp/><sp/><sp/>*</highlight></codeline>
<codeline lineno="89"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Set<sp/>&apos;any&apos;<sp/>if<sp/>any<sp/>`digits&apos;<sp/>consumed;<sp/>make<sp/>it<sp/>negative<sp/>to<sp/>indicate</highlight></codeline>
<codeline lineno="90"><highlight class="comment"><sp/><sp/><sp/>*<sp/>overflow.</highlight></codeline>
<codeline lineno="91"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/>cutoff<sp/>=<sp/>neg<sp/>?<sp/>(</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/>long)<sp/>-(<ref refid="strtol_8c_1ae8a44c5a7436466221e0f3859d02420f" kindref="member">LONG_MIN</ref><sp/>+<sp/><ref refid="strtol_8c_1a50fece4db74f09568b2938db583c5655" kindref="member">LONG_MAX</ref>)<sp/>+<sp/><ref refid="strtol_8c_1a50fece4db74f09568b2938db583c5655" kindref="member">LONG_MAX</ref><sp/>:<sp/><ref refid="strtol_8c_1a50fece4db74f09568b2938db583c5655" kindref="member">LONG_MAX</ref>;</highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/>cutlim<sp/>=<sp/>cutoff<sp/>%<sp/>base;</highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/>cutoff<sp/>/=<sp/>base;</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(;;<sp/>c<sp/>=<sp/>*s++)<sp/>{</highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>&gt;=<sp/></highlight><highlight class="charliteral">&apos;0&apos;</highlight><highlight class="normal"><sp/>&amp;&amp;<sp/>c<sp/>&lt;=<sp/></highlight><highlight class="charliteral">&apos;9&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>c<sp/>-=<sp/></highlight><highlight class="charliteral">&apos;0&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>&gt;=<sp/></highlight><highlight class="charliteral">&apos;A&apos;</highlight><highlight class="normal"><sp/>&amp;&amp;<sp/>c<sp/>&lt;=<sp/></highlight><highlight class="charliteral">&apos;Z&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>c<sp/>-=<sp/></highlight><highlight class="charliteral">&apos;A&apos;</highlight><highlight class="normal"><sp/>-<sp/>10;</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>&gt;=<sp/></highlight><highlight class="charliteral">&apos;a&apos;</highlight><highlight class="normal"><sp/>&amp;&amp;<sp/>c<sp/>&lt;=<sp/></highlight><highlight class="charliteral">&apos;z&apos;</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>c<sp/>-=<sp/></highlight><highlight class="charliteral">&apos;a&apos;</highlight><highlight class="normal"><sp/>-<sp/>10;</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>&gt;=<sp/>base)</highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(any<sp/>&lt;<sp/>0<sp/>||<sp/>acc<sp/>&gt;<sp/>cutoff<sp/>||<sp/>(acc<sp/>==<sp/>cutoff<sp/>&amp;&amp;<sp/>c<sp/>&gt;<sp/>cutlim))</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>any<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>any<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>acc<sp/>*=<sp/>base;</highlight></codeline>
<codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>acc<sp/>+=<sp/>c;</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(any<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/>acc<sp/>=<sp/>neg<sp/>?<sp/><ref refid="strtol_8c_1ae8a44c5a7436466221e0f3859d02420f" kindref="member">LONG_MIN</ref><sp/>:<sp/><ref refid="strtol_8c_1a50fece4db74f09568b2938db583c5655" kindref="member">LONG_MAX</ref>;</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//errno<sp/>=<sp/>ERANGE;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!any)<sp/>{</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/>noconv:</highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//errno<sp/>=<sp/>EINVAL;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/>cutoff<sp/>=<sp/>0x0;<sp/></highlight><highlight class="comment">//UBU</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neg)</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/>acc<sp/>=<sp/>-acc;</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(endptr<sp/>!=<sp/>0x0)</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/>*endptr<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)<sp/>(any<sp/>?<sp/>s<sp/>-<sp/>1<sp/>:<sp/>nptr);</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(acc);</highlight></codeline>
<codeline lineno="128"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/lib/strtol.c"/>
  </compounddef>
</doxygen>
