1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
/*
* sact.cc: Part of GNU CSSC.
*
*
* Copyright (C) 1997,1998,1999,2007 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* CSSC was originally Based on MySC, by Ross Ridge, which was
* placed in the Public Domain.
*
*
* Prints the current edit locks for an SCCS file.
*
*/
#include "cssc.h"
#include "fileiter.h"
#include "pfile.h"
#include "version.h"
#include "my-getopt.h"
#include "except.h"
const char main_rcs_id[] = "CSSC $Id: sact.cc,v 1.18 2007/12/17 21:59:50 jay Exp $";
void
usage() {
fprintf(stderr,
"usage: %s [-V] file ...\n",
prg_name);
}
int
main(int argc, char **argv)
{
Cleaner arbitrary_name;
if (argc > 0)
set_prg_name(argv[0]);
else
set_prg_name("sact");
class CSSC_Options opts(argc, argv, "V");
int c;
for (c = opts.next(); c != CSSC_Options::END_OF_ARGUMENTS; c = opts.next())
{
switch (c)
{
case 'V':
version();
break;
}
}
int retval = 0;
sccs_file_iterator iter(opts);
if (! iter.using_source())
{
errormsg("No SCCS file specified.");
return 1;
}
while (iter.next())
{
#ifdef HAVE_EXCEPTIONS
try
{
#endif
sccs_name &name = iter.get_name();
sccs_pfile pfile(name, sccs_pfile::READ);
pfile.rewind();
bool first = true;
while (pfile.next())
{
if (first) // first lock on this file...
{
/*
* Before we print out the information about the
* first lock on a given file. we may have to
* identify which file we are talking about. We
* don't do this if only one file was specified on
* the command line.
*/
if (!iter.unique())
{
printf("\n%s:\n", name.c_str());
}
first = false;
}
pfile->got.print(stdout);
putchar(' ');
pfile->delta.print(stdout);
putchar(' ');
fputs(pfile->user.c_str(), stdout);
putchar(' ');
pfile->date.print(stdout);
putchar('\n');
}
#ifdef HAVE_EXCEPTIONS
}
catch (CsscExitvalException e)
{
if (e.exitval > retval)
retval = e.exitval;
}
#endif
}
return retval;
}
// Explicit template instantiations.
template class range_list<sid>;
template class mylist<sccs_pfile::edit_lock>;
template class mylist<mystring>;
/* Local variables: */
/* mode: c++ */
/* End: */
|