\doxysection{utils.\+c}
\hypertarget{utils_8c_source}{}\label{utils_8c_source}\index{workspace/post-\/scarcity/src/utils.c@{workspace/post-\/scarcity/src/utils.c}}
\mbox{\hyperlink{utils_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00001}00001\ \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00002}00002\ \textcolor{comment}{\ *\ utils.c}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00003}00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00004}00004\ \textcolor{comment}{\ *\ little\ generally\ useful\ functions\ which\ aren't\ in\ any\ way\ special\ to\ PSSE.}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00005}00005\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00006}00006\ \textcolor{comment}{\ *\ (c)\ 2019\ Simon\ Brooke\ <simon@journeyman.cc>}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00007}00007\ \textcolor{comment}{\ *\ Licensed\ under\ GPL\ version\ 2.0,\ or,\ at\ your\ option,\ any\ later\ version.}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00008}00008\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00009}00009\ }
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00010}00010\ \textcolor{preprocessor}{\#include\ <ctype.h>}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00011}00011\ \textcolor{preprocessor}{\#include\ <stdlib.h>}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00012}00012\ \textcolor{preprocessor}{\#include\ <string.h>}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00013}00013\ }
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00014}00014\ }
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00015}\mbox{\hyperlink{utils_8c_ab55c66b6fbeac34e71ec2b8f83a2aade}{00015}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{utils_8c_ab55c66b6fbeac34e71ec2b8f83a2aade}{index\_of}}(\ \textcolor{keywordtype}{char}\ c,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *s\ )\ \{}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00016}00016\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00017}00017\ }
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00018}00018\ \ \ \ \ \textcolor{keywordflow}{for}\ (\ i\ =\ 0;\ s[i]\ !=\ c\ \&\&\ s[i]\ !=\ 0;\ i++\ );}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00019}00019\ }
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00020}00020\ \ \ \ \ \textcolor{keywordflow}{return}\ s[i]\ ==\ c\ ?\ i\ :\ -\/1;}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00021}00021\ \}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00022}00022\ }
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00023}\mbox{\hyperlink{utils_8c_ae5bb0c43f76b886197ee48679f0e8dbc}{00023}}\ \textcolor{keywordtype}{char}\ *\mbox{\hyperlink{utils_8c_ae5bb0c43f76b886197ee48679f0e8dbc}{trim}}(\ \textcolor{keywordtype}{char}\ *s\ )\ \{}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00024}00024\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00025}00025\ }
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00026}00026\ \ \ \ \ \textcolor{keywordflow}{for}\ (\ i\ =\ strlen(\ s\ );\ (\ isblank(\ s[i]\ )\ ||\ iscntrl(\ s[i]\ )\ )\ \&\&\ i\ >=\ 0;}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00027}00027\ \ \ \ \ \ \ \ \ \ \ i-\/-\/\ )\ \{}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00028}00028\ \ \ \ \ \ \ \ \ s[i]\ =\ \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00029}00029\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00030}00030\ \ \ \ \ \textcolor{keywordflow}{for}\ (\ i\ =\ 0;\ s[i]\ !=\ \textcolor{charliteral}{'\(\backslash\)0'}\ \&\&\ (\ isblank(\ s[i]\ )\ ||\ iscntrl(\ s[i]\ )\ );\ i++\ );}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00031}00031\ }
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00032}00032\ \ \ \ \ \textcolor{keywordflow}{return}\ (\ \textcolor{keywordtype}{char}\ *\ )\ \&s[i];}
\DoxyCodeLine{\Hypertarget{utils_8c_source_l00033}00033\ \}}

\end{DoxyCode}
