[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] Changing cmd-grab.c:find_latest_revision into ????:
From: |
Tom Lord |
Subject: |
Re: [Gnu-arch-users] Changing cmd-grab.c:find_latest_revision into ????:arch_find_latest_revision |
Date: |
Fri, 19 Dec 2003 10:49:22 -0800 (PST) |
> From: James Blackwell <address@hidden>
> In cmd-grab.c I have a nifty little find_latest_revision function that I
> could really use for a snap-config command that I'm writing. As such, I'd
> like to move it out of cmd-grab.c into another source file so that I can
> include it.
> The function in question is:
> t_uchar * find_latest_revision (t_uchar *archive_name, t_uchar *revision);
> Given a archive name and anything from "this--that" to
> "this--that--1.0--patch-54", find_latest_revision reports back a full
> revision.
> archives.c doesn't seem quite right as that file is mostly concerned with
> general archive activities (where is an archive, what is an archive's
> location, etc). However, there (at least not yet) is not a revisions.c
> that would seem more appropriate.
> Would anyone care to comment?
Aside from the argument validation that it does, it's very similar to
arch_archive_latest_revision which is already in archive.c (you might
want to modify your function to use arch_archive_latest_revision).
It wouldn't be a bad thing to have a file of command-line "helper"
functions which, in general:
1) check their arguments for validity, giving a careful error
message for bad arguments (e.g., don't just panic)
2) do their real work by calling some some function defined
elsewhere.
so if you want to, start cmdutils.[ch] (no dash so that cmd-*.c
remains the pattern for files that implement specific commands).
-t