Hi,

i've been saving time+frustration for having had this, but i'm not proposing
anything, i'm aware how this what most likely exists only because of how badly
scripts stick w/me across reinstalls/need of backups, compared to anything i
push into my /usr/src.

for the example below i used boardnames, while i usually use the active branch
name/window group it's on, so this can help locating them too xD

imagine making any use of the list below w/o "-t tag2remind" when in hurry to
check what you've got connected/powered on, i think i've never chosen the right
cu process to kill if i've lost an xterm/tmux and started guessing one by one..
those cuaU*s are all usb adapters behind a couple of uhub*s, so they keep
changing portnumbers almost once a week or so, reboot or accidentally
unplugged uhub etc..

$ pgrep -fl cu
6558 cu -l cuaU4 -t Cubie2
13159 cu -l cuaU5 -t BBoneB
36731 cu -l cuaU6 -t ODroidXU
69144 cu -l cuaU1 -t Pine64P
2991 cu -l cuaU3 -t rk3188
75345 cu -l cuaU2 -t WandBoard
59101 cu -l cuaU0 -t PandaBoardES


Sry for noise:)
-Artturi



diff --git a/usr.bin/cu/cu.1 b/usr.bin/cu/cu.1
index 2f1a3c836c6..d97d5a9f93f 100644
--- a/usr.bin/cu/cu.1
+++ b/usr.bin/cu/cu.1
@@ -38,6 +38,7 @@
 .Op Fl d
 .Op Fl l Ar line
 .Op Fl s Ar speed | Fl Ar speed
+.Op Fl t Ar tag
 .Nm
 .Op Ar host
 .Sh DESCRIPTION
@@ -75,6 +76,17 @@ devices by default.
 .It Fl s Ar speed | Fl Ar speed
 Set the speed of the connection.
 The default is 9600.
+.It Fl t Ar tag
+Useful for
+.Dq tagging
+long-term
+.Nm
+processes, with something distinctive to be helpful
+for listing-like outputs, as produced by
+.Xr pgrep 1 ,
+with
+.Pa -fl
+arguments for example.
 .El
 .Pp
 If
diff --git a/usr.bin/cu/cu.c b/usr.bin/cu/cu.c
index 8d1935a11c2..c3c1197b01d 100644
--- a/usr.bin/cu/cu.c
+++ b/usr.bin/cu/cu.c
@@ -66,7 +66,7 @@ void          try_remote(const char *, const char *, const 
char *);
 __dead void
 usage(void)
 {
-       fprintf(stderr, "usage: %s [-d] [-l line] [-s speed | -speed]\n",
+       fprintf(stderr, "usage: %s [-d] [-l line] [-s speed | -speed] [-t]\n",
            __progname);
        fprintf(stderr, "       %s [host]\n", __progname);
        exit(1);
@@ -100,7 +100,7 @@ main(int argc, char **argv)
                        errx(1, "speed asprintf");
        }
 
-       while ((opt = getopt(argc, argv, "dl:s:")) != -1) {
+       while ((opt = getopt(argc, argv, "dl:s:t:")) != -1) {
                switch (opt) {
                case 'd':
                        is_direct = 1;
@@ -113,6 +113,8 @@ main(int argc, char **argv)
                        if (errstr != NULL)
                                errx(1, "speed is %s: %s", errstr, optarg);
                        break;
+               case 't':
+                       break;
                default:
                        usage();
                }
 

Reply via email to