[531] in SIPB bug reports

home help back first fref pref prev next nref lref last post

Re: One more thing...

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Sun May 14 02:55:00 1989

To: srz@athena.mit.edu, jik@athena.mit.edu
Cc: bug-sipb@athena.mit.edu, ls@athena.mit.edu
Date: Sun, 14 May 89 02:54:38 EDT
From: Tom Coppeto <tjcoppet@mit.edu>


You're right, Stan. I wouldn't want to void the copyright but there's just
one small problem: I can't read the vanilla sources like I used to be
able to. So what I've done was include the additions and tell you what
line number they begin on... 

float.c 43:
#ifndef LS
extern char *time_string(), *elapsed_string(), *timeleft_string();
#else   LS
extern char *time_string(), *ls_string(), *lsleft_string();
#endif  LS


float.c 242:
#ifndef LS
	  new_elapsed = Redo(elapsed_string(ELAPSED_FORMAT, NoForce),
#else  LS
	  new_elapsed = Redo(ls_string(LS_FORMAT, NoForce),
#endif LS

float.c 249:
#ifndef LS
	  new_timeout = Redo(timeleft_string(TIMELEFT_FORMAT, NoForce),
#else  LS
	  new_timeout = Redo(lsleft_string(LSLEFT_FORMAT, NoForce),
#endif LS

float.c 363:
#ifndef LS
	       lines[i].str = elapsed_string(ELAPSED_FORMAT, Force);
#else   LS
	       lines[i].str = ls_string(LS_FORMAT,Force);
#endif  LS

float.c 375
#ifndef LS
	       lines[i].str = timeleft_string(TIMELEFT_FORMAT, Force);
#else   LS
	       lines[i].str = lsleft_string(LSLEFT_FORMAT, Force);
#endif  LS


menuIcon.c 40:
#ifdef LS
void share_directory(),change_directory();
#endif LS


menuIcon.c 54:
#ifdef LS
     "Change Directory",
#endif LS

menuIcon.c 60:
#ifdef LS
     "Share Directory With Friends",
#endif LS

menuIcon.c 73:
#ifdef LS
     "Change Directory",
#endif LS

menuIcon.c 79:
#ifdef LS
     "Share Directory With Friends",
#endif LS

menuIcon.c 236:

#ifndef LS
#define AUTOLOCK 	0
#define BLANK 		1
#define	LOCK		2
#define CHANGE_TIMEOUT  3
#define CHANGE_LOCK	4
#define CHANGE_UNLOCK	5
#define CHANGE_MESSAGE  6
#define EXIT		7
#else  LS


menuIcon.c 305:
#ifdef LS
	case CHANGE_DIRECTORY:
	  getstring(top_widget, "newDirectory",
		    "Enter new directory (return for none):",
		    -1, change_directory, GS_PREVPOS);
	  break;
	case SHARE_DIRECTORY:
	  share_directory();
	  break;
#endif LS


password.c 33:
#ifdef LS
#include <sys/types.h>
#include <sys/stat.h>
#endif LS

passsword.c 44:
#ifndef LS
extern char *time_string(), *timeleft_string();
#else   LS
extern char *ls_string(), *lsleft_string();
#endif  LS

password.c 62:
#ifdef LS
     char lines[100][100];
     int n,j;
#endif LS

password.c 72:
#ifndef LS
     prompt_lines[i].str = time_string(TIME_FORMAT, Force); i++;
#endif  LS

password.c 83:
#ifdef LS
	       prompt_lines[i].str = lsleft_string(LSLEFT_FORMAT, Force);
#else  LS
	       prompt_lines[i].str = timeleft_string(TIMELEFT_FORMAT, Force);
#endif LS


password.c 92:
#ifdef LS
     stat_format(lines,&n);
     for(j=0;j<n;j++)
       {
	 prompt_lines[i] = default_line;
	 prompt_lines[i].center = False;
	 prompt_lines[i++].str = lines[j];
       }
#endif LS


scaling.c 75:
return(1000);

util.c 30:
#ifdef LS
#include <sys/types.h>
#include <sys/dir.h>
#include <sys/stat.h>
#endif LS


util.c 40:
#ifdef LS
static struct direct *file = (struct direct *) NULL;
static DIR *directory = (DIR *) NULL;
static int n_files = 0;
static int file_interval = 0;
static int file_freak = 0;
#endif LS

util.c 49:
#ifdef LS
change_directory(new_val)
char *new_val;
{
     char *buf;
 
     if (! new_val)
          return;
     if(directory != (DIR *) NULL)
        closedir(directory);
     buf = (char *) my_malloc(strlen(new_val) + 1, "directory");
     strcpy(buf, new_val);
     directory = opendir(buf);
     if(directory == (DIR *) NULL)
     directory = opendir(buf);
     if(directory == (DIR *) NULL)
       free(buf);
     else
       {
	 free(defs.directory);
	 defs.directory = buf;
       }
}

share_directory()
{
  char buf[100];

  sprintf(buf,"/bin/ls -C %s | /usr/athena/zwrite -i ls >
/dev/null",defs.directory);
  system(buf);
}

#endif LS


util.c 176:
#ifndef LS


util.c 191:
char *ls_string(str, force)
ForceType force;
char *str;
{
     static char buf[100];
     char new[100];
     int newf = 0;
     struct stat statbuf;
     char path[256];

     if(force == List)
       {
	 sprintf(new,"%s/%s",defs.directory, file->d_name);
	 printf("here %s\n",new);
	 return(new);
       }
     if(directory == (DIR *) NULL)
       {
	 directory = opendir(defs.directory);
	 if(directory == (DIR *) NULL)
	   {
	     free(defs.directory);
	     defs.directory = getenv("HOME");
	     directory = opendir(defs.directory);
	   }
       }
     if (file == (struct direct *) NULL)
       {
	 rewinddir(directory);
	 file = readdir(directory);	
	 while(*(file->d_name) == '.')
	   {
	     file = readdir(directory);	 
	     if(file == (struct direct *) NULL)
	       {
		 fprintf(stderr,"ScreenSaver cannot be run without
files that do not begin with a '.'\n");
		 exit(1);
	       }
	   }
	 n_files++;
	 if((n_files > defs.dirmax) && defs.dirmax)
	   {
	      XtDestroyWidget(top_widget);
	   {
	      XtDestroyWidget(top_widget);
	      XtCloseDisplay(dpy);
	      exit(0);
	    }
	 if(file == (struct direct *) NULL)
	   {
	     perror("opendir");
	     exit(1);
	   }
       }
     else
       {
	 if(file_freak > defs.file_frequency)
	   {
	     file = readdir(directory);	
	     file_freak = 0;
	     while(*(file->d_name) == '.')
	       {
		 file = readdir(directory);	 
		 if(file == (struct direct *) NULL)
		   break;
		 if(file == (struct direct *) NULL)
		   break;
	       }
	   }
	 else
	   file_freak++;
       }

     sprintf(path,"%s/%s",defs.directory,file->d_name);
     if(lstat(path,&statbuf) < 0)
       sprintf(new,"%s not found\n",file->d_name);
     else
       {
	 switch (statbuf.st_mode & S_IFMT) 
	   {
	   case S_IFDIR:
	     sprintf(new,"Directory: %s",file->d_name); 
	     break;
	   case S_IFBLK:
	     sprintf(new,"Block Device: %s",file->d_name); 
	     break;
	   case S_IFCHR:
	     sprintf(new,"Character Device: %s",file->d_name); 
	     break;
	   case S_IFSOCK:
	     sprintf(new,"Socket: %s",file->d_name); 
	     break;
	   case S_IFLNK:
	     sprintf(new,"Symbolic Link: %s",file->d_name); 
	     break;
	   default:
	     sprintf(new,"Regular File: %s",file->d_name); 
	     break;
	   }
       }
     
     if (strcmp(new, buf)) {
	  strcpy(buf, new);
	  newf++;
     }
     if (newf || (force == Force))
	  return(buf);
     else
	  return((char *) NULL);
}


stat_format(lines,n)
     char lines[100][100];
     int *n;
{
  char path[256];
  struct stat statbuf;
  char new[25];

  sprintf(path,"%s/%s",defs.directory,file->d_name);
  if(lstat(path,&statbuf) < 0)
    {
      sprintf(lines[0],"%s not found",path);
      *n = 1;
      return;
    }

  switch (statbuf.st_mode & S_IFMT) 
    {
    case S_IFDIR:
      sprintf(new,"Directory");
      break;
    case S_IFBLK:
      sprintf(new,"Block Device");
      break;
    case S_IFCHR:
      sprintf(new,"Character Device");
      break;
    case S_IFSOCK:
      sprintf(new,"Socket");
      break;
    case S_IFLNK:
      sprintf(new,"Symbolic Link");
      break;
    default:
      sprintf(new,"Regular File");
      break;
    }
  sprintf(lines[0],"File: \"%s\"",file->d_name);
  sprintf(lines[1],"Size: %-10d Allocated Blocks: %-10d Filetype: %s",
	  statbuf.st_size,statbuf.st_blocks,new);
  sprintf(lines[2],"Mode: (%d)       Uid: (%d)       Gid: (%d)",
	  statbuf.st_mode,statbuf.st_uid, statbuf.st_gid);
  sprintf(lines[3],"Device: %d,%d   Inode: %-10d Links: %d",
	  statbuf.st_rdev,statbuf.st_dev,statbuf.st_ino,statbuf.st_nlink);
  sprintf(lines[4],"Access: %s",ctime(&(statbuf.st_atime)));
  sprintf(lines[5],"Modify: %s",ctime(&(statbuf.st_mtime)));
  sprintf(lines[6],"Change: %s",ctime(&(statbuf.st_ctime)));
  *n = 7;
}
#endif LS


util.c 377:
#ifndef LS

char *timeleft_string(str, force)
ForceType force;
char *str;
{
     static char buf[100];
     int hours, minutes;
     int elapsed_sec = times.current - times.start;
     char new[100];
     int newf = 0;

     /* Note that the + 59 in both equations is so that the counter will
      * always display the minute it is counting down, instead of the
      * minute before it.  I use + 59 rather than + 60 because
      * otherwise, when the widget is first mapped it will display one
      * number above the timeout value.  This is the same reason we
      * add 1 to the value of the current time when we activate the clock.
      */
     hours = (defs.timeout * 60 - elapsed_sec + 59) / 3600;
     minutes = (defs.timeout * 60 - elapsed_sec + 59 - 3600 * hours) / 60;
     sprintf(new, str, hours, (hours == 1 ? "hour" : "hours"),
	     minutes, (minutes == 1 ? "minute" : "minutes"));
     if (strcmp(new, buf)) {
	  strcpy(buf, new);
	  newf++;
     }

     if (newf || (force == Force))
	  return(buf);
     else
	  return((char *) NULL);
}

#else LS

char *lsleft_string(str, force)
ForceType force;
char *str;
{
     static char buf[100];
     char new[100];     int newf = 0;

     sprintf(new, str, n_files);
     if (strcmp(new, buf)) {
	  strcpy(buf, new);
	  newf++;
     }

     if (newf || (force == Force))
	  return(buf);
     else
	  return((char *) NULL);
}


#endif LS


PromptBox.h 23:

#define MAXPROMPT		12 /* max number of lines in a */


float.h 49:
#define DEFAULT_MESSAGE_WIDTH 80


resources.h 56:

#ifdef LS
{"fileFrequency", "FileFrequency", XtRInt, sizeof(int), 
 XtOffset(Defaults *, file_frequency), XtRInt, 100},
{"directory", "Directory", XtRString, sizeof(String),
 XtOffset(Defaults *, directory), XtRString, "HOME"},
{"dirMax", "DirMax", XtRInt, sizeof(int),
 XtOffset(Defaults *, dirmax), XtRInt, 0}
#endif LS


xsaver.h 31:
#ifdef LS
     int file_frequency;
     String directory;
     int dirmax;
#endif LS


xsaver.h 41:
#ifndef LS
#define ELAPSED_FORMAT 		"Elapsed: %d:%02d"
#define TIMELEFT_FORMAT		"Time Left: %d %s, %d %s"
#else   LS
#define LS_FORMAT               "File: %s"
#define LSLEFT_FORMAT           "Directory Laps: %d"
#endif  LS

xsaver.h 56:
#ifdef LS
     List,
#endif LS


xsaver.h 69
#define TIMEOUT			"57600"
#define MAXTIMEOUT		2103840









home help back first fref pref prev next nref lref last post