123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #ifndef STRFBITS_SOURCE
- #define STRFBITS_SOURCE
- #include <unistd.h>
- #include "../tools/memory.h"
- #include "../tools/flags.h"
- size_t strfbits (char buffer [], size_t length, char const * operands [], char const * operator, unsigned flagword)
- {
- char * string = (char *) (buffer);
- char const * separator = "";
- if (length--)
- {
- buffer += length;
- while ((* operands) && (flagword))
- {
- if (flagword & 1)
- {
- char const * symbol;
- for (symbol = separator; (* symbol) && (string < buffer); symbol++)
- {
- * string++ = * symbol;
- }
- for (symbol = * operands; (* symbol) && (string < buffer); symbol++)
- {
- * string++ = * symbol;
- }
- separator = operator;
- }
- flagword >>= 1;
- operands++;
- }
- * string = (char) (0);
- buffer -= length;
- }
- return (string - (char *) (buffer));
- }
- #endif
|