Commit e614b8d2 by biondo

Prima implementazione, fatta col culo in 20 min ma va.

parents
File added
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main( int argc, char **argv ){
if( argc != 2 ){
printf("ID changer error\n");
return 1;
}
char type[100], ID[1000], c;
int i, type_cnt = 0, ID_cnt = 0;
int start=0, startID=0;
for( i = 0; (c=getchar())!=','; i++ ){
if( c == '@'){
start=1;
continue;
}
if( !startID && start ){
if( c == '{' ){
type[type_cnt] = '\0';
startID = 1;
}
else type[type_cnt++] = c;
}
else
if(c != '{' ) ID[ID_cnt++] = c;
}
ID[ID_cnt]='\0';
printf("@%s{ %s,", type, argv[1] );
while( ( c=getchar() )!=-1 )
putchar(c);
return 0;
}
#! /bin/bash
DOI=$1
KEY=$2
BIBFILE=$3
curl -LH "Accept: text/bibliography; style=bibtex" https://dx.doi.org/$DOI | sed -e 's/}, /},\n\t/g' -e 's/, /,\n\t/' -e 's/}}/}\n}\n/g' -e 's/=/\t\t=\t/g' -e 's/publisher\t\t/publisher\t/g' | /home/mattia/.script/DOI_adder/IDchanger $KEY >> $BIBFILE
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment