bibcursed/0000755000076500007650000000000010677023635014131 5ustar dominicdominic00000000000000bibcursed/._.DS_Store0000644000076500000000000000012210677016007015457 0ustar dominicwheel00000000000000Mac OS X  2 R@bibcursed/.DS_Store0000644000076500007650000001400410677016007015606 0ustar dominicdominic00000000000000Bud1%  @€ @€ @€ @ E%DSDB`€ @€ @€ @bibcursed/bibcursed.10000644000076500007650000000210110677023635016147 0ustar dominicdominic00000000000000.\" .\" Man page for bibcursed .\" .\" Copyright (c) 1999 - 2007 Dominic Tristram .\" .\" You may distribute under the terms of the GNU General Public .\" License as specified in the README file that comes with the .\" distribution. .\" .\" Dominic Tristram .\" dominic@dominictristram.com .\" .TH BIBCURSED 1 "27th September, 2007" .LO 1 .SH NAME bibcursed \- manipulate BibTeX files .SH SYNOPSIS bibcursed bibtex_file .SH DESCRIPTION .B bibcursed Performs various actions on BibTeX files, from error checking to editing .SH OPTIONS .TP There are no options in this version. The name of the BibTeX file, given as the sole command line argument, is *required*. .SH ENVIRONMENT .TP No environment variables are used .SH DIAGNOSTICS All errors are sent to stdout .SH "SEE ALSO" latex(1). .SH COPYRIGHT bibcursed is Copyright (c)1999-2007 Dominic Tristram. It is subject to the GNU General Public Licence .SH BUGS See the bug tracking page at http://sourceforge.net/projects/bibcursed/ .SH AUTHORS Dominic Tristram - dominic@dominictristram.com - http://www.dominictristram.com/ bibcursed/bibcursed.c0000644000076500007650000013422510677023413016240 0ustar dominicdominic00000000000000/* Bibcursed - a curses-based BibTeX bibliography file editor Copyright (C) 1999 - 2002 Dominic Tristram 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Bibcursed Homepage - http://sourceforge.net/projects/bibcursed Dominic Tristram - dominic@dominictristram.com - http://www.dominictristram.com/ I apologise for the code - it's a bit crap and messy... */ #include #include #include #include #include int rec_count; char bibfile[100]; void add_bold(char letter); void general_help(); void setup_screen() { clear(); move(0,0); attron(A_BOLD); printw("%s", "bibcursed - Dominic Tristram, 1999 - 2007"); attroff(A_BOLD); printw("%s %d"," Entries in bibliography :", rec_count); } void menu() { int ch, lch; setup_screen(); move(4,5); add_bold('S'); printw("%s","earch and query"); move(5,5); add_bold('A'); printw("%s","dd a new entry"); move(6,5); add_bold('D'); printw("%s","elete an entry"); move(7,5); printw("%s","View or "); add_bold('C'); printw("%s","hange an existing entry"); move(11,5); add_bold('H'); printw("%s","elp"); move(12,5); add_bold('Q'); printw("%s","uit"); move(15,5); printw("What do you want to do? "); refresh(); cbreak(); ch = getch(); lch = tolower(ch); switch (lch) { case 's' : search_menu(); break; case 'a' : add_entry(); break; case 'd' : delete_entry(); break; case 'c' : change_entry(); break; case 'o' : config_options(); break; case 'h' : help(); break; case 'q' : quit_prog(); break; default : break; } } help() { char tmp_char, lch; setup_screen(); move(4,0); printw("%s\n","This is the main bibcursed screen. You can choose from four main"); printw("%s\n","options. Press 's' to search for key words in your BibTeX file."); printw("%s\n","You will be given a list of entry names containing the search"); printw("%s\n","term. You can then display these by using the 'C' option on"); printw("%s\n\n","this screen."); printw("%s\n","The Add option will ask you for details about your new"); printw("%s\n","reference, then add it to the database. The delete option will"); printw("%s\n","remove a reference with the ID you supply from the database."); move(14,5); printw("%s","Press a key to continue, or H for more help"); refresh(); cbreak(); tmp_char = getch(); lch = tolower(tmp_char); if (lch == 'h') general_help(); } void general_help() { char tmp_char; setup_screen(); move(4,5); printw("%s","Please refer to the man page and documentation provided"); move(5,5); printw("%s","with this distribution. Check the bibcursed website at:"); move(7,8); printw("%s","http://sourceforge.net/projects/bibcursed"); move(9,5); printw("%s","before sending any queries to me at:"); move(11,8); printw("%s","dominic@dominictristram.com"); move(17,5); printw("%s","Press any key to continue"); refresh(); cbreak(); tmp_char = getch(); } config_options() { /* For future use */ } add_entry() { char ch, lch, entry_type, length; int use_author = 0, use_title = 0, use_journal = 0, use_year = 0; int use_volume = 0, use_number = 0, use_series = 0, use_address = 0; int use_pages = 0, use_month = 0, use_note = 0, use_editor = 0; int use_publisher = 0, use_edition = 0, use_howpublished = 0, use_type =0; int use_booktitle = 0, use_chapter = 0, use_organisation = 0; int use_school = 0, use_institution = 0, use_annote = 0, use_key = 0; int set_address = 0, set_annote = 0, set_author = 0, set_booktitle = 0; int set_chapter = 0, set_crossref = 0, set_edition = 0, set_editor = 0; int set_howpublished = 0, set_institution = 0, set_journal = 0; int set_key = 0, set_month = 0, set_note = 0, set_number = 0; int set_organisation = 0, set_pages = 0, set_publisher = 0, set_school = 0; int set_series = 0, set_title = 0, set_type = 0, set_volume = 0; int set_year = 0, not_done=0; int print_pos = 6; int still_setting_up = 0, written_new=0; int entry_count = 0; char address[100], annote[100], author[100], booktitle[100], chapter[10], crossref[100], edition[100]; char editor[100], howpublished[100], institution[100], journal[200], key[50], month[15]; char note[400], number[10], organisation[100], pages[10], publisher[100], school[100], series[100]; char title[200], type[100], volume[10], year[5]; char entry_name[100], out_string[100], str[100], str2[100], *key_name; FILE *fin, *fout; setup_screen(); move(4,5); printw("%s","Please choose entry type"); move(6,8); printw("%s","1. Article - paper or article in journal"); move(7,8); printw("%s","2. Book - whole book"); move(8,8); printw("%s","3. Booklet - bound work with no publisher name"); move(9,8); printw("%s","4. Conference / in proceedings - paper or article from proceedings"); move(10,8); printw("%s","5. In book - extract from a book"); move(11,8); printw("%s","6. In collection - part of book with its own title"); move(12,8); printw("%s","7. Manual - technical documentation"); move(13,8); printw("%s","8. Masters thesis"); move(14,8); printw("%s","9. Miscellaneous - anything not covered by other options"); move(15,8); printw("%s","A. PhD thesis"); move(16,8); printw("%s","B. Proceedings - whole proceedings"); move(17,8); printw("%s","C. Technical report - report published by institution"); move(18,8); printw("%s","D. Unpublished - unpublished work with author and title"); move(20,8); printw("%s","Q. None of these! Go back!"); refresh(); cbreak(); ch = getch(); entry_type = tolower(ch); if (entry_type == 'q') return(0); /* Set which fields to prompt for */ switch(entry_type) { case '1' : use_author = 1; use_title = 1; use_journal = 1; use_year = 1; use_volume = 2; use_number = 2; use_pages = 2; use_month = 2; use_note = 2; break; case '2' : use_author = 1; use_editor = 2; use_title = 1; use_publisher = 1; use_year = 1; use_volume = 2; use_number = 2; use_series = 2; use_address = 2; use_edition = 2; use_month = 2; use_note = 2; break; case '3' : use_title = 1; use_author = 2; use_howpublished = 2; use_address = 2; use_month = 2; use_year = 2; use_note = 2; break; case '4' : use_author = 1; use_title = 1; use_booktitle = 1; use_year =1; use_editor = 2; use_volume = 2; use_number = 2; use_series =2; use_pages = 2; use_address = 2; use_month = 2; use_organisation = 2; use_publisher = 2; use_note = 2; break; case '5' : use_author = 1; use_editor = 1; use_title = 1; use_chapter =1; use_pages = 1; use_publisher = 1; use_year = 1; use_volume = 2; use_number = 2; use_series=2; use_type = 2; use_address = 2; use_edition = 2; use_month = 2; use_note = 2; break; case '6' : use_author = 1; use_title = 1; use_booktitle = 1; use_publisher = 1; use_year = 1; use_editor = 1; use_chapter = 1; use_pages = 2; use_address = 2; use_month = 2; use_note = 2; break; case '7' : use_title = 1; use_author =2; use_organisation=2; use_address=2; use_edition=2; use_month=2; use_year=2; use_note=2; break; case '8' : use_author=2; use_title=1; use_school=1; use_year=1; use_type=2; use_address=2; use_month=2; use_note=2; break; case '9' : use_author=2; use_title=2; use_howpublished=2; use_month=2; use_year=2; use_note=2; break; case 'a' : use_author=1; use_title=1; use_school=1; use_year=1; use_type=2; use_address=2; use_month=2; use_note=2; break; case 'b' : use_title=1; use_year=1; use_editor=2; use_volume=2; use_number=2; use_series=2; use_address=2; use_month=2; use_organisation=2; use_publisher=2; use_note=2; break; case 'c' : use_author=1; use_title=1; use_institution=1; use_year=1; use_type=2; use_number=2; use_address=2; use_month=2; use_note=2; break; case 'd' : use_author=1; use_title=1; use_note=1; use_month=2; use_year=2; break; default : return(0); break; } while (still_setting_up == 0) { print_pos = 7; setup_screen(); move(3,5); attron(A_BOLD); printw("%s","Bold"); attroff(A_BOLD); printw("%s"," fields are required and must be used - others are optional"); move(4,5); printw("%s","Fields marked with a * have been set. Press Z when done or"); move(5,5); printw("%s","Q to quit"); if (use_address != 0) { move(print_pos,5); if (use_address == 1) { attron(A_BOLD); printw("%s","1. Address "); attroff(A_BOLD); } else printw("%s","1. Address "); if (set_author == 1) addch('*'); print_pos++; } if (use_annote != 0) { move(print_pos,5); if (use_annote == 1) { attron(A_BOLD); printw("%s","2. Annote "); attroff(A_BOLD); } else printw("%s","2. Annote "); if (set_annote == 1) addch('*'); print_pos++; } if (use_author != 0) { move(print_pos,5); if (use_author == 1) { attron(A_BOLD); printw("%s","3. Author(s) "); attroff(A_BOLD); } else printw("%s","3. Author(s) "); if (set_author == 1) addch('*'); print_pos++; } if (use_booktitle != 0) { move(print_pos, 5); if (use_booktitle == 1) { attron(A_BOLD); printw("%s","4. Booktitle "); attroff(A_BOLD); } else printw("%s","4. Booktitle "); if (set_booktitle == 1) addch('*'); print_pos++; } if (use_chapter != 0) { move(print_pos,5); if (use_chapter == 1) { attron(A_BOLD); printw("%s","5. Chapter "); attroff(A_BOLD); } else printw("%s","5. Chapter "); if (set_chapter == 1) addch('*'); print_pos++; } move(print_pos,5); printw("%s","6. Cross-reference "); if (set_crossref == 1) addch('*'); print_pos++; if (use_edition != 0) { move(print_pos,5); if (use_edition != 1) { attron(A_BOLD); printw("%s","7. Edition "); attroff(A_BOLD); } else printw("%s","7. Edition "); if (set_edition == 1) addch('*'); print_pos++; } if (use_editor != 0) { move(print_pos,5); if (use_editor == 1) { attron(A_BOLD); printw("%s","8. Editor(s) "); attroff(A_BOLD); } else printw("%s","8. Editor(s) "); if (set_editor == 1) addch('*'); print_pos++; } if (use_howpublished != 0) { move(print_pos,5); if (use_howpublished == 1) { attron(A_BOLD); printw("%s","9. How published "); attroff(A_BOLD); } else printw("%s","9. How published "); if (set_howpublished == 1) addch('*'); print_pos++; } move(print_pos,5); print_pos+= field_menu(use_institution, set_institution, "A. Institution"); move(print_pos,5); print_pos+= field_menu(use_journal, set_journal, "B. Journal"); move(print_pos,5); print_pos+= field_menu(use_key, set_key, "C. Key"); move(print_pos,5); print_pos+= field_menu(use_month, set_month, "D. Month"); move(print_pos,5); print_pos+= field_menu(use_note, set_note, "E. Note"); move(print_pos,5); print_pos+= field_menu(use_number, set_number, "F. Number"); move(print_pos,5); print_pos+= field_menu(use_organisation, set_organisation, "G. Organisation"); move(print_pos,5); print_pos+= field_menu(use_pages, set_pages, "H. Pages"); move(print_pos, 5); print_pos+= field_menu(use_publisher, set_publisher, "I. Publisher"); move(print_pos, 5); print_pos+= field_menu(use_school, set_school, "J. Academic institution"); move(print_pos, 5); print_pos+= field_menu(use_series, set_series, "K. Series"); move(print_pos, 5); print_pos+= field_menu(use_title, set_title, "L. Title"); move(print_pos, 5); print_pos+= field_menu(use_type, set_type, "M. Type"); move(print_pos, 5); print_pos+= field_menu(use_volume, set_volume, "N. Volume"); move(print_pos, 5); print_pos+= field_menu(use_year, set_year, "O. Year"); refresh(); cbreak(); ch = getch(); lch = tolower(ch); if (lch == 'q') return(0); setup_screen(); move(4,5); nocbreak(); switch(lch) { case '1' : printw("%s","Please enter the address of the publisher or other institution"); move(5,5); printw("%s","For major publishing houses it is sufficient to give just the city"); move(7,5); refresh(); getstr(address); set_address = 1; break; case '2' : printw("%s","Please enter an annotation"); move(6,5); refresh(); getstr(annote); set_annote = 1; break; case '3' : printw("%s","Please enter the name(s) of the author(s)."); move(6,5); printw("%s","These may be in the form:"); move(7,8); printw("%s","John Joseph Bloggs"); move(8,5);printw("%s","or"); move(9,8); printw("%s","Bloggs, John Joseph"); move(11,5); printw("%s","Names should be separated by the word 'and', like so:"); move(12,8); printw("%s","John Joseph Bloggs and Richard Lee Head"); move(14,5); printw("%s","Double surnames without separating hyphens must be enclosed within braces"); move(16,5); printw("%s","Words added to surnames such as von or de may be entered in either form:"); move(17,8); printw("%s","Richard von Mannheim or von Mannheim, Richard"); move(19,5); refresh(); getstr(author); set_author=1; break; case '4' : printw("%s","Enter title of book which contains reference"); move(6,5); refresh(); getstr(booktitle); set_booktitle=1; break; case '5' : printw("%s","Please enter chapter or section number"); move(6,5); refresh(); getstr(chapter); set_chapter=1; break; case '6' : printw("%s","Please enter the entry to cross-reference to."); move(6,5); refresh(); getstr(crossref);set_crossref=1;break; case '7' : printw("%s","Please enter the edition."); move(5,5);printw("%s","This should be written in full and be capitalised. For example:"); move(6,8); printw("%s","Second"); move(8,5); refresh(); getstr(edition); set_edition=1; break; case '8' : printw("%s","Please enter the name(s) of the editor(s)."); move(5,5); printw("%s","These should be in the same format as the author name(s)"); move(7,5); refresh(); getstr(editor); set_editor = 1; break; case '9' : printw("%s","Please enter anything unusual about the method of publishing."); printw("%s","This should be capitalised. For example:"); move(5,8); printw("%s","Privately Published"); move(7,5); refresh(); getstr(howpublished); set_howpublished=1; break; case 'a' : printw("%s","Please enter the name of the institution"); move(6,5); refresh(); getstr(institution); set_institution=1; break; case 'b' : printw("%s","Please enter the name of the journal or magazine"); move(6,5); refresh(); getstr(journal); set_journal=1; break; case 'c' : printw("%s","Please enter a key."); printw("%s","This is for additional alphabetising when the author"); move(5,5); printw("%s","information is missing and is not the same as the entry key."); move(7,5); refresh(); getstr(key); set_key=1; break; case 'd' : printw("%s","Please enter the month in which the work was published"); move(6,5); printw("%s","If it is unpublished, enter the month it was written"); move(8,5); refresh(); getstr(month); set_month=1; break; case 'e' : printw("%s","Please enter any additional information"); move(5,5); printw("%s","The first letter should be uppercase"); move(7,5); refresh(); getstr(note); set_note = 1; break; case 'f' : printw("%s","Please enter the number of the journal, book, etc"); move(6,5); refresh(); getstr(number); set_number=1; break; case 'g' : printw("%s","Please enter the sponsoring organisation"); move(6,5); refresh(); getstr(organisation); set_organisation=1; break; case 'h' : printw("%s","Please enter a page number or range of pages"); move(5,5); printw("%s","This can take the following forms:"); move(6,8); printw("%s","33,44,56"); move(7,8); printw("%s","45--117"); move(8,8); printw("%s","87+"); move(10,5);refresh();getstr(pages);set_pages=1;break; case 'i' : printw("%s","Please enter the name of the publisher"); move(6,5);refresh();getstr(publisher);set_publisher=1; break; case 'j' : printw("%s","Please enter the name of the academic institution"); move(6,5);refresh();getstr(school);set_school=1;break; case 'k' : printw("%s","Please enter the name of the series or set of books"); move(5,5); printw("%s","When citing a book from a series, the title field gives the name"); move(6,5); printw("%s","of the book itself while series gives the title of the whole set"); move(8,5);refresh();getstr(series);set_series=1;break; case 'l' : printw("%s","Please enter the title of the work"); move(6,5); refresh(); getstr(title); set_title=1; break; case 'm' : printw("%s","Please enter the type, such as 'Research Note'"); move(6,5); refresh(); getstr(type);set_type=1;break; case 'n' : printw("%s","Please enter the volume number"); move(6,5); refresh(); getstr(volume); set_volume=1; break; case 'o' : printw("%s","Please enter the year of publication."); move(5,5); printw("%s","If the work is unpublished, enter the year it was written"); move(6,5); printw("%s","Years should be given in the four-digit form, ie. 1999"); move(8,5);refresh();getstr(year);set_year=1;break; default : break; } /* Check to see if we have all the info we need */ if (ch == 'z') { not_done =0; if (use_address==1 && set_address == 0) not_done++; if (use_annote==1 && set_annote==0) not_done++; if (use_author==1 && set_author==0) not_done++; if (use_booktitle==1 && set_booktitle==0) not_done++; if (use_chapter==1 && set_chapter==0) not_done++; if (use_edition==1 && set_edition==0) not_done++; if (use_editor==1 && set_editor==0) not_done++; if (use_howpublished==1 && set_howpublished==0) not_done++; if (use_institution==1 && set_institution==0) not_done++; if (use_journal==1 && set_journal==0) not_done++; if (use_key==1 && set_key ==0) not_done++; if (use_month==1 && set_month==0) not_done++; if (use_note==1 && set_note==0) not_done++; if (use_number==1 && set_number==0) not_done++; if (use_organisation==1 && set_organisation==0) not_done++; if (use_pages==1 && set_pages==0) not_done++; if (use_publisher==1 && set_publisher==0) not_done++; if (use_school==1 && set_school==0) not_done++; if (use_series==1 && set_series==0) not_done++; if (use_title==1 && set_title==0) not_done++; if (use_type==1 && set_type==0) not_done++; if (use_volume==1 && set_volume==0) not_done++; if (use_year==1 && set_year==0) not_done++; if (not_done > 0) { setup_screen(); move(4,5); printw("%s %d %s","You can't finish yet - there are still",not_done,"required fields missing!"); move(10,5); printw("%s","Press a key"); cbreak(); ch = getch(); } else still_setting_up = 1; } } /* Create a key name for the new entry */ setup_screen(); move(4,5); printw("%s","Please enter an entry name for the new reference "); move(5,5); refresh(); nocbreak(); getstr(entry_name); /* Add our new entry to the output file */ fin = fopen(bibfile,"r"); if (fin == NULL) { endwin(); perror("Can't open BibTeX file for reading "); exit(1); } fout = fopen("bibcursed_tmp.out","w"); if (fout == NULL) { endwin(); perror("Can't write output file "); exit(1); } while((fgets(str, 99, fin)) > 0) { if (strchr(str, '@') != NULL) { entry_count++; /* We've found a reference name */ strcpy(str2, str); if (strchr(str2,'{') != NULL) key_name = (strchr(str2,'{')+1); else key_name = (strchr(str2,'(')+1); length = strlen(key_name); *(key_name + (length-2)) = 0; /* Check we haven't already used the entry name */ if (strcmp(key_name,entry_name) == 0) written_new = 2; /* If the current name comes after our new one, write the new one */ if (strcmp(key_name, entry_name) > 0) { if (written_new == 0) { /* Write entire new entry to file */ switch (entry_type) { case '1' : fprintf(fout, "@article{%s", entry_name); break; case '2' : fprintf(fout,"@book{%s", entry_name); break; case '3' : fprintf(fout,"@booklet{%s", entry_name); break; case '4' : fprintf(fout,"@inproceedings{%s", entry_name); break; case '5' : fprintf(fout,"@inbook{%s", entry_name); break; case '6' : fprintf(fout,"@incollection{%s", entry_name); break; case '7' : fprintf(fout,"@manual{%s", entry_name); break; case '8' : fprintf(fout,"@mastersthesis{%s", entry_name); break; case '9' : fprintf(fout,"@misc{%s", entry_name); break; case 'a' : fprintf(fout,"@phdthesis{%s", entry_name); break; case 'b' : fprintf(fout,"@proceedings{%s", entry_name); break; case 'c' : fprintf(fout,"@techreport{%s", entry_name); break; case 'd' : fprintf(fout,"@unpublished{%s", entry_name); break; default : break; } if (set_key == 1) fprintf(fout,",\n KEY={%s}", key); if (set_crossref == 1) fprintf(fout,",\n CROSSREF={%s}", crossref); if (set_author == 1) fprintf(fout,",\n AUTHOR={%s}",author); if (set_title == 1) fprintf(fout,",\n TITLE={%s}",title); if (set_booktitle == 1) fprintf(fout,",\n BOOKTITLE={%s}", booktitle); if (set_journal == 1) fprintf(fout,",\n JOURNAL={%s}", journal); if (set_series == 1) fprintf(fout,",\n SERIES={%s}", series); if (set_edition == 1) fprintf(fout,",\n EDITION={%s}", edition); if (set_volume == 1) fprintf(fout,",\n VOLUME={%s}", volume); if (set_number == 1) fprintf(fout,",\n NUMBER={%s}", number); if (set_type == 1) fprintf(fout,",\n TYPE={%s}", type); if (set_chapter == 1) fprintf(fout,",\n CHAPTER={%s}", chapter); if (set_pages == 1) fprintf(fout,",\n PAGES={%s}", pages); if (set_editor == 1) fprintf(fout,",\n EDITOR={%s}", editor); if (set_institution == 1) fprintf(fout,",\n INSTITUTION={%s}", institution); if (set_organisation == 1) fprintf(fout,",\n ORGANIZATION={%s}", organisation); if (set_school == 1) fprintf(fout,",\n SCHOOL={%s}", school); if (set_publisher == 1) fprintf(fout,",\n PUBLISHER={%s}", publisher); if (set_address == 1) fprintf(fout,",\n ADDRESS={%s}",address); if (set_howpublished == 1) fprintf(fout,",\n HOWPUBLISHED={%s}", howpublished); if (set_month == 1) fprintf(fout,",\n MONTH={%s}", month); if (set_year == 1) fprintf(fout,",\n YEAR={%s}", year); if (set_annote == 1) fprintf(fout,",\n ANNOTE={%s}",annote); if (set_note == 1) fprintf(fout,",\n NOTE={%s}", note); fprintf(fout,"\n }\n\n"); written_new = 1; rec_count++; } } } /* Write the input line to the output file */ fputs(str, fout); } //if (entry_count == 0) if (written_new == 0) { /* This is a bit of a hack. This function adds the new record when it comes across a record that comes after it. If the new record comes after all the present ones, or the bibfile is empty, it won't work. This bit of code writes the new record at the end of the file if no other records were found */ switch (entry_type) { case '1' : fprintf(fout, "@article{%s", entry_name); break; case '2' : fprintf(fout,"@book{%s", entry_name); break; case '3' : fprintf(fout,"@booklet{%s", entry_name); break; case '4' : fprintf(fout,"@inproceedings{%s", entry_name); break; case '5' : fprintf(fout,"@inbook{%s", entry_name); break; case '6' : fprintf(fout,"@incollection{%s", entry_name); break; case '7' : fprintf(fout,"@manual{%s", entry_name); break; case '8' : fprintf(fout,"@mastersthesis{%s", entry_name); break; case '9' : fprintf(fout,"@misc{%s", entry_name); break; case 'a' : fprintf(fout,"@phdthesis{%s", entry_name); break; case 'b' : fprintf(fout,"@proceedings{%s", entry_name); break; case 'c' : fprintf(fout,"@techreport{%s", entry_name); break; case 'd' : fprintf(fout,"@unpublished{%s", entry_name); break; default : break; } if (set_key == 1) fprintf(fout,",\n KEY={%s}", key); if (set_crossref == 1) fprintf(fout,",\n CROSSREF={%s}", crossref); if (set_author == 1) fprintf(fout,",\n AUTHOR={%s}",author); if (set_title == 1) fprintf(fout,",\n TITLE={%s}",title); if (set_booktitle == 1) fprintf(fout,",\n BOOKTITLE={%s}", booktitle); if (set_journal == 1) fprintf(fout,",\n JOURNAL={%s}", journal); if (set_series == 1) fprintf(fout,",\n SERIES={%s}", series); if (set_edition == 1) fprintf(fout,",\n EDITION={%s}", edition); if (set_volume == 1) fprintf(fout,",\n VOLUME={%s}", volume); if (set_number == 1) fprintf(fout,",\n NUMBER={%s}", number); if (set_type == 1) fprintf(fout,",\n TYPE={%s}", type); if (set_chapter == 1) fprintf(fout,",\n CHAPTER={%s}", chapter); if (set_pages == 1) fprintf(fout,",\n PAGES={%s}", pages); if (set_editor == 1) fprintf(fout,",\n EDITOR={%s}", editor); if (set_institution == 1) fprintf(fout,",\n INSTITUTION={%s}", institution); if (set_organisation == 1) fprintf(fout,",\n ORGANIZATION={%s}", organisation); if (set_school == 1) fprintf(fout,",\n SCHOOL={%s}", school); if (set_publisher == 1) fprintf(fout,",\n PUBLISHER={%s}", publisher); if (set_address == 1) fprintf(fout,",\n ADDRESS={%s}",address); if (set_howpublished == 1) fprintf(fout,",\n HOWPUBLISHED={%s}", howpublished); if (set_month == 1) fprintf(fout,",\n MONTH={%s}", month); if (set_year == 1) fprintf(fout,",\n YEAR={%s}", year); if (set_annote == 1) fprintf(fout,",\n ANNOTE={%s}",annote); if (set_note == 1) fprintf(fout,",\n NOTE={%s}", note); fprintf(fout,"\n }\n\n"); written_new = 3; rec_count++; } fclose(fin); fclose(fout); /* Rename the original bibTeX file to bibfile.old */ strcpy(out_string, "cp "); strcat(out_string, bibfile); strcat(out_string, " bibfile.old"); system(out_string); /* Rename the output from bibcursed_tmp.out to the original filename */ strcpy(out_string, "mv bibcursed_tmp.out "); strcat(out_string, bibfile); system(out_string); /* Report on success or otherwise */ move(7,5); switch(written_new) { case 0 : printw("%s","No new entry was written. Press any key"); break; case 1 : printw("%s","New entry was successfully written. Press a key"); break; case 2 : printw("%s","Entry name already exists - new entry not added. Press a key"); break; case 3 : printw("%s","New entry was added to the end of the file. Press a key"); break; default : break; } cbreak(); ch = getch(); } delete_entry() { char entry_name[100], str[100], str2[100], out_string[100], ch; char *key_name; FILE *fin, *fout; int record_found = 0, length, dont_output = 0, removed_something=0; setup_screen(); move(4,5); printw("%s","Enter the name of the entry to delete"); move(5,5); refresh(); nocbreak(); getstr(entry_name); fin = fopen(bibfile,"r"); fout = fopen("bibcursed_tmp.out","w"); if (fout == NULL) { endwin(); perror("Could not open file for output "); exit(1); } while((fgets(str, 99, fin)) > 0) { if (strchr(str, '@') != NULL) { strcpy(str2, str); if (strchr(str2,'{') != NULL) key_name = (strchr(str2,'{')+1); else key_name = (strchr(str2,'(')+1); length = strlen(key_name); *(key_name + (length-2)) = 0; if (strcmp(key_name,entry_name) == 0) { /* Skip this entry */ dont_output = 1; removed_something = 1; rec_count--; move(7,5); printw("%s removed",key_name); } else { dont_output = 0; fputs(str, fout); } } else if (dont_output == 0) { fputs(str, fout); } } fclose(fin); fclose(fout); move(10,5); if (removed_something == 0) { printw("%s","Record not found - nothing removed"); move(12,5); } printw("%s","Press any key"); cbreak(); refresh(); ch = getch(); if (removed_something == 1) { /* Only do all the renaming and moving if we deleted something */ strcpy(out_string, "cp "); strcat(out_string, bibfile); strcat(out_string, " bibfile.old"); system(out_string); strcpy(out_string, "mv bibcursed_tmp.out "); strcat(out_string, bibfile); system(out_string); } } int field_menu(int priority, int field_set, char *fieldname) { int ret_val = 0; if (priority != 0) { if (priority == 1) { attron(A_BOLD); printw("%s ", fieldname); attroff(A_BOLD); } else printw("%s ", fieldname); if (field_set == 1) addch('*'); ret_val = 1; } return(ret_val); } change_entry() { char entry_name[100], str[100], ch, lch; int record_found = 0, found_record = 0, print_pos = 6, record_count = 0; FILE *fin; setup_screen(); move(4,5); printw("%s","Please enter the record name : "); refresh(); nocbreak(); getstr(entry_name); fin = fopen(bibfile, "r"); if (fin == NULL) return(1); move(print_pos,1); while ((fgets(str, 99, fin)) > 0) { if (strchr(str, '@') != NULL) { if (strstr(str,entry_name) != 0) { if (record_count > 0) { printw("%s","More than one match! Be more specific! Any key for next match"); refresh(); cbreak(); ch = getch(); setup_screen(); move(4,0); refresh(); } record_found = 1; found_record = 1; record_count++; } else record_found = 0; } if (record_found == 1) { printw("%s",str); print_pos++; } } fclose(fin); move(print_pos + 1, 5); if (found_record == 0) { printw("%s","The record name was not found! "); printw("%s","Press a key"); refresh(); cbreak(); ch = getch(); return(0); } if (record_count > 1) printw("%s","You must give a unique ID to change a field - try again"); else printw("%s","Press C to change a field or any other key to return to the menu"); refresh(); cbreak(); ch = getch(); lch = tolower(ch); if (lch == 'c') change_field(entry_name); } change_field(char *entry_name) { char ch, lch; char *field_name, *lfield_name, *key_name; char field_data[200], str[200], out_string[100]; FILE *fin, *fout; int in_record = 0, changed_field = 0; setup_screen(); move(4,5); printw("%s","Select a field to add/replace."); move(5,5); printw("%s","Note that not all are valid for every entry type!"); move(6,5); printw("%s","If in doubt, don't add anything that isn't there already"); move(8,8); printw("%s","1. Address D. Month"); move(9,8); printw("%s","2. Annote E. Note"); move(10,8); printw("%s","3. Author F. Number"); move(11,8); printw("%s","4. Booktitle G. Organisation"); move(12,8); printw("%s","5. Chapter H. Pages"); move(13,8); printw("%s","6. Crossref I. Publisher"); move(14,8); printw("%s","7. Edition J. School"); move(15,8); printw("%s","8. Editor K. Series"); move(16,8); printw("%s","9. Howpublished L. Title"); move(17,8); printw("%s","A. Institution M. Type"); move(18,8); printw("%s","B. Journal N. Volume"); move(19,8); printw("%s","C. Key O. Year"); move(21,8);printw("%s","Make your choice or press q to quit"); refresh(); cbreak(); ch = getch(); lch = toupper(ch); if (lch == 'q') return(0); switch(lch) { case '1' : field_name = "ADDRESS"; lfield_name="address"; break; case '2' : field_name = "ANNOTE"; lfield_name="annote"; break; case '3' : field_name = "AUTHOR"; lfield_name="author"; break; case '4' : field_name = "BOOKTITLE"; lfield_name="booktitle";break; case '5' : field_name = "CHAPTER"; lfield_name="chapter";break; case '6' : field_name = "CROSSREF"; lfield_name="crossref";break; case '7' : field_name = "EDITION"; lfield_name="edition";break; case '8' : field_name = "EDITOR"; lfield_name="editor";break; case '9' : field_name = "HOWPUBLISHED";lfield_name="howpublished";break; case 'A' : field_name = "INSTITUTION";lfield_name="institution";break; case 'B' : field_name = "JOURNAL";lfield_name="journal";break; case 'C' : field_name = "KEY";lfield_name="key";break; case 'D' : field_name = "MONTH";lfield_name="month";break; case 'E' : field_name = "NOTE";lfield_name="note";break; case 'F' : field_name = "NUMBER";lfield_name="number";break; case 'G' : field_name = "ORGANIZATION";lfield_name="organization";break; case 'H' : field_name = "PAGES"; lfield_name = "pages";break; case 'I' : field_name = "PUBLISHER";lfield_name = "publisher";break; case 'J' : field_name = "SCHOOL";lfield_name="school";break; case 'K' : field_name = "SERIES";lfield_name="series";break; case 'L' : field_name = "TITLE"; lfield_name="title"; break; case 'M' : field_name = "TYPE"; lfield_name="type";break; case 'N' : field_name = "VOLUME"; lfield_name="volume";break; case 'O' : field_name = "YEAR";lfield_name = "year"; break; default: return(0); break; } setup_screen(); move(4,5); printw("%s %s %s","Enter data for",lfield_name,"and press return to finish"); move(5,5); printw("%s","To delete the field, just press return"); move(7,1); refresh(); nocbreak(); getstr(field_data); fin = fopen(bibfile,"r"); if (fin == NULL) return(0); fout = fopen("bibcursed_tmp.out","w"); if (fout == NULL) { endwin(); perror("Couldn't open temp output file "); exit(1); } while((fgets(str, 99, fin)) > 0) { if (strchr(str, '@') != NULL) { if (strchr(str,'{') != NULL) key_name = (strchr(str,'{')+1); else key_name = (strchr(str,'(')+1); /* This is a record */ if (strstr(key_name, entry_name) != NULL) { /* This is the right record */ fputs(str,fout); if (strlen(field_data) > 0) fprintf(fout," %s={%s},\n",field_name,field_data); in_record = 1; changed_field = 1; } else { fputs(str,fout); in_record = 0; } } else { /* Make sure we don't write the new field we've just replaced */ if (in_record == 1) { if (strstr(str,field_name) == NULL) { if (strstr(str,lfield_name) == NULL) fputs(str,fout); } } else fputs(str,fout); } } fclose(fin); fclose(fout); strcpy(out_string, "cp "); strcat(out_string, bibfile); strcat(out_string, " bibfile.old"); system(out_string); strcpy(out_string, "mv bibcursed_tmp.out "); strcat(out_string, bibfile); system(out_string); move(10,5); if (changed_field == 1) printw("%s","Change made - press a key"); else printw("%s","No changes made - press a key"); refresh(); cbreak(); ch = getch(); } search_file(int what) { /* Search the file using the supplied option */ char search_term[100]; char *key_name; char str[100], str2[100]; char ch; char *search_type, *search_type2; FILE *fin; int print_pos = 6; int entries_found = 0; int author_found; int total_entries = 0; int every = 0; setup_screen(); move(4,5); printw("%s", "Please enter "); switch(what) { case 1 : printw("%s","author surname "); search_type = "AUTHOR"; search_type2 = "author"; break; case 2 : printw("%s","principle author surname "); search_type = "AUTHOR"; search_type2 = "author"; break; case 3 : printw("%s","surname of author to link to "); search_type="AUTHOR"; search_type2 = "author"; break; case 4 : printw("%s","title (or partial title) "); search_type = "TITLE"; search_type2 = "title"; break; case 5 : printw("%s","conference or journal name "); search_type = "JOURNAL"; search_type2 = "journal"; break; case 6 : printw("%s","name of university or institution "); search_type = "SCHOOL"; search_type2 = "school"; break; case 7 : printw("%s","year "); search_type = "YEAR"; search_type2 = "year"; break; case 8 : printw("%s","keyword "); search_type2 = "all"; every = 1; break; case 9 : printw("%s","name of organisation "); search_type = "ORGANIZATION"; search_type2="organization"; break; default : printw("%s","nothing (error)\n"); search_menu(); break; } printf("for search : "); refresh(); getstr(search_term); setup_screen(); move(4,5); printw("%s","Searching for "); attron(A_BOLD); printw("%s", search_term); attroff(A_BOLD); refresh(); fin = fopen(bibfile, "r"); if (fin == NULL) { perror("Cant open BibTeX file "); exit(1); } while ((fgets(str, 99, fin)) > 0) { author_found = 0; if (strchr(str, '@') != NULL) { if (strchr(str, '{') != NULL) { key_name = (strchr(str, '{') + 1); } else { key_name = (strchr(str, '(') + 1); } while (author_found == 0) { if (fgets(str2, 99, fin) == NULL) break; if ((strstr(str2, search_type) != NULL) || (strstr(str2, search_type2) != NULL) || every == 1) { if (strstr(str2, search_term) != NULL) { move(print_pos,5); printw("%s", key_name); move(print_pos+1, 8); printw("%s", str2); print_pos = print_pos + 2; entries_found++; total_entries++; if (entries_found == ((LINES - 9)/2)) { move(print_pos+1,5); printw("%s","Press any key for more results"); refresh(); cbreak(); ch = getch(); entries_found = 0; print_pos = 6; clear(); setup_screen(); move(4,5); printw("%s","Searching for "); attron(A_BOLD); printw("%s", search_term); attroff(A_BOLD); } refresh(); } author_found = 1; } } } } fclose(fin); move(print_pos+1,5); printw("%s %d %s","That's it -", total_entries, "match. Press any key"); refresh(); cbreak(); ch = getch(); } void add_bold(char letter) { /* Add the supplied char in bold to the current position */ attron(A_BOLD); addch(letter); attroff(A_BOLD); } search_menu() { /* Display the first search menu */ int ch, lch, type; setup_screen(); move(4,5); printw("Search by :"); move(6,8); add_bold('A'); printw("uthor"); move(7,8); add_bold('P'); printw("%s","rinciple author only"); move(8,8); add_bold('L'); printw("%s","inked authors"); move(9,8); add_bold('T'); printw("%s","itle"); move(10,8); add_bold('J'); printw("%s","ournal or conference title"); move(11,8); add_bold('U'); printw("%s","niversity or institution (for thesis)"); move(12,8); add_bold('O'); printw("%s","rganisation (for proceedings etc)"); move(13,8); add_bold('Y'); printw("%s","ear"); move(14,8); add_bold('E'); printw("%s","verything (keyword for all fields)"); move(15,8); add_bold('Q'); printw("%s","uit and return to main menu"); move(17,8); printw("What now? "); refresh(); cbreak(); ch = getch(); lch = tolower(ch); switch(lch) { case 'a' : search_file(1); break; case 'p' : search_file(2); break; case 'l' : search_file(3); break; case 't' : search_file(4); break; case 'j' : search_file(5); break; case 'u' : search_file(6); break; case 'y' : search_file(7); break; case 'e' : search_file(8); break; case 'o' : search_file(9); break; case 'q' : return(0); break; default : menu(); break ; } } quit_prog() { endwin(); exit(0); } main(int argc, char *argv[]) { int ch, i; char str[100]; FILE *fin; printf("Bibcursed 2.0.1 (c)1999-2007 Dominic Tristram. GPL applies\n"); sleep(1); if (argc != 2) { printf("%s requires a BibTeX file as its argument\n", argv[0]); exit(1); } strcpy(bibfile, argv[1]); fin = fopen(bibfile, "r"); if (fin == NULL) { printf("Can't open %s for reading\n", bibfile); exit(1); } while ((fgets(str, 10, fin)) > 0) { if (str[0] == '@') rec_count++; } printf("There are %d BibTeX entries in %s\n", rec_count, argv[1]); fclose(fin); initscr(); while (1 != 0) menu(); } bibcursed/gpl.txt0000644000076500007650000004313207430036556015456 0ustar dominicdominic00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. bibcursed/INSTALL0000644000076500007650000000170007430036556015157 0ustar dominicdominic00000000000000 INSTALLATION Installation is simple... - There are two versions of the makefile. One is for systems with ncurses (such as Linux and FreeBSD), while the other is for systems with curses, such as Solaris. If you are using an ncuses system, rename Makefile.ncurses to 'Makefile'. If you are using a curses-based system, do the same with the Makefile.curses file. - Edit the makefile and change INSTDIR to your chosen binary installation directory. If you do not have root permissions, this must be somewhere you have write access, such as your home directory. Ideally this location would be in your PATH. - Change the MANDIR to point to your man page directory. Again, if you do not have root permissions this must be somewhere you can write to - type 'make' to compile - type 'make install' to install the binary and man page. This step is not strictly necessary, as you can just copy the files where you like bibcursed/Makefile.curses0000644000076500007650000000117007430577256017101 0ustar dominicdominic00000000000000# Generic UNIX makefile (has no ncurses library) # version $id$ all: bibcursed # Where to install INSTDIR=/usr/local/bin MANDIR=/usr/man/man1 bibcursed: bibcursed.c gcc -O -o bibcursed bibcursed.c -lcurses install: bibcursed @if [ -d $(INSTDIR) ]; \ then \ echo "Installing binary in $(INSTDIR)";\ cp bibtool $(INSTDIR);\ chmod 755 $(INSTDIR)/bibtool;\ else \ echo "Sorry, $(INSTDIR) does not exist";\ fi @if [ -d $(MANDIR) ]; \ then \ echo "Installing manual page in $(MANDIR)";\ cp bibcursed.1 $(MANDIR);\ chmod 644 $(MANDIR)/bibcursed.1;\ else \ echo "$(MANDIR) does not exist";\ fi bibcursed/Makefile.ncurses0000644000076500007650000000122007430577512017246 0ustar dominicdominic00000000000000# Linux makefile version $Id: Makefile.linux,v 1.1 1999/05/12 14:39:10 dbt93 Exp $ all: bibcursed # Where to install INSTDIR=/usr/local/bin MANDIR=/usr/man/man1 bibcursed: bibcursed.c gcc -O -o bibcursed bibcursed.c -lncurses install: bibcursed @if [ -d $(INSTDIR) ]; \ then \ echo "Installing binary in $(INSTDIR)";\ cp bibcursed $(INSTDIR);\ chmod 755 $(INSTDIR)/bibcursed;\ else \ echo "Sorry, $(INSTDIR) does not exist";\ fi @if [ -d $(MANDIR) ]; \ then \ echo "Installing manual page in $(MANDIR)";\ cp bibcursed.1 $(MANDIR);\ chmod 644 $(MANDIR)/bibcursed.1;\ else \ echo "$(MANDIR) does not exist";\ fi bibcursed/README0000644000076500007650000000725107430062305015004 0ustar dominicdominic00000000000000 INTRO Bibcursed is a simple program to make life a little easier when using BibTeX bibliographies. It currently provides these main functions: - Adding references to your bibliography. This is done with prompts so templates for the different entries (article, proceedings, etc) do not have to be remembered. Error checking is used so that the required fields have to be supplied, and incorrect fields cannot be entered. New entries are inserted into the 'correct' place in the BibTeX file - Clean and easy removal of entries - Viewing of entries and changing of fields - Easy searching of entries, including search by field This project used to be called 'Bibtool', but the name has been changed to avoid a clash with a previous BibTeX tool with the same name. Wish list for future versions: - Beautification and error checking of BibTeX files - Distributed servers enabling many users to use the same BibTeX file, either locally or on a remote machine. Multi-user security and protection is provided - Configurable preferences INSTALLATION Please see the included INSTALL file USAGE To start the program, simply specify your BibTeX file on the command line, like so: bibcursed thesis.bib The main screen will appear. This will show the number of entries in the BibTeX database in the to right corner. Selectable options will be listed near the middle of the screen. To select an option, press the key highlighted in the option line. For example, the line 'Delete an entry' features the first 'd' in bold. Pressing the 'd' key will select that option. The search and query option enables you to select one of several fields to search in. To find all references written by 'Jones' for example, you would press 'a' to choose 'Author', then type in 'Jones'. This procedure is similar for all other fields. All of the references containing the chosen author name will then be listed. The list is formed of the record name followed by the entry for author. Remember that bibtool is *always* case sensitive when searching! Using the record name found with the search option, the entry can then be deleted using the delete option, or changed with the change option (both accessed from the main screen). Note that to use these options it is necessary to remember the record name of the desired record, so keep a note of it! It is also possible to add a new entry to the database. To do this, press 'a' from the main screen. You must then choose the type of entry to add (usually this is 'article' or 'conference') by entering the relevant number or letter listed next to the reference type. When a reference type has been selected the valid fields for that type are listed. You *must* enter something for the fields in bold - the others are optional. Once all of the required fields are entered, pressing Z will go to the next screen. Here you must enter a name for the reference. This must be unique, and it is a good idea to follow the same naming convention for all of your reference (author and year is usually a good idea, eg 'jones1999'). The entry will then be inserted into the BibTeX file in an alphabetically sorted position, ie 'jones1999' would go between 'ike1993' and 'king1997'. If you change your mind about adding the record, you can delete it with the delete option from the main menu. Note that alterations to the BibTeX file are made to a temporary file first. If there is a problem (such as a crash or power failure) while the program is running, the only data that could be lost is the current change. However, it is always a good idea to keep several backups of important files in different locations, just in case. DISTRIBUTION GNU GPL applies - see http://www.gnu.org