e70152e44cc66cc599ff6b699eb8adc07f3e656a kent Sat May 24 21:09:34 2014 -0700 Adding Copyright NNNN Regents of the University of California to all files I believe with reasonable certainty were developed under UCSC employ or as part of Genome Browser copyright assignment. diff --git src/utils/lineRange/lineRange.c src/utils/lineRange/lineRange.c index 27c335e..6bca2c6 100644 --- src/utils/lineRange/lineRange.c +++ src/utils/lineRange/lineRange.c @@ -1,59 +1,62 @@ /* lineRange - Get a range of lines from file. */ + +/* Copyright (C) 2011 The Regents of the University of California + * See README in this or parent directory for licensing information. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "options.h" void usage() /* Explain usage and exit. */ { errAbort( "lineRange - Get a range of lines from file\n" "usage:\n" " lineRange fileName start count\n" "Print <count> lines from fileName starting at 1-based <start>." "options:\n" " -xxx=XXX\n" ); } static struct optionSpec options[] = { {NULL, 0}, }; void lineRange(char *fileName, int start, int count) /* lineRange - Get a range of lines from file. */ { struct lineFile *lf = lineFileOpen(fileName, FALSE); char *line; int lineSize; int i; if (count == 0 || start == 0) errAbort("Expecting positive number for start, count in command line"); /* Skip over first lines. */ for (i=1; i<start; ++i) { if (!lineFileNext(lf, &line, &lineSize)) errAbort("%s doesn't have %d lines", fileName, start); } /* Print coutn lines. */ for (i=0; i<count; ++i) { if (!lineFileNext(lf, &line, &lineSize)) break; mustWrite(stdout, line, lineSize); } lineFileClose(&lf); } int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, options); if (argc != 4) usage(); lineRange(argv[1], atoi(argv[2]), atoi(argv[3])); return 0; }