| 190 | |
| 191 | |
| 192 | static char* copy_terminate(char* dest, const char* src, size_t bufsize) |
| 193 | { |
| 194 | /************************************** |
| 195 | * |
| 196 | * c o p y _ t e r m i n a t e |
| 197 | * |
| 198 | ************************************** |
| 199 | * |
| 200 | * Functional description |
| 201 | * Do the same as strncpy but ensure the null terminator is written. |
| 202 | * To avoid putting here #include "../common/utils_proto.h" |
| 203 | * |
| 204 | **************************************/ |
| 205 | if (!bufsize) // Was it a joke? |
| 206 | return dest; |
| 207 | |
| 208 | --bufsize; |
| 209 | strncpy(dest, src, bufsize); |
| 210 | dest[bufsize] = 0; |
| 211 | return dest; |
| 212 | } |
| 213 | |
| 214 | |
| 215 | static void do_codes(const TEXT* gen_c_filename, const TEXT* gen_pas_filename) |