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

Diff for /src/usr.bin/rcs/rcs.c between version 1.75 and 1.76

version 1.75, 2011/04/20 19:34:16 version 1.76, 2011/05/20 19:21:10
Line 50 
Line 50 
 /* invalid characters in RCS symbol names */  /* invalid characters in RCS symbol names */
 static const char rcs_sym_invch[] = RCS_SYM_INVALCHAR;  static const char rcs_sym_invch[] = RCS_SYM_INVALCHAR;
   
 /* comment leaders, depending on the file's suffix */  
 static const struct rcs_comment {  
         const char      *rc_suffix;  
         const char      *rc_cstr;  
 } rcs_comments[] = {  
         { "1",    ".\\\" " },  
         { "2",    ".\\\" " },  
         { "3",    ".\\\" " },  
         { "4",    ".\\\" " },  
         { "5",    ".\\\" " },  
         { "6",    ".\\\" " },  
         { "7",    ".\\\" " },  
         { "8",    ".\\\" " },  
         { "9",    ".\\\" " },  
         { "a",    "-- "    },   /* Ada           */  
         { "ada",  "-- "    },  
         { "adb",  "-- "    },  
         { "asm",  ";; "    },   /* assembler (MS-DOS) */  
         { "ads",  "-- "    },   /* Ada */  
         { "bat",  ":: "    },   /* batch (MS-DOS) */  
         { "body", "-- "    },   /* Ada */  
         { "c",    " * "    },   /* C */  
         { "c++",  "// "    },   /* C++ */  
         { "cc",   "// "    },  
         { "cpp",  "// "    },  
         { "cxx",  "// "    },  
         { "m",    "// "    },   /* Objective-C */  
         { "cl",   ";;; "   },   /* Common Lisp   */  
         { "cmd",  ":: "    },   /* command (OS/2) */  
         { "cmf",  "c "     },   /* CM Fortran    */  
         { "csh",  "# "     },   /* shell         */  
         { "e",    "# "     },   /* efl           */  
         { "epsf", "% "     },   /* encapsulated postscript */  
         { "epsi", "% "     },   /* encapsulated postscript */  
         { "el",   "; "     },   /* Emacs Lisp    */  
         { "f",    "c "     },   /* Fortran       */  
         { "for",  "c "     },  
         { "h",    " * "    },   /* C-header      */  
         { "hh",   "// "    },   /* C++ header    */  
         { "hpp",  "// "    },  
         { "hxx",  "// "    },  
         { "in",   "# "     },   /* for Makefile.in */  
         { "l",    " * "    },   /* lex */  
         { "mac",  ";; "    },   /* macro (DEC-10, MS-DOS, PDP-11, VMS, etc) */  
         { "mak",  "# "     },   /* makefile, e.g. Visual C++ */  
         { "me",   ".\\\" " },   /* me-macros    t/nroff  */  
         { "ml",   "; "     },   /* mocklisp      */  
         { "mm",   ".\\\" " },   /* mm-macros    t/nroff  */  
         { "ms",   ".\\\" " },   /* ms-macros    t/nroff  */  
         { "man",  ".\\\" " },   /* man-macros   t/nroff  */  
         { "p",    " * "    },   /* pascal        */  
         { "pas",  " * "    },  
         { "pl",   "# "     },   /* Perl (conflict with Prolog) */  
         { "pm",   "# "     },   /* Perl module */  
         { "ps",   "% "     },   /* postscript */  
         { "psw",  "% "     },   /* postscript wrap */  
         { "pswm", "% "     },   /* postscript wrap */  
         { "r",    "# "     },   /* ratfor        */  
         { "rc",   " * "    },   /* Microsoft Windows resource file */  
         { "red",  "% "     },   /* psl/rlisp     */  
         { "sh",   "# "     },   /* shell         */  
         { "sl",   "% "     },   /* psl           */  
         { "spec", "-- "    },   /* Ada           */  
         { "tex",  "% "     },   /* tex           */  
         { "y",    " * "    },   /* yacc          */  
         { "ye",   " * "    },   /* yacc-efl      */  
         { "yr",   " * "    },   /* yacc-ratfor   */  
 };  
   
 struct rcs_kw rcs_expkw[] =  {  struct rcs_kw rcs_expkw[] =  {
         { "Author",     RCS_KW_AUTHOR   },          { "Author",     RCS_KW_AUTHOR   },
         { "Date",       RCS_KW_DATE     },          { "Date",       RCS_KW_DATE     },
Line 133 
Line 64 
         { "State",      RCS_KW_STATE    },          { "State",      RCS_KW_STATE    },
 };  };
   
 #define NB_COMTYPES     (sizeof(rcs_comments)/sizeof(rcs_comments[0]))  
   
 static const char *rcs_errstrs[] = {  
         "No error",  
         "No such entry",  
         "Duplicate entry found",  
         "Bad RCS number",  
         "Invalid RCS symbol",  
         "Parse error",  
 };  
   
 #define RCS_NERR   (sizeof(rcs_errstrs)/sizeof(rcs_errstrs[0]))  
   
 int rcs_errno = RCS_ERR_NOERR;  int rcs_errno = RCS_ERR_NOERR;
 char *timezone_flag = NULL;  char *timezone_flag = NULL;
   
