Make source more standard C11 w/POSIX:2008 CLI.
This commit is contained in:
@@ -16,7 +16,8 @@
|
||||
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
|
||||
//==============================================================================
|
||||
|
||||
#define _WITH_GETLINE
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
|
||||
#include "mpw-cli-util.h"
|
||||
|
||||
#include <unistd.h>
|
||||
@@ -188,7 +189,7 @@ bool mpw_mkdirs(const char *filePath) {
|
||||
|
||||
// The path to mkdir is the filePath without the last path component.
|
||||
char *pathEnd = strrchr( filePath, '/' );
|
||||
char *path = pathEnd? strndup( filePath, (size_t)(pathEnd - filePath) ): NULL;
|
||||
char *path = pathEnd? mpw_strndup( filePath, (size_t)(pathEnd - filePath) ): NULL;
|
||||
if (!path)
|
||||
return false;
|
||||
|
||||
|
@@ -16,6 +16,8 @@
|
||||
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
|
||||
//==============================================================================
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
@@ -273,7 +275,7 @@ void cli_free(Arguments *args, Operation *operation) {
|
||||
void cli_args(Arguments *args, Operation *operation, const int argc, char *const argv[]) {
|
||||
|
||||
for (int opt; (opt = getopt( argc, argv, "u:U:m:M:t:P:c:a:p:C:f:F:R:vqh" )) != EOF;
|
||||
optarg? mpw_zero( optarg, strlen( optarg ) ): NULL)
|
||||
optarg? mpw_zero( optarg, strlen( optarg ) ): (void)0)
|
||||
switch (opt) {
|
||||
case 'u':
|
||||
args->fullName = optarg && strlen( optarg )? strdup( optarg ): NULL;
|
||||
|
Reference in New Issue
Block a user