Re: [dev] [sbase] Portability of chvt

2013-08-15 Thread Galos, David
> I cherry-picked this over to ubase (with slight modifications to remove > the unneeded enum and include linux/vt.h and linux/kd.h). I approve. I'll remove chvt from sbase

Re: [dev] [st] [bug?] black, defaultbg, and altscreen

2013-08-15 Thread Roberto E. Vargas Caballero
>Part of the background will initially be whatever color 'black' is set to >(red if you applied the diff) rather than defaultbg. It only happens once >for each new instance of st and can be cleared by simply resizing the >window or scrolling down. I can reproduce the issue here and

Re: [dev] [sbase] Portability of chvt

2013-08-15 Thread sin
GOn Thu, Aug 15, 2013 at 12:21:17AM +0300, sin wrote: > On Wed, Aug 14, 2013 at 05:09:42PM -0400, Calvin Morrison wrote: > > On 14 August 2013 14:12, Roberto E. Vargas Caballero > > wrote: > > > Hello, > > > > > > I was testing some of the tools of sbase, and after > > > trying chvt I cou

[dev] [sbase] [patch] Some patches - grouped together

2013-08-15 Thread sin
Hi, I've put these patches together in this e-mail to make it easy for David to pick them up. 0001-Fix-segfault-in-tail-1.patch 0002-Fix-warnings-about-strcpy-etc.-on-OpenBSD.patch 0003-Add-not-implemented-errors-for-unimplemented-flags.patch 0004-Add-initial-support-for-id-1.patch 0005-Add-strin

Re: [dev] [sbase] [patch] Fix warnings about strcpy() etc. on OpenBSD

2013-08-15 Thread sin
On Thu, Aug 15, 2013 at 11:34:32AM +, Thorsten Glaser wrote: > sin dixit: > > >On Thu, Aug 15, 2013 at 11:00:11AM +, Thorsten Glaser wrote: > > > >> > if(len+1 > *size && !(*p = realloc(*p, len+1))) >^ > > >> >

Re: [dev] [sbase] [patch] Fix warnings about strcpy() etc. on OpenBSD

2013-08-15 Thread Thorsten Glaser
sin dixit: >On Thu, Aug 15, 2013 at 11:00:11AM +, Thorsten Glaser wrote: > >> >if(len+1 > *size && !(*p = realloc(*p, len+1))) ^ >> >eprintf("realloc:"); >> > >> >- strcpy(&(*p)[len-n], buf);

Re: [dev] [sbase] [patch v3] Add strings(1)

2013-08-15 Thread sin
On Thu, Aug 15, 2013 at 01:06:25PM +0200, Roberto E. Vargas Caballero wrote: > Only other sugestion, this loop could be done better with a do while: > > dostrings(FILE *fp, const char *fname) > { > unsigned char buf[BUFSIZ]; > int c, i = 0; > off_t offset = 0; > do { >

Re: [dev] [sbase] [patch] Fix warnings about strcpy() etc. on OpenBSD

2013-08-15 Thread sin
On Thu, Aug 15, 2013 at 11:00:11AM +, Thorsten Glaser wrote: > > if(len+1 > *size && !(*p = realloc(*p, len+1))) > > eprintf("realloc:"); > > > >-strcpy(&(*p)[len-n], buf); > >+snprintf(&(*p)[len-n], n+1, "%s", buf); > > Again, I object

Re: [dev] [sbase] [patch v3] Add strings(1)

2013-08-15 Thread Roberto E. Vargas Caballero
> +dostrings(FILE *fp, const char *fname) > +{ > + unsigned char buf[BUFSIZ]; > + int c, i = 0; > + off_t offset = 0; > + > + while ((c = getc(fp)) != EOF) { > + offset++; > + if (isprint(c)) { > + buf[i++] = c; > + if

Re: [dev] [sbase] [patch v2] Add strings(1)

2013-08-15 Thread Roberto E. Vargas Caballero
> Yeah I should have mentioned, my implementation mirrors strings from > Plan9. My understanding is that sbase is not necessarily posix compliant. > > Personally I'm used to this implementation. If you guys think it makes > more sense to switch to the standard output then I can do that. We shou

Re: [dev] [sbase] [patch] Fix warnings about strcpy() etc. on OpenBSD

2013-08-15 Thread Thorsten Glaser
sin dixit: > if(!(p = malloc(strlen(d->d_name)+1))) > eprintf("malloc:"); >- strcpy(p, d->d_name); >+ snprintf(p, strlen(d->d_name)+1, "%s", d->d_name); I object. The better fix here is: +

[dev] [sbase] [patch] Add 'not implemented' errors for unimplemented flags

2013-08-15 Thread sin
Hi, These used to live in TODO but we got rid off them. Make sure we keep track of what we want to support by printing a message when those flags are unimplemented. Hopefully this will make it clear to people to go off and implement those options when they really need them. Thanks, sin >From 79

[dev] [sbase] [patch] Fix warnings about strcpy() etc. on OpenBSD

2013-08-15 Thread sin
Hi, Just a couple of warnings fixed. Thanks, sin >From f0b0a8dc8686963d18eb781782ba5d9bde9a Mon Sep 17 00:00:00 2001 From: sin Date: Thu, 15 Aug 2013 10:25:29 +0100 Subject: [PATCH] Fix warnings about strcpy() etc. on OpenBSD --- ls.c| 2 +- split.c | 2 +- util/afgets.

[dev] [sbase] [patch] Add stat(1)

2013-08-15 Thread sin
Hi, Added stat(1), no manpage yet. Tested on Linux + OpenBSD. Thanks, sin >From b8bd9d28387a37e826b563171c8b92fe770bce67 Mon Sep 17 00:00:00 2001 From: sin Date: Thu, 15 Aug 2013 10:04:38 +0100 Subject: [PATCH] Add stat(1) --- Makefile | 1 + stat.c | 73 +++

[dev] [sbase] [patch v3] Add strings(1)

2013-08-15 Thread sin
Hi, Ensure we print whatever is left off after we get an EOF. >From 44572c4ac52791b6957b4aaf09a061770abb20bf Mon Sep 17 00:00:00 2001 From: sin Date: Wed, 14 Aug 2013 10:41:55 +0100 Subject: [PATCH] Add strings(1) --- Makefile | 1 + strings.c | 67

Re: [dev] [sbase] [patch v2] Add strings(1)

2013-08-15 Thread sin
On Thu, Aug 15, 2013 at 10:44:51AM +0200, Roberto E. Vargas Caballero wrote: > > + buf[i] = '\0'; > > + printf("%8ld: %s\n", (long)offset - i - 1, buf); > > > I can see you are also printing the offset of the string in the file. It > seems a bit

Re: [dev] [sbase] [patch v2] Add strings(1)

2013-08-15 Thread Roberto E. Vargas Caballero
> + buf[i] = '\0'; > + printf("%8ld: %s\n", (long)offset - i - 1, buf); I can see you are also printing the offset of the string in the file. It seems a bit strange to me, when by default strings output format is only the string detected [1]