summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6c8ba8e)
SCCS-vsn: usr.bin/bc/bc.y 4.4
-static char *sccsid = "@(#)bc.y 4.3 (Berkeley) 85/11/28";
+static char *sccsid = "@(#)bc.y 4.4 (Berkeley) 87/12/12";
int *getout();
%}
%right '='
int *getout();
%}
%right '='
int in;
char cary[1000], *cp = { cary };
char string[1000], *str = {string};
int in;
char cary[1000], *cp = { cary };
char string[1000], *str = {string};
int * b_sp_nxt = { b_space };
int bdebug = 0;
int * b_sp_nxt = { b_space };
int bdebug = 0;
-bundle(a){
- int i, *p, *q;
+/*VARARGS*/
+bundle(va_alist) va_dcl {
+ va_list ap;
+ int i, *q;
+ va_start(ap);
+ i = va_arg(ap, int);
q = b_sp_nxt;
if( bdebug ) printf("bundle %d elements at %o\n",i, q );
while(i-- > 0){
if( b_sp_nxt >= & b_space[b_sp_max] ) yyerror( "bundling space exceeded" );
q = b_sp_nxt;
if( bdebug ) printf("bundle %d elements at %o\n",i, q );
while(i-- > 0){
if( b_sp_nxt >= & b_space[b_sp_max] ) yyerror( "bundling space exceeded" );
+ * b_sp_nxt++ = va_arg(ap, int);
}
* b_sp_nxt++ = 0;
yyval = q;
}
* b_sp_nxt++ = 0;
yyval = q;
int *getout(){
printf("q");
fflush(stdout);
int *getout(){
printf("q");
fflush(stdout);
if((argv[1][1] == 'd')||(argv[1][1] == 'c')){
yyinit(--argc, ++argv);
yyparse();
if((argv[1][1] == 'd')||(argv[1][1] == 'c')){
yyinit(--argc, ++argv);
yyparse();
}
if(argv[1][1] != 'l'){
printf("unrecognizable argument\n");
fflush(stdout);
}
if(argv[1][1] != 'l'){
printf("unrecognizable argument\n");
fflush(stdout);
}
argv[1] = "/usr/lib/lib.b";
}
}
argv[1] = "/usr/lib/lib.b";
}
close(p[1]);
yyinit(argc, argv);
yyparse();
close(p[1]);
yyinit(argc, argv);
yyparse();
}
close(0);
dup(p[0]);
close(p[0]);
close(p[1]);
}
close(0);
dup(p[0]);
close(p[0]);
close(p[1]);
- execl("/bin/dc", "dc", "-", 0);
- execl("/usr/bin/dc", "dc", "-", 0);
+ execl("/bin/dc", "dc", "-", (char *)0);
+ execl("/usr/bin/dc", "dc", "-", (char *)0);
+ perror("bc: can't find dc");
+ exit(1);