More translations and fixed more bugs

This commit is contained in:
Jack-Benny Persson 2017-07-09 06:29:35 +02:00
parent 5cee1d5228
commit f96e86b100

View File

@ -32,7 +32,7 @@ int main(int argc, char* argv[])
int choice; int choice;
int opt; int opt;
if (argc != 2) if (argc < 2)
{ {
fprintf(stderr, "Usage: %s [-l] [-s] [-m [-m [-n] [-f filename]\n" fprintf(stderr, "Usage: %s [-l] [-s] [-m [-m [-n] [-f filename]\n"
"-l = list the articles in the database\n" "-l = list the articles in the database\n"
@ -83,10 +83,10 @@ int main(int argc, char* argv[])
/* Check if file exists, if it dosen't, create it */ /* Check if file exists, if it dosen't, create it */
if ( access(filename, R_OK|W_OK) != 0 ) if ( access(filename, R_OK|W_OK) != 0 )
{ {
printf("Kan inte öppna %s\n", filename); printf("Could not open %s\n", filename);
printf("Skapa filen och lägg till artiklar? (j/n): "); printf("Create the file and start adding records? (y/n): ");
create = getchar(); create = getchar();
if ( create == 'j' ) if ( create == 'y' )
{ {
numRec = 1; numRec = 1;
struct myData *data; struct myData *data;
@ -266,7 +266,7 @@ int new(struct myData *datap, int numRec)
for (;;) for (;;)
{ {
setbuf(stdin, NULL); setbuf(stdin, NULL);
printf("Name: ('done' if finish) "); printf("Name ('done' when finished): ");
fgets(datap->name, NAMEMAXLENGTH, stdin); fgets(datap->name, NAMEMAXLENGTH, stdin);
datap->name[strcspn(datap->name, "\n")] = '\0'; datap->name[strcspn(datap->name, "\n")] = '\0';