about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-08-09 19:43:02 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-08-09 19:43:02 +0200
commitfb6b948958465f3166da576f8161c48427dcdda7 (patch)
tree5cefb14acbfef0fc399b28736cc3c06488cfb6e1
parent8937dce536f560571413c463be313fa8c48a9143 (diff)
downloadnq-fb6b948958465f3166da576f8161c48427dcdda7.tar.gz
nq-fb6b948958465f3166da576f8161c48427dcdda7.tar.xz
nq-fb6b948958465f3166da576f8161c48427dcdda7.zip
fq: add -a to output non-locked jobs too
-rw-r--r--fq.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fq.c b/fq.c
index 4f8a460..27d4b33 100644
--- a/fq.c
+++ b/fq.c
@@ -48,7 +48,7 @@ main(int argc, char *argv[])
 	off_t off, loff;
 	ssize_t rd;
 	int didsth = 0, seen_nl = 0;
-	int opt = 0, qflag = 0;
+	int opt = 0, aflag = 0, qflag = 0;
 
 #ifdef USE_INOTIFY
 	int ifd, wd;
@@ -56,8 +56,11 @@ main(int argc, char *argv[])
 
 	close(0);
 
-	while ((opt = getopt(argc, argv, "+q")) != -1) {
+	while ((opt = getopt(argc, argv, "+aq")) != -1) {
 		switch (opt) {
+		case 'a':
+			aflag = 1;
+			break;
 		case 'q':
 			qflag = 1;
 			break;
@@ -92,7 +95,7 @@ main(int argc, char *argv[])
 
 		/* skip not running jobs, unless we did not output anything yet
 		 * and are at the last argument.  */
-		if (!islocked(fd) && (didsth || i != argc - 1))
+		if (!aflag && !islocked(fd) && (didsth || i != args_cnt - 1))
 			continue;
 
 		write(1, "==> ", 4);