From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3730 invoked from network); 11 Aug 2021 20:30:57 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 11 Aug 2021 20:30:57 -0000 Received: from mail-ed1-f50.google.com ([209.85.208.50]) by 1ess; Wed Aug 11 16:23:02 -0400 2021 Received: by mail-ed1-f50.google.com with SMTP id k9so5626110edr.10 for <9front@9front.org>; Wed, 11 Aug 2021 13:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=OkLCbAKtqkIWTa+FVXGBiOMcvJEnrNvslXmkmFUp71I=; b=HekDXDNU/2lxlGYDU4JeOEV9Cy6YwgkH5NWokpuvwYG33bAna4UsAp84a3LoeuCJi1 r95s7I2LXjGswQdZyws8pcA/+JSWoWoy8yNOOeSknEE4gnKg2nushnVdikmUiBBLdSZQ 75T4ArYBJGu0JFD9/s1PZUAAi5lZuec8/El6Bxa1l2AgbxW1ag7cI+8Z0xX4/R6hndJx KQK236Lbz3LQJKZR8fcpVEeSlJhMlaTWei8BsJJ+e/m82Zs30R6OxnoSO1azW50Vf0Ih aF/HLzupETlnh9GsaDZQpWJAsNHJQ0amtcV910oQ8Nru27QNiQbrgTDyWO6KulkZ/6se 9eFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=OkLCbAKtqkIWTa+FVXGBiOMcvJEnrNvslXmkmFUp71I=; b=Hs23jZbzCgXxd4XiQt4+roy/Nz/gTDb4Ay8cg1j3ZIzGR6jApc2uyj5agJwZ9y4Z4y Kkz2iVQlM/jrviQs9ufG7+tOjO9mjkfNj9qKv6GbXwV2QkGa+ECXZkDZdCJubxW8tsEb XHg5y7lNDbcldDrHwqxJNsa4uMWw1hJ4ci4SyFZMcbvjQb9Xqv3iwx2uAX89Ia63g7Kl 6XndO6G/HsovljEPwRhIYmrgl5MmKe0xQ4m56LYHGglYkITigHBWdQCH8AlecbtLeIhj G6Tqt4Sy77ugLA2gc2AVL92zzbyoqHws99iV3nArNMm243kRT6RNfx90kSQTQ9K0mvQY ckig== X-Gm-Message-State: AOAM5320QrTcUNIVywMOp4b+VychvjdUpHylGVlM0XWYLBTVYjqA3Wm7 K8sfJ9HCaVvO6hiArCcSRGIqKkyuz5rSiRZnqXjIKm/L0R4= X-Google-Smtp-Source: ABdhPJw8pyyrqLCS7qaswoRiAsUCR1yzHZdB5Ixs9hMzEdRUybjgz04OnGJlg6xeKQg37GH2Rzq8VvULkwfSGEAGZQ4= X-Received: by 2002:ac2:5bca:: with SMTP id u10mr388084lfn.353.1628712915233; Wed, 11 Aug 2021 13:15:15 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:651c:160b:0:0:0:0 with HTTP; Wed, 11 Aug 2021 13:15:14 -0700 (PDT) In-Reply-To: References: From: Stuart Morrow Date: Wed, 11 Aug 2021 20:15:14 +0000 Message-ID: To: 9front@9front.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: ISO-certified rails database engine out-scaling information-aware layer Subject: Re: [9front] g Reply-To: 9front@9front.org Precedence: bulk Yeah, I suppose it would also look in ?.awk, ?.cpp, ?.mk, and ?.rc. I was about to solve this on my system with nfile -m $files | awk -F\t '$2 ~ /^text|application.x-sh/ { print $1 }' where nfile is a file(1) that actually uses a frog to separate, but then that reads every file two times (once by nfile, once by grep), so I suppose the right thing all along was to have a grep that can identify binary files by itself (as on other OSes). Anyway, while we're on the subject, is there anything that actually relies on Plan 9's (and Research Unix's) wrong grep -c behaviour? (If I want just the number of lines, I can do grep|wc=E2=80=A6) Anyway here's nfile: diff file.c nfile.c 176c176 < void type(char*, int); --- > void type(char*); 223,226d222 < int i, j, maxlen; < char *cp; < Rune r; < 236,244d231 < maxlen =3D 0; < if(mime =3D=3D 0 || argc > 1){ < for(i =3D 0; i < argc; i++) { < for (j =3D 0, cp =3D argv[i]; *cp; j++, cp +=3D chartorune(&r, cp)) < ; < if(j > maxlen) < maxlen =3D j; < } < } 247c234 < print ("stdin: "); --- > print("stdin\t"); 251,252c238,239 < for(i =3D 0; i < argc; i++) < type(argv[i], maxlen); --- > for(int i =3D 0; i < argc; i++) > type(argv[i]); 258c245 < type(char *file, int nlen) --- > type(char *file) 260,272c247 < Rune r; < int i; < char *p; < < if(nlen > 0){ < slash =3D 0; < for (i =3D 0, p =3D file; *p; i++) { < if (*p =3D=3D '/') /* find rightmost slash */ < slash =3D p; < p +=3D chartorune(&r, p); /* count runes */ < } < print("%s:%*s",file, nlen-i+1, ""); < } --- > print("%s\t", file); --- //.git/fs/object/a9bccf9e9b1bd408629edaac277f6b3a3a4ab6fb/tree/sys/man/= 1/file +++ sys/man/1/file @@ -106,7 +106,19 @@ .I file decides its input is binary. +.PP +.I Nfile +is the same but +filename and classification are tab-separated. .SH SOURCE .B /sys/src/cmd/file.c +.br +.B /sys/src/cmd/nfile.c .SH BUGS It can make mistakes. +.br +.I File +should be implemented as an +.I nfile +wrapper. + --- //.git/fs/object/a9bccf9e9b1bd408629edaac277f6b3a3a4ab6fb/tree/sys/man/= 1/resample +++ sys/man/1/resample @@ -82,4 +82,5 @@ .B /sys/src/cmd/resize.c .SH "SEE ALSO .IR crop (1), -.IR image (6) +.IR image (6), +.IR file (1) (The relevance of file to resample is it's the easiest way to find out an image's size and this isn't documented anywhere.)