break;
// Remove the newline
- pakfire_remove_trailing_newline(line);
+ pakfire_string_rstrip(line);
// Look for the "enabled" line
if (strcmp("enabled", line) == 0) {
}
// Remove the trailing newline
- pakfire_remove_trailing_newline(line);
+ pakfire_string_rstrip(line);
// Start at the beginning of the line (after shebang)
p = line + 2;
time_t pakfire_path_age(const char* path);
-char* pakfire_remove_trailing_newline(char* str);
-
int pakfire_read_file_into_buffer(FILE* f, char** buffer, size_t* len);
#define pakfire_hexlify(digest) __pakfire_hexlify(digest, sizeof(digest))
goto ERROR;
// Remove any trailing newline
- pakfire_remove_trailing_newline(k->comment);
+ pakfire_string_rstrip(k->comment);
}
// Return the pointer
// Strip newline from output
if (output)
- pakfire_remove_trailing_newline(output);
+ pakfire_string_rstrip(output);
// Find the entire matched pattern
r = pcre2_substring_get_bynumber(match, 0, &pattern, &pattern_length);
return r;
}
-char* pakfire_remove_trailing_newline(char* str) {
- ssize_t pos = strlen(str) - 1;
-
- if (str[pos] == '\n')
- str[pos] = '\0';
-
- return str;
-}
-
int pakfire_read_file_into_buffer(FILE* f, char** buffer, size_t* len) {
if (!f)
return -EBADF;