[BACK]Return to bc.y CVS log [TXT][DIR] Up to [local] / src / usr.bin / bc

Diff for /src/usr.bin/bc/bc.y between version 1.22 and 1.23

version 1.22, 2004/01/13 08:43:23 version 1.23, 2004/02/18 07:43:58
Line 94 
Line 94 
 static ssize_t          epilogue;  static ssize_t          epilogue;
 static bool             st_has_continue;  static bool             st_has_continue;
 static char             str_table[UCHAR_MAX][2];  static char             str_table[UCHAR_MAX][2];
   static int              fileindex;
 static int              sargc;  static int              sargc;
 static char             **sargv;  static char             **sargv;
 static char             *filename;  static char             *filename;
Line 923 
Line 924 
 int  int
 yywrap(void)  yywrap(void)
 {  {
         if (optind < sargc) {          if (fileindex < sargc) {
                 filename = sargv[optind++];                  filename = sargv[fileindex++];
                 yyin = fopen(filename, "r");                  yyin = fopen(filename, "r");
                 lineno = 1;                  lineno = 1;
                 if (yyin == NULL)                  if (yyin == NULL)
                         err(1, "cannot open %s", filename);                          err(1, "cannot open %s", filename);
                 return 0;                  return 0;
         } else if (optind == sargc) {          } else if (fileindex == sargc) {
                 optind++;                  fileindex++;
                 yyin = stdin;                  yyin = stdin;
                 lineno = 1;                  lineno = 1;
                 filename = "stdin";                  filename = "stdin";
Line 1055 
Line 1056 
 int  int
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         int     ch, ret;          int     i, ch, ret;
         int     p[2];          int     p[2];
   
         init();          init();
         setlinebuf(stdout);          setlinebuf(stdout);
   
           sargv = malloc(argc * sizeof(char *));
           if (sargv == NULL)
                   err(1, NULL);
   
         /* The d debug option is 4.4 BSD dc(1) compatible */          /* The d debug option is 4.4 BSD dc(1) compatible */
         while ((ch = getopt(argc, argv, "cdl")) != -1) {          while ((ch = getopt(argc, argv, "cdl")) != -1) {
                 switch (ch) {                  switch (ch) {
Line 1069 
Line 1074 
                         do_fork = false;                          do_fork = false;
                         break;                          break;
                 case 'l':                  case 'l':
                         argv[1] = _PATH_LIBB;                          sargv[sargc++] = _PATH_LIBB;
                         optind = 1;  
                         break;                          break;
                 default:                  default:
                         usage();                          usage();
                 }                  }
         }          }
   
         sargc = argc;          argc -= optind;
         sargv = argv;          argv += optind;
   
           for (i = 0; i < argc; i++)
                   sargv[sargc++] = argv[i];
   
         if (do_fork) {          if (do_fork) {
                 if (pipe(p) == -1)                  if (pipe(p) == -1)

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23