Discussion:
[ast-developers] The print -s does not work anymore
Dr. Werner Fink
2014-08-01 06:45:29 UTC
Permalink
Hi,

I've a report that print -s don't work anymore with version v-

# print -s test
/bin/ksh: print: bad file unit number

Indeed I can verify this:

BUILD/ksh93> print -s test
./arch/linux.i386-64/src/cmd/ksh93/ksh: print: bad file unit number

Werner
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.research.att.com/pipermail/ast-developers/attachments/20140801/cec6eab5/attachment.sig>
David Korn
2014-08-03 21:56:45 UTC
Permalink
Thanks for reporting this. Try this patch and let me know if it fixes it
for you:

--- old/bltins/print.c Thu May 29 07:49:59 2014
+++ new/bltins/print.c Sun Aug 3 14:51:07 2014
@@ -193,7 +193,8 @@
/* print to history file */
if(!sh_histinit((void*)shp))
errormsg(SH_DICT,ERROR_system(1),e_history);
- fd = sffileno(shp->gd->hist_ptr->histfp);
+ outfile = shp->gd->hist_ptr->histfp;
+ fd = sffileno(outfile);
sh_onstate(shp,SH_HISTORY);
sflag++;
break;
@@ -288,6 +289,8 @@
errno = EBADF;
n = 0;
}
+ else if(sflag)
+ n = IOREAD|IOWRITE|IOSEEK;
else if(!(n=shp->fdstatus[fd]))
n = sh_iocheckfd(shp,fd,fd);
if(!(n&IOWRITE))
@@ -297,7 +300,7 @@
return(1);
errormsg(SH_DICT,ERROR_system(1),msg);
}
- if(!(outfile=shp->sftable[fd]))
+ if(!sflag && !(outfile=shp->sftable[fd]))
{
sh_onstate(shp,SH_NOTRACK);
n = SF_WRITE|((n&IOREAD)?SF_READ:0);
Post by Dr. Werner Fink
Hi,
I've a report that print -s don't work anymore with version v-
# print -s test
/bin/ksh: print: bad file unit number
BUILD/ksh93> print -s test
./arch/linux.i386-64/src/cmd/ksh93/ksh: print: bad file unit number
Werner
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.research.att.com/pipermail/ast-developers/attachments/20140803/828f0484/attachment.html>
Dr. Werner Fink
2014-08-18 13:42:15 UTC
Permalink
Post by David Korn
Thanks for reporting this. Try this patch and let me know if it fixes it
--- old/bltins/print.c Thu May 29 07:49:59 2014
+++ new/bltins/print.c Sun Aug 3 14:51:07 2014
@@ -193,7 +193,8 @@
/* print to history file */
if(!sh_histinit((void*)shp))
errormsg(SH_DICT,ERROR_system(1),e_history);
- fd = sffileno(shp->gd->hist_ptr->histfp);
+ outfile = shp->gd->hist_ptr->histfp;
+ fd = sffileno(outfile);
sh_onstate(shp,SH_HISTORY);
sflag++;
break;
@@ -288,6 +289,8 @@
errno = EBADF;
n = 0;
}
+ else if(sflag)
+ n = IOREAD|IOWRITE|IOSEEK;
else if(!(n=shp->fdstatus[fd]))
n = sh_iocheckfd(shp,fd,fd);
if(!(n&IOWRITE))
@@ -297,7 +300,7 @@
return(1);
errormsg(SH_DICT,ERROR_system(1),msg);
}
- if(!(outfile=shp->sftable[fd]))
+ if(!sflag && !(outfile=shp->sftable[fd]))
{
sh_onstate(shp,SH_NOTRACK);
n = SF_WRITE|((n&IOREAD)?SF_READ:0);
Indeed this one works flawless, thanks a lot!
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.research.att.com/pipermail/ast-developers/attachments/20140818/243424ff/attachment.sig>
Loading...