Line 510 
Line 428 
 }  }
   
 /*  /*
  * rcs_head_get()  
  *  
  * Retrieve the revision number of the head revision for the RCS file <file>.  
  */  
 const RCSNUM *  
 rcs_head_get(RCSFILE *file)  
 {  
         return (file->rf_head);  
 }  
   
 /*  
  * rcs_head_set()   * rcs_head_set()
  *   *
  * Set the revision number of the head revision for the RCS file <file> to   * Set the revision number of the head revision for the RCS file <file> to
Line 555 
Line 462 
 }  }
   
 /*  /*
  * rcs_branch_set()  
  *  
  * Set the default branch for the RCS file <file> to <bnum>.  
  * Returns 0 on success, -1 on failure.  
  */  
 int  
 rcs_branch_set(RCSFILE *file, const RCSNUM *bnum)  
 {  
         if (file->rf_branch == NULL)  
                 file->rf_branch = rcsnum_alloc();  
   
         rcsnum_cpy(bnum, file->rf_branch, 0);  
         file->rf_flags &= ~RCS_SYNCED;  
         return (0);  
 }  
   
 /*  
  * rcs_access_add()   * rcs_access_add()
  *   *
  * Add the login name <login> to the access list for the RCS file <file>.   * Add the login name <login> to the access list for the RCS file <file>.
Line 864 
Line 754 
 }  }
   
 /*  /*
  * rcs_desc_get()  
  *  
  * Retrieve the description for the RCS file <file>.  
  */  
 const char *  
 rcs_desc_get(RCSFILE *file)  
 {  
         return (file->rf_desc);  
 }  
   
 /*  
  * rcs_desc_set()   * rcs_desc_set()
  *   *
  * Set the description for the RCS file <file>.   * Set the description for the RCS file <file>.
Line 892 
Line 771 
 }  }
   
 /*  /*
  * rcs_comment_lookup()  
  *  
  * Lookup the assumed comment leader based on a file's suffix.  
  * Returns a pointer to the string on success, or NULL on failure.  
  */  
 const char *  
 rcs_comment_lookup(const char *filename)  
 {  
         int i;  
         const char *sp;  
   
         if ((sp = strrchr(filename, '.')) == NULL) {  
                 rcs_errno = RCS_ERR_NOENT;  
                 return (NULL);  
         }  
         sp++;  
   
         for (i = 0; i < (int)NB_COMTYPES; i++)  
                 if (strcmp(rcs_comments[i].rc_suffix, sp) == 0)  
                         return (rcs_comments[i].rc_cstr);  
         return (NULL);  
 }  
   
 /*  
  * rcs_comment_get()  
  *  
  * Retrieve the comment leader for the RCS file <file>.  
  */  
 const char *  
 rcs_comment_get(RCSFILE *file)  
 {  
         return (file->rf_comment);  
 }  
   
 /*  
  * rcs_comment_set()   * rcs_comment_set()
  *   *
  * Set the comment leader for the RCS file <file>.   * Set the comment leader for the RCS file <file>.
Line 1564 
Line 1408 
 }  }
   
 /*  /*
  * rcs_errstr()  
  *  
  * Get the error string matching the RCS error code <code>.  
  */  
 const char *  
 rcs_errstr(int code)  
 {  
         const char *esp;  
   
         if (code < 0 || (code >= (int)RCS_NERR && code != RCS_ERR_ERRNO))  
                 esp = NULL;  
         else if (code == RCS_ERR_ERRNO)  
                 esp = strerror(errno);  
         else  
                 esp = rcs_errstrs[code];  
         return (esp);  
 }  
   
 /*  
  * rcs_freedelta()   * rcs_freedelta()
  *   *
  * Free the contents of a delta structure.   * Free the contents of a delta structure.
Line 2001 
Line 1826 
                 }                  }
   
         return (ret);          return (ret);
 }  
   
 /*  
  * rcs_state_get()  
  *  
  * Get the state for a given revision of a specified RCSFILE.  
  *  
  * Returns NULL on failure.  
  */  
 const char *  
 rcs_state_get(RCSFILE *rfp, RCSNUM *rev)  
 {  
         struct rcs_delta *rdp;  
   
         if ((rdp = rcs_findrev(rfp, rev)) == NULL)  
                 return (NULL);  
   
         return (rdp->rd_state);  
 }  }
   
 /*  /*

Legend:
Removed from v.1.75  
changed lines
  Added in v.1.76