Ticket #34278: patch-getline_conflict_fix.diff

File patch-getline_conflict_fix.diff, 2.4 KB (added by icaines77@…, 13 years ago)

patch to rename getline() function that dominion defines.

  • misc.c

    diff -u ./misc.c ../dominion-2.8.2-new/misc.c
    old new  
    2626/* int interrupt() - handles interupts                             */
    2727/* show_nation(np) - displays a nation's characteristics           */
    2828/* free_nation_mark(wp,c) - tell us if the symbol is available     */
    29 /* getline(s,n) - read a line from stdin, remove \n                */
     29/* getline_internal(s,n) - read a line from stdin, remove \n       */
    3030/* get_crypt_pass(prompt,s,w) - get password and encrypt           */
    3131/* critical() - while writing, don't bug me!!                      */
    3232/* noncritical() - normal operation                                */
     
    161161  return 1;
    162162}
    163163
    164 void getline(char s[], int n)   /* read a line from stdin, remove \n */
     164void getline_internal(char s[], int n)  /* read a line from stdin, remove \n */
    165165{
    166166  fgets(s, n, stdin);
    167167  if (s[strlen(s)-1] == '\n') { /* remove \n if it is there */
  • printmap.c

    diff -u ./printmap.c ../dominion-2.8.2-new/printmap.c
    old new  
    470470
    471471  read_world(&world, WORLD_FILE);
    472472  fprintf(stderr, "Enter nation name: ");
    473   getline(nation, NAMELEN);
     473  getline_internal(nation, NAMELEN);
    474474  user.id = get_nation_id(nation);
    475475  get_crypt_pass("Your password: ", passwd, NULL, NULL);
    476476  if (strcmp(world.nations[user.id].passwd, passwd)) {
  • proto.h

    diff -u ./proto.h ../dominion-2.8.2-new/proto.h
    old new  
    100100int get_n_civil(Snation *np);
    101101int free_nation_mark(Sworld *wp, Symbol c);
    102102int get_n_soldiers(Snation *np);
    103 void getline(char s[], int n);
     103void getline_internal(char s[], int n);
    104104void get_crypt_pass(char prompt[], char pass[], WINDOW *w, char def_pass[]);
    105105void cpass(Snation *np, char pass[]);
    106106int which_mark(int x, int y, Suser *up);
  • user.c

    diff -u ./user.c ../dominion-2.8.2-new/user.c
    old new  
    6161  if (!innation)
    6262    {
    6363      printf("which nation would you like to play? ");
    64       getline(nation, NAMELEN);
     64      getline_internal(nation, NAMELEN);
    6565    }
    6666  if ((user.id = get_nation_id(nation)) == -1) {
    6767    printf ("\r\nnation does not exist, sorry\r\n");