+ pipe = popen("llogin door -w -", "w");
+ if( !pipe || pipe == (void*)-1 ) {
+ #if DEBUG
+ printf("Door_DoDispense: llogin failure\n");
+ #endif
+ return -1;
+ }
+ if( fread(buf, 512, 1, pipe) == 0 ) return -1; // Flush!
+
+ // Send password
+ fputs(gsDoor_Password, pipe);
+ fputs("\n", pipe);
+ if( fread(buf, 512, 1, pipe) == 0 ) return -1; // Flush!
+
+ // ATH1 - Unlock door
+ fputs("ATH1\n", pipe);
+ if( fread(buf, 512, 1, pipe) == 0 ) return -1; // Flush!
+
+ // Wait before re-locking
+ sleep(DOOR_UNLOCKED_DELAY);
+
+ // Re-lock the door
+ fputs("ATH0\n", pipe);
+ if( fread(buf, 512, 1, pipe) == 0 ) return -1; // Flush!
+
+ pclose(pipe);
+
+ #if DEBUG
+ printf("Door_DoDispense: User %i opened door\n", User);
+ #endif