btoh.c revision 29964
122347Spst/* btoh.c: The opiebtoh() library function.
222347Spst
329964Sache%%% copyright-cmetz-96
429964SacheThis software is Copyright 1996-1997 by Craig Metz, All Rights Reserved.
522347SpstThe Inner Net License Version 2 applies to this software.
622347SpstYou should have received a copy of the license with this software. If
722347Spstyou didn't get a copy, you may request one from <license@inner.net>.
822347Spst
922347Spst        History:
1022347Spst
1122347Spst	Created by cmetz for OPIE 2.3.
1222347Spst*/
1322347Spst
1422347Spst#include "opie_cfg.h"
1522347Spst#include "opie.h"
1622347Spst
1722347Spststatic char hextochar[16] =
1822347Spst{'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
1922347Spst
2022347Spstchar *opiebtoh FUNCTION((out, in), char *out AND char *in)
2122347Spst{
2222347Spst  int i;
2322347Spst  char *c = out;
2422347Spst
2522347Spst  for (i = 0; i < 4; i++) {
2622347Spst    *(c++) = hextochar[((*in) >> 4) & 0x0f];
2722347Spst    *(c++) = hextochar[(*in++) & 0x0f];
2822347Spst    *(c++) = hextochar[((*in) >> 4) & 0x0f];
2922347Spst    *(c++) = hextochar[(*in++) & 0x0f];
3022347Spst    *(c++) = ' ';
3122347Spst  }
3222347Spst  *(--c) = 0;
3322347Spst
3422347Spst  return out;
3522347Spst}
36