username = pwd->pw_name;
}
// Get balance
- snprintf(balance_str, sizeof balance_str, "$%i.%02i", giUserBalance/100, giUserBalance%100);
+ snprintf(balance_str, sizeof balance_str, "$%i.%02i", giUserBalance/100, abs(giUserBalance)%100);
// Enter curses mode
initscr();
// Width = 0, don't print
if( Width > 0 )
{
+ // 4 preceding, 5 price
+ int nameWidth = Width - 4 - 5;
move( Row, Col );
if( Index >= 0 )
{
case 0:
if( bHilighted )
- printw("-> ");
+ printw("-> ");
else
- printw(" ");
+ printw(" ");
break;
case 1:
- printw("SLD");
+ printw("SLD ");
break;
default:
case -1:
- printw("ERR");
+ printw("ERR ");
break;
}
- printw(" %s", name);
+ printw("%-*.*s", nameWidth, nameWidth, name);
- getyx(stdscr, _y, _x);
+// getyx(stdscr, _y, _x);
// Assumes max 4 digit prices
- times = Width - 5 - (_x - Col); // TODO: Better handling for large prices
- while(times--) addch(' ');
+// times = Width - 5 - (_x - Col); // TODO: Better handling for large prices
+// while(times--) addch(' ');
printw(" %4i", price);
}
printf("Dry Run - No action\n");
return 0;
}
+
+ // Sanity
+ if( Ammount == 0 ) {
+ printf("An ammount would be nice\n");
+ return 1;
+ }
sendf(Socket, "ADD %s %i %s\n", Username, Ammount, Reason);
buf = ReadLine(Socket);
if( Ammount < 0 ) {
printf("Sorry, you can only give, you can't take.\n");
- return -1;
+ return 1;
}
// Fast return on zero
if( Ammount == 0 ) {
printf("Are you actually going to give any?\n");
- return 0;
+ return 1;
}
// Check for a dry run
// Fast return on zero
if( Ammount == 0 ) {
printf("Are you actually going to give any?\n");
- return 0;
+ return 1;
}
// Check for a dry run