fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

pri/text: Start text comments on a new line

Hampa Hug 4c7807fe 5d6a3a85

+30 -7
+20 -2
src/drivers/pri/pri.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/drivers/pri/pri.c * 7 7 * Created: 2012-01-31 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2012-2019 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2012-2025 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 15 15 * * 16 16 * This program is distributed in the hope that it will be useful, but * 17 17 * WITHOUT ANY WARRANTY, without even the implied warranty of * 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 19 19 * Public License for more details. * 20 20 *****************************************************************************/ 21 21 ··· 1322 1322 1323 1323 return (0); 1324 1324 } 1325 + 1326 + /* Force a <nl> at the end of the comment */ 1327 + int pri_img_add_comment_nl (pri_img_t *img) 1328 + { 1329 + if (img->comment_size == 0) { 1330 + return (0); 1331 + } 1332 + 1333 + if (img->comment[img->comment_size - 1] == 0x0a) { 1334 + return (0); 1335 + } 1336 + 1337 + if (pri_img_add_comment (img, (unsigned char *) "\x0a", 1)) { 1338 + return (1); 1339 + } 1340 + 1341 + return (0); 1342 + }
+3 -2
src/drivers/pri/pri.h
··· 5 5 /***************************************************************************** 6 6 * File name: src/drivers/pri/pri.h * 7 7 * Created: 2012-01-31 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2012-2019 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2012-2025 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 15 15 * * 16 16 * This program is distributed in the hope that it will be useful, but * 17 17 * WITHOUT ANY WARRANTY, without even the implied warranty of * 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 19 19 * Public License for more details. * 20 20 *****************************************************************************/ 21 21 ··· 134 134 135 135 int pri_img_add_comment (pri_img_t *img, const unsigned char *buf, unsigned cnt); 136 136 int pri_img_set_comment (pri_img_t *img, const unsigned char *buf, unsigned cnt); 137 + int pri_img_add_comment_nl (pri_img_t *img); 137 138 138 139 139 140 #endif
+7 -3
src/utils/pri/text.c
··· 395 395 return (1); 396 396 } 397 397 398 + if (pri_img_add_comment_nl (ctx->img)) { 399 + return (1); 400 + } 401 + 398 402 cnt = strlen (str); 399 403 400 - if (cnt < 256) { 401 - str[cnt++] = 0x0a; 404 + if (pri_img_add_comment (ctx->img, (unsigned char *) str, cnt)) { 405 + return (1); 402 406 } 403 407 404 - if (pri_img_add_comment (ctx->img, (unsigned char *) str, cnt)) { 408 + if (pri_img_add_comment (ctx->img, (unsigned char *) "\x0a", 1)) { 405 409 return (1); 406 410 } 407 411