#define xisdigit(c) ((unsigned int) (c) - '0' <= 9)
#define xerror() perror(xitoa(__LINE__))
+#ifdef __GNUC__
+#define UNUSED(x) UNUSED_##x __attribute__((__unused__))
+#else
+#define UNUSED(x) UNUSED_##x
+#endif /* __GNUC__ */
+
/* Forward declarations */
static void redraw(char *path);
static int spawn(char *file, char *arg1, char *arg2, const char *dir, uchar flag);
/* Functions */
-static void sigint_handler(int sig)
+static void sigint_handler(int UNUSED(sig))
{
- (void) sig;
-
g_states |= STATE_INTERRUPTED;
}
-static uint xatoi(const char *str)
-{
- int val = 0;
-
- if (!str)
- return 0;
-
- while (xisdigit(*str)) {
- val = val * 10 + (*str - '0');
- ++str;
- }
-
- return val;
-}
-
static char *xitoa(uint val)
{
static char ascbuf[32] = {0};
spawn(tmp, "0", NULL, path, r);
}
-static int sum_bsize(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
+static int sum_bsize(const char *UNUSED(fpath), const struct stat *sb, int typeflag, struct FTW *UNUSED(ftwbuf))
{
- (void) fpath;
- (void) ftwbuf;
-
if (sb->st_blocks && (typeflag == FTW_F || typeflag == FTW_D))
ent_blocks += sb->st_blocks;
return 0;
}
-static int sum_asize(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
+static int sum_asize(const char *UNUSED(fpath), const struct stat *sb, int typeflag, struct FTW *UNUSED(ftwbuf))
{
- (void) fpath;
- (void) ftwbuf;
-
if (sb->st_size && (typeflag == FTW_F || typeflag == FTW_D))
ent_blocks += sb->st_size;
session = optarg;
break;
case 't':
- idletimeout = xatoi(optarg);
+ idletimeout = atoi(optarg);
break;
case 'v':
namecmpfn = &xstrverscasecmp;
#endif
/* Set nnn nesting level */
- setenv(env_cfg[NNNLVL], xitoa(xatoi(getenv(env_cfg[NNNLVL])) + 1), 1);
+ arg = getenv(env_cfg[NNNLVL]);
+ setenv(env_cfg[NNNLVL], xitoa((arg ? atoi(arg) : 0) + 1), 1);
if (xgetenv_set(env_cfg[NNN_TRASH]))
cfg.trash = 1;