summaryrefslogtreecommitdiffhomepage
path: root/src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtin.c')
-rw-r--r--src/builtin.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/builtin.c b/src/builtin.c
index bf20c8e..8497a0d 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -345,7 +345,7 @@ static int b_shift(int argc, char **argv) {
* signal arrived.
*/
static int b_read(int argc, char **argv) {
- static char *default_vars[] = {"REPLY", NULL};
+ static char *default_vars[] = {"REPLY", nullptr};
bool raw = false;
double timeout = -1; /* seconds; negative: wait for ever */
int i = 1;
@@ -374,7 +374,7 @@ static int b_read(int argc, char **argv) {
}
struct timeval deadline = {0};
if (timeout >= 0) {
- gettimeofday(&deadline, NULL);
+ gettimeofday(&deadline, nullptr);
deadline.tv_sec += (time_t)timeout;
deadline.tv_usec +=
(suseconds_t)((timeout - (double)(time_t)timeout) * 1e6);
@@ -422,7 +422,7 @@ static int b_read(int argc, char **argv) {
if (timeout >= 0) {
/* -t: give up (status > 128) if no input arrives in time. */
struct timeval now;
- gettimeofday(&now, NULL);
+ gettimeofday(&now, nullptr);
long ms = (long)(deadline.tv_sec - now.tv_sec) * 1000 +
(long)(deadline.tv_usec - now.tv_usec) / 1000;
struct pollfd pfd = {.fd = 0, .events = POLLIN};
@@ -556,7 +556,7 @@ static int b_getopts(int argc, char **argv) {
if (v && (!parse_long(v, &ind) || ind < 1))
ind = 1;
- const char *arg = ind <= nargs ? args[ind - 1] : NULL;
+ const char *arg = ind <= nargs ? args[ind - 1] : nullptr;
if (getopts_off && (!arg || getopts_off >= strlen(arg)))
getopts_off = 0; /* the arguments changed under us: start afresh */
if (getopts_off == 0) {
@@ -576,8 +576,8 @@ static int b_getopts(int argc, char **argv) {
char c = arg[getopts_off++];
char opt_name[2] = {c, '\0'};
const char *result = opt_name;
- const char *optval = NULL;
- const char *spec = c == ':' ? NULL : strchr(optstring, c);
+ const char *optval = nullptr;
+ const char *spec = c == ':' ? nullptr : strchr(optstring, c);
bool took_arg = false;
if (!spec) {
@@ -705,7 +705,7 @@ static bool is_directory(const char *path) {
* @param dest The directory asked for.
* @param print Set if the result came from a non-empty CDPATH entry, in
* which case `cd` prints where it went.
- * @return The path to use, or NULL if CDPATH has no match.
+ * @return The path to use, or nullptr if CDPATH has no match.
*/
static const char *cdpath_search(const char *dest, bool *print) {
const char *cdpath = var_get("CDPATH");
@@ -827,8 +827,8 @@ static bool is_keyword(const char *s) {
*/
int describe_command(const char *name, bool verbose) {
cmdinfo ci;
- const char *what = NULL;
- const alias *al = alias_count ? alias_find(name) : NULL;
+ const char *what = nullptr;
+ const alias *al = alias_count ? alias_find(name) : nullptr;
if (al) {
if (verbose) {
out_printf(&out1, "%s is an alias for %s\n", name, al->value);