[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.12 and 1.13

version 1.12, 2001/05/03 12:57:22 version 1.13, 2001/05/23 22:20:35
Line 75 
Line 75 
         BUFFER *bp;          BUFFER *bp;
 {  {
   
         (VOID) fclose(ffp);          (void) fclose(ffp);
         return (FIOSUC);          return (FIOSUC);
 }  }
   
Line 245 
Line 245 
                 fn++;                  fn++;
                 cp = getenv("HOME");                  cp = getenv("HOME");
                 if (cp != NULL && *cp != '\0' && (*fn == '/' || *fn == '\0')) {                  if (cp != NULL && *cp != '\0' && (*fn == '/' || *fn == '\0')) {
                         (VOID) strcpy(fnb, cp);                          (void) strcpy(fnb, cp);
                         cp = fnb + strlen(fnb);                          cp = fnb + strlen(fnb);
                         if (*fn)                          if (*fn)
                                 fn++;                                  fn++;
Line 256 
Line 256 
                                 *cp++ = *fn++;                                  *cp++ = *fn++;
                         *cp = '\0';                          *cp = '\0';
                         if ((pwent = getpwnam(fnb)) != NULL) {                          if ((pwent = getpwnam(fnb)) != NULL) {
                                 (VOID) strcpy(fnb, pwent->pw_dir);                                  (void) strcpy(fnb, pwent->pw_dir);
                                 cp = fnb + strlen(fnb);                                  cp = fnb + strlen(fnb);
                                 break;                                  break;
                         } else {                          } else {
Line 300 
Line 300 
                                                 while (cp > fnb && *--cp != '/') {                                                  while (cp > fnb && *--cp != '/') {
                                                 }                                                  }
                                                 ++cp;                                                  ++cp;
                                                 (VOID) strncpy(cp, linkbuf, i);                                                  (void) strncpy(cp, linkbuf, i);
                                                 cp += i;                                                  cp += i;
                                         } else {                                          } else {
                                                 (VOID) strncpy(fnb, linkbuf, i);                                                  (void) strncpy(fnb, linkbuf, i);
                                                 cp = fnb + i;                                                  cp = fnb + i;
                                         }                                          }
                                         if (cp[-1] != '/')                                          if (cp[-1] != '/')
Line 425 
Line 425 
                 return NULL;                  return NULL;
         }          }
         if (dirname[strlen(dirname) - 1] != '/')          if (dirname[strlen(dirname) - 1] != '/')
                 (VOID) strcat(dirname, "/");                  (void) strcat(dirname, "/");
         if ((bp = findbuffer(dirname)) == NULL) {          if ((bp = findbuffer(dirname)) == NULL) {
                 ewprintf("Could not create buffer");                  ewprintf("Could not create buffer");
                 return NULL;                  return NULL;
         }          }
         if (bclear(bp) != TRUE)          if (bclear(bp) != TRUE)
                 return FALSE;                  return FALSE;
         (VOID) strcpy(line, "ls -al ");          (void) strcpy(line, "ls -al ");
         (VOID) strcpy(&line[7], dirname);          (void) strcpy(&line[7], dirname);
         if ((dirpipe = popen(line, "r")) == NULL) {          if ((dirpipe = popen(line, "r")) == NULL) {
                 ewprintf("Problem opening pipe to ls");                  ewprintf("Problem opening pipe to ls");
                 return NULL;                  return NULL;
Line 441 
Line 441 
         line[0] = line[1] = ' ';          line[0] = line[1] = ' ';
         while (fgets(&line[2], 254, dirpipe) != NULL) {          while (fgets(&line[2], 254, dirpipe) != NULL) {
                 line[strlen(line) - 1] = '\0';  /* remove ^J     */                  line[strlen(line) - 1] = '\0';  /* remove ^J     */
                 (VOID) addline(bp, line);                  (void) addline(bp, line);
         }          }
         if (pclose(dirpipe) == -1) {          if (pclose(dirpipe) == -1) {
                 ewprintf("Problem closing pipe to ls");                  ewprintf("Problem closing pipe to ls");
                 return NULL;                  return NULL;
         }          }
         bp->b_dotp = lforw(bp->b_linep);        /* go to first line */          bp->b_dotp = lforw(bp->b_linep);        /* go to first line */
         (VOID) strncpy(bp->b_fname, dirname, NFILEN);          (void) strncpy(bp->b_fname, dirname, NFILEN);
         if ((bp->b_modes[0] = name_mode("dired")) == NULL) {          if ((bp->b_modes[0] = name_mode("dired")) == NULL) {
                 bp->b_modes[0] = &map_table[0];                  bp->b_modes[0] = &map_table[0];
                 ewprintf("Could not find mode dired");                  ewprintf("Could not find mode dired");
Line 467 
Line 467 
   
         if (llength(lp) <= 56)          if (llength(lp) <= 56)
                 return ABORT;                  return ABORT;
         (VOID) strcpy(fn, curbp->b_fname);          (void) strcpy(fn, curbp->b_fname);
         cp = fn + strlen(fn);          cp = fn + strlen(fn);
         bcopy(&lp->l_text[56], cp, llength(lp) - 56);          bcopy(&lp->l_text[56], cp, llength(lp) - 56);
         cp[llength(lp) - 56] = '\0';          cp[llength(lp) - 56] = '\0';

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13