[BACK]Return to fileio.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/fileio.c between version 1.15 and 1.16

version 1.15, 2001/05/24 00:59:38 version 1.16, 2001/05/24 03:05:22
Line 5 
Line 5 
  */   */
 #include        "def.h"  #include        "def.h"
   
 static FILE    *ffp;  static FILE     *ffp;
   
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/stat.h>  #include <sys/stat.h>
Line 19 
Line 19 
  */   */
 int  int
 ffropen(fn, bp)  ffropen(fn, bp)
         char           *fn;          char    *fn;
         BUFFER         *bp;          BUFFER  *bp;
 {  {
         struct stat     statbuf;          struct stat     statbuf;
   
         if ((ffp = fopen(fn, "r")) == NULL)          if ((ffp = fopen(fn, "r")) == NULL)
                 return (FIOFNF);                  return (FIOFNF);
Line 125 
Line 125 
  */   */
 int  int
 ffgetline(buf, nbuf, nbytes)  ffgetline(buf, nbuf, nbytes)
         char  *buf;          char    *buf;
         int    nbuf;          int     nbuf;
         int   *nbytes;          int     *nbytes;
 {  {
         int    c;          int     c, i;
         int    i;  
   
         i = 0;          i = 0;
         while ((c = getc(ffp)) != EOF && c != '\n') {          while ((c = getc(ffp)) != EOF && c != '\n') {
Line 159 
Line 158 
 fbackupfile(fn)  fbackupfile(fn)
         char  *fn;          char  *fn;
 {  {
         struct stat sb;          struct stat     sb;
         int    from, to, serrno;          int             from, to, serrno;
         size_t nread;          size_t          nread;
         size_t len;          size_t          len;
         char   buf[BUFSIZ];          char            buf[BUFSIZ];
         char  *nname;          char            *nname;
   
         len = strlen(fn);          len = strlen(fn);
         if ((nname = malloc(len + 1 + 1)) == NULL) {          if ((nname = malloc(len + 1 + 1)) == NULL) {
Line 220 
Line 219 
 #endif  #endif
 #include <pwd.h>  #include <pwd.h>
 #ifndef NO_DIR  #ifndef NO_DIR
 extern char    *wdir;  extern char     *wdir;
 #endif  #endif
   
 char *  char *
 adjustname(fn)  adjustname(fn)
         char           *fn;          char    *fn;
 {  {
         char           *cp;          char            *cp;
         static char     fnb[NFILEN];          static char     fnb[NFILEN];
         struct passwd  *pwent;          struct passwd   *pwent;
 #ifdef  SYMBLINK  #ifdef  SYMBLINK
         struct stat     statbuf;          struct stat     statbuf;
         int             i, j;          int             i, j;
         char            linkbuf[NFILEN];          char            linkbuf[NFILEN];
 #endif  #endif
   
         switch (*fn) {          switch (*fn) {
Line 348 
Line 347 
  */   */
 char *  char *
 startupfile(suffix)  startupfile(suffix)
         char           *suffix;          char    *suffix;
 {  {
         static char     file[NFILEN];          static char     file[NFILEN];
         char           *home;          char            *home;
   
         if ((home = getenv("HOME")) == NULL || *home == '\0')          if ((home = getenv("HOME")) == NULL || *home == '\0')
                 goto nohome;                  goto nohome;
Line 393 
Line 392 
   
 int  int
 copy(frname, toname)  copy(frname, toname)
         char   *frname;          char    *frname;
         char   *toname;          char    *toname;
 {  {
         pid_t   pid;          pid_t   pid;
         int     status;          int     status;
   
         if ((pid = vfork())) {          if ((pid = vfork())) {
                 if (pid == -1)                  if (pid == -1)
Line 411 
Line 410 
   
 BUFFER *  BUFFER *
 dired_(dirname)  dired_(dirname)
         char   *dirname;          char    *dirname;
 {  {
         BUFFER *bp;          BUFFER  *bp;
         FILE   *dirpipe;          FILE    *dirpipe;
         char    line[256];          char    line[256];
         int     len;          int     len;
   
         if ((dirname = adjustname(dirname)) == NULL) {          if ((dirname = adjustname(dirname)) == NULL) {
Line 480 
Line 479 
 #endif                          /* NO_DIRED */  #endif                          /* NO_DIRED */
   
 struct filelist {  struct filelist {
         LIST            fl_l;          LIST    fl_l;
         char            fl_name[NFILEN + 2];          char    fl_name[NFILEN + 2];
 };  };
   
 /*  /*
Line 490 
Line 489 
   
 LIST *  LIST *
 make_file_list(buf)  make_file_list(buf)
         char           *buf;          char    *buf;
 {  {
         char           *dir, *file, *cp;          char            *dir, *file, *cp;
         int             len, preflen;          int             len, preflen;
         DIR            *dirp;          DIR             *dirp;
         struct dirent  *dent;          struct dirent   *dent;
         LIST           *last;          LIST            *last;
         struct filelist *current;          struct filelist *current;
         char            prefixx[NFILEN + 1];          char            prefixx[NFILEN + 1];
         struct stat     statbuf;          struct stat     statbuf;
         char            statname[NFILEN + 2];          char            statname[NFILEN + 2];
   
         /*          /*
          * We need three different strings: dir - the name of the directory           * We need three different strings: dir - the name of the directory

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16