Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 88742 | Differences between
and this patch

Collapse All | Expand All

(-)xv-3.10a.orig/xvbrowse.c (-1 / +12 lines)
Lines 4950-4956 Link Here
4950
4950
4951
    if (dstdir) {
4951
    if (dstdir) {
4952
#ifndef VMS  /* we don't delete directories in VMS */
4952
#ifndef VMS  /* we don't delete directories in VMS */
4953
      sprintf(buf, "rm -rf %s", dst);
4953
      char *x, *y, *name;
4954
4955
	  x = name = (char *) malloc((5 * strlen(dst))+3);*x++ = 0x27;
4956
	  for (y = dst; *y; ++y) {
4957
		  if (0x27 == *y) {
4958
			  strcpy(x, "'\"'\"'");
4959
			  x += strlen(x);
4960
		  } else *x++ = *y;
4961
	  }
4962
	  strcpy (x, "'");
4963
      sprintf(buf, "rm -rf %s", name);
4964
	  free (name);
4954
      if (system(buf)) {     /* okay, so it's cheating... */
4965
      if (system(buf)) {     /* okay, so it's cheating... */
4955
	SetISTR(ISTR_WARNING, "Unable to remove directory %s", dst);
4966
	SetISTR(ISTR_WARNING, "Unable to remove directory %s", dst);
4956
	return 1;
4967
	return 1;
(-)xv-3.10a.orig/xv.c (-5 / +21 lines)
Lines 2828-2834 Link Here
2828
  /* returns '1' on success, with name of uncompressed file in uncompname
2828
  /* returns '1' on success, with name of uncompressed file in uncompname
2829
     returns '0' on failure */
2829
     returns '0' on failure */
2830
2830
2831
  char namez[128], *fname, buf[512];
2831
  char namez[128], *fname, buf[512], *tname;
2832
2832
2833
  fname = name;
2833
  fname = name;
2834
  namez[0] = '\0';
2834
  namez[0] = '\0';
Lines 2871-2881 Link Here
2871
#endif
2871
#endif
2872
2872
2873
#ifndef VMS
2873
#ifndef VMS
2874
  if (filetype == RFT_COMPRESS)
2874
  if (filetype == RFT_COMPRESS || filetype == RFT_BZIP2) {
2875
    sprintf(buf,"%s -c %s >%s", UNCOMPRESS, fname, uncompname);
2875
	  char *x, *y;
2876
2877
	  x = tname = (char *) malloc((5 * strlen(fname))+3);*x++ = 0x27;
2878
	  for (y = fname; *y; ++y) {
2879
		  if (0x27 == *y) {
2880
			  strcpy(x, "'\"'\"'");
2881
			  x += strlen(x);
2882
		  } else *x++ = *y;
2883
	  }
2884
	  strcpy (x, "'");
2885
	}
2886
  if (filetype == RFT_COMPRESS) {
2887
    sprintf(buf,"%s -c %s >%s", UNCOMPRESS, tname, uncompname);
2888
	free (tname);
2889
  }
2876
# ifdef BUNZIP2
2890
# ifdef BUNZIP2
2877
  else if (filetype == RFT_BZIP2)
2891
  else if (filetype == RFT_BZIP2) {
2878
    sprintf(buf,"%s -c %s >%s", BUNZIP2, fname, uncompname);
2892
    sprintf(buf,"%s -c %s >%s", BUNZIP2, tname, uncompname);
2893
	free (tname);
2894
  }
2879
# endif
2895
# endif
2880
#else /* it IS VMS */
2896
#else /* it IS VMS */
2881
# ifdef GUNZIP
2897
# ifdef GUNZIP
(-)xv-3.10a.orig/xvpds.c (-45 / +47 lines)
Lines 191-197 Link Here
191
191
192
  count=0;
192
  count=0;
193
  bp=buff;
193
  bp=buff;
194
  while (1) {
194
  while (count<MAX_SIZE) {
195
    c=fgetc(f);
195
    c=fgetc(f);
196
    switch (c) {
196
    switch (c) {
197
197
Lines 210-215 Link Here
210
    default:	count++;  *bp++ = c;
210
    default:	count++;  *bp++ = c;
211
    }
211
    }
212
  }
212
  }
213
  return (count);
213
}
214
}
214
215
215
216
Lines 397-403 Link Here
397
398
398
      if (strcmp(scanbuff,"END") == 0) {
399
      if (strcmp(scanbuff,"END") == 0) {
399
	break;
400
	break;
400
      } else if (sscanf(scanbuff," RECORD_TYPE = %s",rtbuff) == 1) {
401
      } else if (sscanf(scanbuff," RECORD_TYPE = %62s",rtbuff) == 1) {
401
	if (strncmp(rtbuff,"VARIABLE_LENGTH", (size_t) 15) == 0) {
402
	if (strncmp(rtbuff,"VARIABLE_LENGTH", (size_t) 15) == 0) {
402
	  /*		itype=PDSVARIABLE; */
403
	  /*		itype=PDSVARIABLE; */
403
	} else if (strncmp(rtbuff,"FIXED_LENGTH", (size_t) 12) == 0) {
404
	} else if (strncmp(rtbuff,"FIXED_LENGTH", (size_t) 12) == 0) {
Lines 416-422 Link Here
416
	    if (irecsize == 0) irecsize=recsize;
417
	    if (irecsize == 0) irecsize=recsize;
417
	lastwasinote=FALSE;
418
	lastwasinote=FALSE;
418
	continue;
419
	continue;
419
      } else if (sscanf(scanbuff," FILE_TYPE = %s", rtbuff) != 0) {
420
      } else if (sscanf(scanbuff," FILE_TYPE = %62s", rtbuff) != 0) {
420
	lastwasinote=FALSE;
421
	lastwasinote=FALSE;
421
	if (strncmp(rtbuff,"IMAGE", (size_t) 5) == 0) {
422
	if (strncmp(rtbuff,"IMAGE", (size_t) 5) == 0) {
422
	  isimage=TRUE;
423
	  isimage=TRUE;
Lines 445-529 Link Here
445
	lastwasinote=FALSE; continue;
446
	lastwasinote=FALSE; continue;
446
      } else if (sscanf(scanbuff," SAMPLE_BITS = %d", &samplesize) == 1) {
447
      } else if (sscanf(scanbuff," SAMPLE_BITS = %d", &samplesize) == 1) {
447
	lastwasinote=FALSE; continue;
448
	lastwasinote=FALSE; continue;
448
      } else if (sscanf(scanbuff," SAMPLE_TYPE = %s", sampletype) == 1) {
449
      } else if (sscanf(scanbuff," SAMPLE_TYPE = %50s", sampletype) == 1) {
449
	lastwasinote=FALSE; continue;
450
	lastwasinote=FALSE; continue;
450
      } else if (sscanf(scanbuff," SPACECRAFT_NAME = %s %s",
451
      } else if (sscanf(scanbuff," SPACECRAFT_NAME = %50s %1020s",
451
			spacecraft,garbage) == 2 ) {
452
			spacecraft,garbage) == 2 ) {
452
	strcat(spacecraft,xv_strstr(scanbuff, spacecraft)+strlen(spacecraft));
453
	if (strlen (spacecraft) + strlen (xv_strstr(scanbuff, spacecraft)+strlen(spacecraft)) < COMMENTSIZE-2)
454
		strcat(spacecraft,xv_strstr(scanbuff, spacecraft)+strlen(spacecraft));
453
	lastwasinote=FALSE;  continue;
455
	lastwasinote=FALSE;  continue;
454
      } else if (sscanf(scanbuff," SPACECRAFT_NAME = %s", spacecraft) == 1) {
456
      } else if (sscanf(scanbuff," SPACECRAFT_NAME = %50s", spacecraft) == 1) {
455
	lastwasinote=FALSE; continue;
457
	lastwasinote=FALSE; continue;
456
458
457
      } else if (sscanf(scanbuff," TARGET_NAME = %s", target) == 1) {
459
      } else if (sscanf(scanbuff," TARGET_NAME = %50s", target) == 1) {
458
	lastwasinote=FALSE; continue;
460
	lastwasinote=FALSE; continue;
459
      } else if (sscanf(scanbuff," TARGET_BODY = %s", target) == 1) {
461
      } else if (sscanf(scanbuff," TARGET_BODY = %50s", target) == 1) {
460
	lastwasinote=FALSE; continue;
462
	lastwasinote=FALSE; continue;
461
463
462
      } else if (sscanf(scanbuff," MISSION_PHASE_NAME = %s", mphase) == 1) {
464
      } else if (sscanf(scanbuff," MISSION_PHASE_NAME = %50s", mphase) == 1) {
463
	lastwasinote=FALSE; continue;
465
	lastwasinote=FALSE; continue;
464
      } else if (sscanf(scanbuff," MISSION_PHASE = %s", mphase) == 1) {
466
      } else if (sscanf(scanbuff," MISSION_PHASE = %50s", mphase) == 1) {
465
	lastwasinote=FALSE; continue;
467
	lastwasinote=FALSE; continue;
466
468
467
      } else if (sscanf(scanbuff," INSTRUMENT_NAME = %s", iname) == 1) {
469
      } else if (sscanf(scanbuff," INSTRUMENT_NAME = %50s", iname) == 1) {
468
	lastwasinote=FALSE; continue;
470
	lastwasinote=FALSE; continue;
469
471
470
      } else if (sscanf(scanbuff," GAIN_MODE_ID = %s", gainmode) == 1) {
472
      } else if (sscanf(scanbuff," GAIN_MODE_ID = %50s", gainmode) == 1) {
471
	lastwasinote=FALSE; continue;
473
	lastwasinote=FALSE; continue;
472
474
473
      } else if (sscanf(scanbuff," INSTRUMENT_GAIN_STATE = %s",gainmode)==1) {
475
      } else if (sscanf(scanbuff," INSTRUMENT_GAIN_STATE = %50s", gainmode)==1) {
474
	lastwasinote=FALSE; continue;
476
	lastwasinote=FALSE; continue;
475
477
476
      } else if (sscanf(scanbuff," EDIT_MODE_ID = %s", editmode) == 1) {
478
      } else if (sscanf(scanbuff," EDIT_MODE_ID = %50s", editmode) == 1) {
477
	lastwasinote=FALSE; continue;
479
	lastwasinote=FALSE; continue;
478
480
479
      } else if (sscanf(scanbuff," INSTRUMENT_EDIT_MODE = %s", editmode)==1) {
481
      } else if (sscanf(scanbuff," INSTRUMENT_EDIT_MODE = %50s", editmode)==1) {
480
	lastwasinote=FALSE; continue;
482
	lastwasinote=FALSE; continue;
481
483
482
      } else if (sscanf(scanbuff," SCAN_MODE_ID = %s", scanmode) == 1) {
484
      } else if (sscanf(scanbuff," SCAN_MODE_ID = %50s", scanmode) == 1) {
483
	lastwasinote=FALSE; continue;
485
	lastwasinote=FALSE; continue;
484
486
485
      } else if (sscanf(scanbuff," INSTRUMENT_SCAN_RATE = %s", scanmode)==1) {
487
      } else if (sscanf(scanbuff," INSTRUMENT_SCAN_RATE = %50s", scanmode)==1) {
486
	lastwasinote=FALSE; continue;
488
	lastwasinote=FALSE; continue;
487
489
488
      } else if (sscanf(scanbuff," SHUTTER_MODE_ID = %s", shuttermode) == 1) {
490
      } else if (sscanf(scanbuff," SHUTTER_MODE_ID = %50s", shuttermode) == 1) {
489
	lastwasinote=FALSE; continue;
491
	lastwasinote=FALSE; continue;
490
492
491
      } else if (sscanf(scanbuff," INSTRUMENT_SHUTTER_MODE = %s",
493
      } else if (sscanf(scanbuff," INSTRUMENT_SHUTTER_MODE = %50s", shuttermode) == 1) {
492
			shuttermode) == 1) {
493
	lastwasinote=FALSE; continue;
494
	lastwasinote=FALSE; continue;
494
495
495
      } else if (sscanf(scanbuff," SCAN_MODE_ID = %s", scanmode) == 1) {
496
      } else if (sscanf(scanbuff," SCAN_MODE_ID = %50s", scanmode) == 1) {
496
	lastwasinote=FALSE; continue;
497
	lastwasinote=FALSE; continue;
497
498
498
      } else if (sscanf(scanbuff," INSTRUMENT_SCAN_RATE = %s", scanmode)==1) {
499
      } else if (sscanf(scanbuff," INSTRUMENT_SCAN_RATE = %50s", scanmode)==1) {
499
	lastwasinote=FALSE; continue;
500
	lastwasinote=FALSE; continue;
500
501
501
      } else if (sscanf(scanbuff," SPACECRAFT_EVENT_TIME = %s", itime) == 1) {
502
      } else if (sscanf(scanbuff," SPACECRAFT_EVENT_TIME = %50s", itime) == 1) {
502
	lastwasinote=FALSE; continue;
503
	lastwasinote=FALSE; continue;
503
504
504
      } else if (sscanf(scanbuff," IMAGE_TIME = %s", itime) == 1) {
505
      } else if (sscanf(scanbuff," IMAGE_TIME = %50s", itime) == 1) {
505
	lastwasinote=FALSE; continue;
506
	lastwasinote=FALSE; continue;
506
507
507
      } else if (sscanf(scanbuff," FILTER_NAME = %s", filtname) == 1) {
508
      } else if (sscanf(scanbuff," FILTER_NAME = %50s", filtname) == 1) {
508
	lastwasinote=FALSE; continue;
509
	lastwasinote=FALSE; continue;
509
510
510
      } else if (sscanf(scanbuff," INSTRUMENT_FILTER_NAME = %s",filtname)==1) {
511
      } else if (sscanf(scanbuff," INSTRUMENT_FILTER_NAME = %50s", filtname)==1) {
511
	lastwasinote=FALSE; continue;
512
	lastwasinote=FALSE; continue;
512
513
513
      } else if ((sscanf(scanbuff," EXPOSURE_DURATION = %s", exposure) == 1)
514
      } else if ((sscanf(scanbuff," EXPOSURE_DURATION = %50s", exposure) == 1)
514
	      || (sscanf(scanbuff," INSTRUMENT_EXPOSURE_DURATION = %s",
515
	      || (sscanf(scanbuff," INSTRUMENT_EXPOSURE_DURATION = %50s",
515
			 exposure) == 1)) {
516
			 exposure) == 1)) {
516
	tmptmp = (char *) index(scanbuff,'=');
517
	tmptmp = (char *) index(scanbuff,'=');
517
	tmptmp++;
518
	tmptmp++;
518
	while((*tmptmp) == ' ')
519
	while((*tmptmp) == ' ')
519
	    tmptmp++;
520
	    tmptmp++;
520
	strcpy(exposure,tmptmp);
521
	strncpy(exposure,tmptmp,COMMENTSIZE);
521
	lastwasinote=FALSE; continue;
522
	lastwasinote=FALSE; continue;
522
523
523
      } else if (sscanf(scanbuff, "NOTE = %s", inote) == 1) {
524
      } else if (sscanf(scanbuff, "NOTE = %1000s", inote) == 1) {
524
	tmptmp = (char *) index(scanbuff,'='); tmptmp++;
525
	tmptmp = (char *) index(scanbuff,'='); tmptmp++;
525
	while (((*tmptmp) == ' ') || ((*tmptmp)  == '"')) tmptmp++;
526
	while (((*tmptmp) == ' ') || ((*tmptmp)  == '"')) tmptmp++;
526
	strcpy(inote,tmptmp);
527
	strncpy(inote,tmptmp,sizeof(inote)-2);
527
	strcat(inote," ");
528
	strcat(inote," ");
528
529
529
	/*   evil and somewhat risky:  A "note" (really, any textual
530
	/*   evil and somewhat risky:  A "note" (really, any textual
Lines 548-554 Link Here
548
      } else if (lastwasinote) {
549
      } else if (lastwasinote) {
549
	tmptmp=scanbuff;
550
	tmptmp=scanbuff;
550
	while (((*tmptmp) == ' ') || ((*tmptmp)  == '"')) tmptmp++;
551
	while (((*tmptmp) == ' ') || ((*tmptmp)  == '"')) tmptmp++;
551
	strcat(inote,tmptmp);
552
	strncat(inote,tmptmp,sizeof(inote)-strlen(inote)-2);
552
	strcat(inote," ");
553
	strcat(inote," ");
553
	if (index(tmptmp,'"') != NULL)
554
	if (index(tmptmp,'"') != NULL)
554
	    lastwasinote=FALSE;
555
	    lastwasinote=FALSE;
Lines 650-673 Link Here
650
    strcat(infobuff,spacecraft);
651
    strcat(infobuff,spacecraft);
651
  }
652
  }
652
653
653
  if (*target) {
654
  if (*target && (strlen(infobuff)+strlen(target)+2 < sizeof (infobuff))) {
654
    strcat(infobuff,", ");
655
    strcat(infobuff,", ");
655
    strcat(infobuff,target);
656
    strcat(infobuff,target);
656
  }
657
  }
657
658
658
  if (*filtname) {
659
  if (*filtname && (strlen(infobuff)+strlen(filtname)+2 < sizeof (infobuff))) {
659
    strcat(infobuff,", ");
660
    strcat(infobuff,", ");
660
    strcat(infobuff,filtname);
661
    strcat(infobuff,filtname);
661
  }
662
  }
662
663
663
  if (*itime) {
664
  if (*itime && (strlen(infobuff)+strlen(itime)+2 < sizeof (infobuff))) {
664
    strcat(infobuff,", ");
665
    strcat(infobuff,", ");
665
    strcat(infobuff,itime);
666
    strcat(infobuff,itime);
666
  }
667
  }
667
668
668
  SetISTR(ISTR_WARNING,infobuff);
669
  /* OUCH! */
670
  SetISTR(ISTR_WARNING,"%s",infobuff);
669
671
670
  strcpy(pdsuncompfname,fname);
672
  strncpy(pdsuncompfname,fname, sizeof(pdsuncompfname));
671
  ftypstr = "";
673
  ftypstr = "";
672
674
673
  switch (itype) {
675
  switch (itype) {
Lines 823-847 Link Here
823
    char tmp[256];
825
    char tmp[256];
824
    *(pinfo->comment) = '\0';
826
    *(pinfo->comment) = '\0';
825
827
826
    sprintf(tmp, "Spacecraft: %-28sTarget: %-32s\n", spacecraft, target);
828
    snprintf(tmp, sizeof (tmp), "Spacecraft: %-28sTarget: %-32s\n", spacecraft, target);
827
    strcat(pinfo->comment, tmp);
829
    strcat(pinfo->comment, tmp);
828
830
829
    sprintf(tmp, "Filter: %-32sMission phase: %-24s\n", filtname, mphase);
831
    snprintf(tmp, sizeof (tmp), "Filter: %-32sMission phase: %-24s\n", filtname, mphase);
830
    strcat(pinfo->comment, tmp);
832
    strcat(pinfo->comment, tmp);
831
833
832
    sprintf(tmp, "Image time: %-28sGain mode: %-29s\n", itime, gainmode);
834
    snprintf(tmp, sizeof (tmp), "Image time: %-28sGain mode: %-29s\n", itime, gainmode);
833
    strcat(pinfo->comment, tmp);
835
    strcat(pinfo->comment, tmp);
834
836
835
    sprintf(tmp, "Edit mode: %-29sScan mode: %-29s\n", editmode, scanmode);
837
    snprintf(tmp, sizeof (tmp), "Edit mode: %-29sScan mode: %-29s\n", editmode, scanmode);
836
    strcat(pinfo->comment, tmp);
838
    strcat(pinfo->comment, tmp);
837
839
838
    sprintf(tmp, "Exposure: %-30sShutter mode: %-25s\n", exposure,shuttermode);
840
    snprintf(tmp, sizeof (tmp), "Exposure: %-30sShutter mode: %-25s\n", exposure,shuttermode);
839
    strcat(pinfo->comment, tmp);
841
    strcat(pinfo->comment, tmp);
840
842
841
    sprintf(tmp, "Instrument: %-28sImage time: %-28s\n", iname, itime);
843
    snprintf(tmp, sizeof (tmp), "Instrument: %-28sImage time: %-28s\n", iname, itime);
842
    strcat(pinfo->comment, tmp);
844
    strcat(pinfo->comment, tmp);
843
845
844
    sprintf(tmp, "Image Note: %-28s", inote);
846
    snprintf(tmp, sizeof (tmp), "Image Note: %-28s", inote);
845
    strcat(pinfo->comment, tmp);
847
    strcat(pinfo->comment, tmp);
846
  }
848
  }
847
849
(-)xv-3.10a.orig/xvps.c (-3 / +15 lines)
Lines 1629-1642 Link Here
1629
1629
1630
1630
1631
  do {
1631
  do {
1632
    buildCmdStr(cmdstr, gscmd, fname, quick, epsf);
1632
	char *x, *y, *name;
1633
1633
1634
	x = name = (char *) malloc((5 * strlen(fname))+3);*x++ = 0x27;
1635
	for (y = fname; *y; ++y) {
1636
		if (0x27 == *y) {
1637
			strcpy(x, "'\"'\"'");
1638
			x += strlen(x);
1639
		} else *x++ = *y;
1640
	}
1641
	strcpy (x, "'");
1642
1643
    buildCmdStr(cmdstr, gscmd, name, quick, epsf);
1644
	free (name);
1634
    if (DEBUG) fprintf(stderr,"LoadPS:  executing command '%s'\n", cmdstr);
1645
    if (DEBUG) fprintf(stderr,"LoadPS:  executing command '%s'\n", cmdstr);
1635
    SetISTR(ISTR_INFO, "Running '%s'...", GS_PATH);
1646
    SetISTR(ISTR_INFO, "Running '%s'...", GS_PATH);
1636
    sprintf(tmp, "Running %s", cmdstr);
1647
    sprintf(tmp, "Running %s", cmdstr);
1637
    if (doalert && epsf==0) OpenAlert(tmp);  /* open alert first time only */
1648
    if (doalert && epsf==0) OpenAlert(tmp);  /* open alert first time only */
1638
1649
1639
    WaitCursor();
1650
    WaitCursor();
1651
1640
    gsresult = system(cmdstr);
1652
    gsresult = system(cmdstr);
1641
    WaitCursor();
1653
    WaitCursor();
1642
#ifdef VMS
1654
#ifdef VMS
Lines 1741-1750 Link Here
1741
1753
1742
#ifndef VMS
1754
#ifndef VMS
1743
1755
1744
  if      (epsf)  sprintf(str, "echo '\n showpage ' | cat '%s' - | %s -",
1756
  if      (epsf)  sprintf(str, "echo '\n showpage ' | cat %s - | %s -",
1745
			  fname, gscmd);
1757
			  fname, gscmd);
1746
1758
1747
  else if (quick) sprintf(str, "echo '%s' | cat - '%s' | %s -",
1759
  else if (quick) sprintf(str, "echo '%s' | cat - %s | %s -",
1748
			  "/showpage { showpage quit } bind def",
1760
			  "/showpage { showpage quit } bind def",
1749
			  fname,  gscmd);
1761
			  fname,  gscmd);
1750
1762
(-)xv-3.10a.orig/xvtiff.c (-2 / +2 lines)
Lines 512-518 Link Here
512
  vsprintf(cp, fmt, ap);
512
  vsprintf(cp, fmt, ap);
513
  strcat(cp, ".");
513
  strcat(cp, ".");
514
514
515
  SetISTR(ISTR_WARNING,buf);
515
  SetISTR(ISTR_WARNING,"%s",buf);
516
516
517
  error_occurred = 1;
517
  error_occurred = 1;
518
}
518
}
Lines 536-542 Link Here
536
  vsprintf(cp, fmt, ap);
536
  vsprintf(cp, fmt, ap);
537
  strcat(cp, ".");
537
  strcat(cp, ".");
538
538
539
  SetISTR(ISTR_WARNING,buf);
539
  SetISTR(ISTR_WARNING,"%s",buf);
540
}
540
}
541
541
542
542

Return to bug 88742