MCPcopy Create free account
hub / github.com/coreutils/coreutils / bsd_split_3

Function bsd_split_3

src/cksum.c:824–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

822 Return true if successful. */
823
824static bool
825bsd_split_3 (char *s, idx_t s_len,
826 unsigned char **digest, idx_t *d_len,
827 char **file_name, bool escaped_filename)
828{
829 if (s_len == 0)
830 return false;
831
832 /* Find end of filename. */
833 idx_t i = s_len - 1;
834 while (i && s[i] != ')')
835 i--;
836
837 if (s[i] != ')')
838 return false;
839
840 *file_name = s;
841
842 if (escaped_filename && filename_unescape (s, i) == NULL)
843 return false;
844
845 s[i++] = '\0';
846
847 while (c_isblank (s[i]))
848 i++;
849
850 if (s[i] != '=')
851 return false;
852
853 i++;
854
855 while (c_isblank (s[i]))
856 i++;
857
858 *digest = (unsigned char *) &s[i];
859
860 *d_len = s_len - i;
861 return valid_digits (*digest, *d_len);
862}
863
864#if HASH_ALGO_CKSUM
865/* Return the corresponding Algorithm for the string S,

Callers 1

cksum.cFile · 0.85

Calls 2

filename_unescapeFunction · 0.85
valid_digitsFunction · 0.85

Tested by

no test coverage detected