MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_dir_correct

Function acl_dir_correct

lib_acl/src/stdlib/string/acl_mystring.c:339–361  ·  view source on GitHub ↗

---------------------------------------------------------------------------- * ��֤·���������˺�����Ϊ���¸�ʽ: * Դ: /home/avwall/, /home//////avwall/, /home/avwall, /////home/avwall/// * /home/avwall////, /home///avwall///, ///home///avwall/// * ���: /home/avwall/ */

Source from the content-addressed store, hash-verified

337 * ���: /home/avwall/
338 */
339int acl_dir_correct(const char *psrc_dir, char *pbuf, int sizeb)
340{
341 char *ptr;
342
343 /* ɾ�������� '/'(unix) or '\\'(windows) */
344 ptr = path_str_strip(psrc_dir, pbuf, sizeb);
345
346 /* �ú��������صĽ����Ϊ��, �� *ptr ��Ϊ '\0' */
347 if (ptr == NULL) {
348 return -1;
349 }
350
351 /* Ϊ�˱�֤���һ���ַ��϶�Ϊ '/'(unix) or '\\'(windows), �������´��� */
352
353 if (*(ptr - 1) != PATH_SEP_C) {
354 if (ptr >= pbuf + sizeb) { /* ˵���������ڴ�ռ䲻�� */
355 return -1;
356 }
357 *ptr++ = PATH_SEP_C;
358 *ptr = 0;
359 }
360 return 0;
361}
362
363int acl_dir_getpath(const char *pathname, char *pbuf, int bsize)
364{

Callers 1

test_path_correctFunction · 0.85

Calls 1

path_str_stripFunction · 0.85

Tested by 1

test_path_correctFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…