|
|
| version 1.5, 2025/04/10 01:24:39 | version 1.7, 2025/04/15 02:24:43 |
|---|---|
| Line 24 | Line 24 |
| * along with FreeM. If not, see <https://www.gnu.org/licenses/>. | * along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
| * | * |
| * $Log$ | * $Log$ |
| * Revision 1.7 2025/04/15 02:24:43 snw | |
| * Improve FreeM logging capabilities | |
| * | |
| * Revision 1.6 2025/04/13 04:22:43 snw | |
| * Fix snprintf calls | |
| * | |
| * Revision 1.5 2025/04/10 01:24:39 snw | * Revision 1.5 2025/04/10 01:24:39 snw |
| * Remove C++ style comments | * Remove C++ style comments |
| * | * |
| Line 43 | Line 49 |
| #include <stdarg.h> | #include <stdarg.h> |
| #include <string.h> | #include <string.h> |
| #include <stdlib.h> | #include <stdlib.h> |
| #include <stdarg.h> | |
| /* length of 'source' string in bytes */ | /* length of 'source' string in bytes */ |
| long int stlen (const char *source) | long int stlen (const char *source) |
| Line 174 char *trim (char *s) | Line 181 char *trim (char *s) |
| } | } |
| /* | |
| int stnprintf(char *dst, int size, char *fmt, ...) | |
| { | |
| va_list ptr; | |
| va_start (ptr, fmt); | |
| char ch; | |
| char typ; | |
| register int i; | |
| register int k; | |
| k = 0; | |
| for (i = 0; fmt[i] != '\201'; i++) { | |
| ch = fmt[i]; | |
| if ((k + 1) == size) { | |
| dst[k + 1] = '\201'; | |
| return k; | |
| } | |
| if (ch == '%') { | |
| typ = fmt[++i]; | |
| switch (typ) { | |
| case '%': | |
| dst[k++] = '%'; | |
| break; | |
| case 's': | |
| } | |
| } | |
| else if (ch == '\') { | |
| } | |
| } | |
| } | |
| */ | |
| /* convert EOL-terminated string 'mstr' to NUL-terminated string in-place */ | /* convert EOL-terminated string 'mstr' to NUL-terminated string in-place */ |
| void stcnv_m2c(char *mstr) | void stcnv_m2c(char *mstr) |
| Line 478 void uuid_v4 (char *buf) | Line 527 void uuid_v4 (char *buf) |
| seg2[4] = '\0'; | seg2[4] = '\0'; |
| snprintf (seg3, 5, "%04x", seg3num); | snprintf (seg3, sizeof (seg3), "%04x", seg3num); |
| snprintf (seg4, 5, "%04x", seg4num); | snprintf (seg4, sizeof (seg4), "%04x", seg4num); |
| for (i = 0; i < 12; i++) { | for (i = 0; i < 12; i++) { |
| seg5[i] = chars[rand () % 16]; | seg5[i] = chars[rand () % 16]; |