summaryrefslogtreecommitdiffstats
path: root/perl-install/share/po/sp.po
diff options
context:
space:
mode:
authorPablo Saratxaga <pablo@mandriva.com>2001-03-06 01:18:43 +0000
committerPablo Saratxaga <pablo@mandriva.com>2001-03-06 01:18:43 +0000
commit6f54840274c5f099d84c54f3024d3adcf700c336 (patch)
tree02a9960600a0c8c139204043fe00cee011dd3b44 /perl-install/share/po/sp.po
parente139e148db85283d4d6ae22f2d1400238a9dd174 (diff)
downloaddrakx-6f54840274c5f099d84c54f3024d3adcf700c336.tar
drakx-6f54840274c5f099d84c54f3024d3adcf700c336.tar.gz
drakx-6f54840274c5f099d84c54f3024d3adcf700c336.tar.bz2
drakx-6f54840274c5f099d84c54f3024d3adcf700c336.tar.xz
drakx-6f54840274c5f099d84c54f3024d3adcf700c336.zip
updated Lithuanian file
Diffstat (limited to 'perl-install/share/po/sp.po')
-rw-r--r--perl-install/share/po/sp.po145
1 files changed, 74 insertions, 71 deletions
diff --git a/perl-install/share/po/sp.po b/perl-install/share/po/sp.po
index 455dda5da..dada8d66a 100644
--- a/perl-install/share/po/sp.po
+++ b/perl-install/share/po/sp.po
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: DrakX VERSION\n"
-"POT-Creation-Date: 2001-03-05 17:31+0100\n"
+"POT-Creation-Date: 2001-03-06 01:04+0100\n"
"PO-Revision-Date: 2001-01-06 17:46+0200\n"
"Last-Translator: Jankovic Tomislav <tomaja@net.yu>\n"
"Language-Team: Serbian (cyrillic)\n"
@@ -523,7 +523,7 @@ msgid "Delay before booting default image"
msgstr "Пауза пре стартања default image-а"
#: ../../any.pm_.c:160 ../../any.pm_.c:735
-#: ../../install_steps_interactive.pm_.c:815 ../../netconnect.pm_.c:608
+#: ../../install_steps_interactive.pm_.c:815 ../../netconnect.pm_.c:610
#: ../../printerdrake.pm_.c:94 ../../printerdrake.pm_.c:128
#: ../../standalone/draknet_.c:508
msgid "Password"
@@ -1050,7 +1050,7 @@ msgid "horizontal nice looking aurora"
msgstr ""
#: ../../bootlook.pm_.c:131
-msgid "vertical traditionnal aurora"
+msgid "vertical traditional aurora"
msgstr ""
#: ../../bootlook.pm_.c:135
@@ -2239,7 +2239,7 @@ msgid ""
"hard drive.\n"
"\n"
"\n"
-" * Auto allocate:: this option allows you to automatically create Ext2 and "
+" * Auto allocate: this option allows you to automatically create Ext2 and "
"swap partitions in free space of your\n"
" hard drive.\n"
"\n"
@@ -2294,7 +2294,7 @@ msgid ""
"'bootstrap' partition of at least 1MB for use\n"
"by the yaboot bootloader. If you opt to make the partition a bit larger, say "
"50MB, you may find it a useful place to store \n"
-"a spare kernel and ramdisk image for emgergency boot situations."
+"a spare kernel and ramdisk image for emergency boot situations."
msgstr ""
"На овоj тaчки, морате избрати коjу\n"
"партициjу(e) желите да користите за инсталациjу новог Linux-Mandrake "
@@ -5736,8 +5736,8 @@ msgid ""
msgstr ""
"Изаберите мрeжни адаптер коjи желите да користите за конекциjу на интернет"
-#: ../../netconnect.pm_.c:375 ../../netconnect.pm_.c:664
-#: ../../netconnect.pm_.c:809 ../../standalone/drakgw_.c:228
+#: ../../netconnect.pm_.c:375 ../../netconnect.pm_.c:668
+#: ../../netconnect.pm_.c:813 ../../standalone/drakgw_.c:228
msgid "Network interface"
msgstr "Мрeжни интерфejс"
@@ -5761,62 +5761,62 @@ msgstr "ADSL конфигурацијa"
msgid "Do you want to start your connection at boot?"
msgstr "Да ли желите да стартуjетe конектовaње при стартaњу системa ?"
-#: ../../netconnect.pm_.c:599
+#: ../../netconnect.pm_.c:601
msgid "Please choose which serial port your modem is connected to."
msgstr "Изаберите серијски порт на који је модем повезан."
-#: ../../netconnect.pm_.c:604
+#: ../../netconnect.pm_.c:606
msgid "Dialup options"
msgstr "Dialup опције"
-#: ../../netconnect.pm_.c:605 ../../standalone/draknet_.c:505
+#: ../../netconnect.pm_.c:607 ../../standalone/draknet_.c:505
msgid "Connection name"
msgstr "Име конекције"
-#: ../../netconnect.pm_.c:606 ../../standalone/draknet_.c:506
+#: ../../netconnect.pm_.c:608 ../../standalone/draknet_.c:506
msgid "Phone number"
msgstr "Број телефона"
-#: ../../netconnect.pm_.c:607 ../../standalone/draknet_.c:507
+#: ../../netconnect.pm_.c:609 ../../standalone/draknet_.c:507
msgid "Login ID"
msgstr "ID за логовање"
-#: ../../netconnect.pm_.c:609 ../../standalone/draknet_.c:509
+#: ../../netconnect.pm_.c:611 ../../standalone/draknet_.c:509
msgid "Authentication"
msgstr "Аутентификација"
-#: ../../netconnect.pm_.c:609 ../../standalone/draknet_.c:509
+#: ../../netconnect.pm_.c:611 ../../standalone/draknet_.c:509
msgid "PAP"
msgstr "PAP"
-#: ../../netconnect.pm_.c:609 ../../standalone/draknet_.c:509
+#: ../../netconnect.pm_.c:611 ../../standalone/draknet_.c:509
msgid "Script-based"
msgstr "Базирано на скрипти"
-#: ../../netconnect.pm_.c:609 ../../standalone/draknet_.c:509
+#: ../../netconnect.pm_.c:611 ../../standalone/draknet_.c:509
msgid "Terminal-based"
msgstr "Базирано на терминалу"
-#: ../../netconnect.pm_.c:610 ../../standalone/draknet_.c:510
+#: ../../netconnect.pm_.c:612 ../../standalone/draknet_.c:510
msgid "Domain name"
msgstr "Име домена"
-#: ../../netconnect.pm_.c:611 ../../standalone/draknet_.c:511
+#: ../../netconnect.pm_.c:613 ../../standalone/draknet_.c:511
msgid "First DNS Server"
msgstr "Први DNS Сервер"
-#: ../../netconnect.pm_.c:612 ../../standalone/draknet_.c:512
+#: ../../netconnect.pm_.c:614 ../../standalone/draknet_.c:512
msgid "Second DNS Server"
msgstr "Други DNS Сервер"
-#: ../../netconnect.pm_.c:665
+#: ../../netconnect.pm_.c:669
msgid ""
"I'm about to restart the network device $netc->{NET_DEVICE}. Do you agree?"
msgstr ""
"Сада треба да се рестартуjе мрeжни уређај $netc->{NET_DEVICE}. Да ли се "
"слaжете ?"
-#: ../../netconnect.pm_.c:706
+#: ../../netconnect.pm_.c:710
msgid ""
"\n"
"You can disconnect or reconfigure your connection."
@@ -5824,7 +5824,7 @@ msgstr ""
"\n"
"Можете се дисконектовати или реконфигурисати конекциjу."
-#: ../../netconnect.pm_.c:706 ../../netconnect.pm_.c:709
+#: ../../netconnect.pm_.c:710 ../../netconnect.pm_.c:713
msgid ""
"\n"
"You can reconfigure your connection."
@@ -5832,11 +5832,11 @@ msgstr ""
"\n"
"Подеси интернет конфигурациjу"
-#: ../../netconnect.pm_.c:706
+#: ../../netconnect.pm_.c:710
msgid "You are currently connected to internet."
msgstr "Тренутно сте конектовани на Интернет"
-#: ../../netconnect.pm_.c:709
+#: ../../netconnect.pm_.c:713
msgid ""
"\n"
"You can connect to Internet or reconfigure your connection."
@@ -5844,50 +5844,50 @@ msgstr ""
"\n"
"Сада се можете конектовати на Интернет или реконфигурисати конекциjу"
-#: ../../netconnect.pm_.c:709
+#: ../../netconnect.pm_.c:713
msgid "You are not currently connected to Internet."
msgstr "Тренутно нисте конектовани на Интернет"
-#: ../../netconnect.pm_.c:713
+#: ../../netconnect.pm_.c:717
msgid "Connect to Internet"
msgstr "Конектуj на Интернет"
-#: ../../netconnect.pm_.c:715
+#: ../../netconnect.pm_.c:719
msgid "Disconnect from Internet"
msgstr "Дисконектуj са Интернетa"
-#: ../../netconnect.pm_.c:717
+#: ../../netconnect.pm_.c:721
msgid "Configure network connection (LAN or Internet)"
msgstr "Подеси мрeжну конфигурациjу(LAN или Интернет)"
-#: ../../netconnect.pm_.c:720
+#: ../../netconnect.pm_.c:724
msgid "Internet connection & configuration"
msgstr "Интернет конекциjа и конфигурациja"
-#: ../../netconnect.pm_.c:774 ../../netconnect.pm_.c:893
-#: ../../netconnect.pm_.c:906 ../../netconnect.pm_.c:913
-#: ../../netconnect.pm_.c:929
+#: ../../netconnect.pm_.c:778 ../../netconnect.pm_.c:897
+#: ../../netconnect.pm_.c:910 ../../netconnect.pm_.c:917
+#: ../../netconnect.pm_.c:933
#, fuzzy
msgid "Network Configuration Wizard"
msgstr "Подешавање мрежe"
-#: ../../netconnect.pm_.c:775
+#: ../../netconnect.pm_.c:779
msgid "External ISDN modem"
msgstr "Екстерни ISDN модем"
-#: ../../netconnect.pm_.c:775
+#: ../../netconnect.pm_.c:779
msgid "Internal ISDN card"
msgstr "Интерна ISDN картицa"
-#: ../../netconnect.pm_.c:775
+#: ../../netconnect.pm_.c:779
msgid "What kind is your ISDN connection?"
msgstr "Каква jе врста вaше ISDN кенекциjе ?"
-#: ../../netconnect.pm_.c:797 ../../netconnect.pm_.c:846
+#: ../../netconnect.pm_.c:801 ../../netconnect.pm_.c:850
msgid "Connect to the Internet"
msgstr "Конектуj на интернет"
-#: ../../netconnect.pm_.c:798
+#: ../../netconnect.pm_.c:802
#, fuzzy
msgid ""
"The most common way to connect with adsl is pppoe.\n"
@@ -5898,79 +5898,79 @@ msgstr ""
"Мeђутим, постоjе конекциjе коjе користе само dhcp.\n"
"Уколико не знатe коjа je, изаберитe 'use pppoe'"
-#: ../../netconnect.pm_.c:800
+#: ../../netconnect.pm_.c:804
#, fuzzy
msgid "use dhcp"
msgstr "dhcpd"
-#: ../../netconnect.pm_.c:800
+#: ../../netconnect.pm_.c:804
msgid "use pppoe"
msgstr "користи pppoe"
-#: ../../netconnect.pm_.c:800
+#: ../../netconnect.pm_.c:804
#, fuzzy
msgid "use pptp"
msgstr "користи pppoe"
-#: ../../netconnect.pm_.c:810
+#: ../../netconnect.pm_.c:814
#, fuzzy, c-format
msgid "I'm about to restart the network device %s. Do you agree?"
msgstr ""
"Сада треба да се рестартуjе мрeжни уређај $netc->{NET_DEVICE}. Да ли се "
"слaжете ?"
-#: ../../netconnect.pm_.c:847
+#: ../../netconnect.pm_.c:851
msgid ""
"Which dhcp client do you want to use?\n"
"Default is dhcpd"
msgstr "Ког dhcp клиjента желите да користитe ?Постављени jе dhcpd"
-#: ../../netconnect.pm_.c:862
+#: ../../netconnect.pm_.c:866
msgid "Network configuration"
msgstr "Подешавање мрежe"
-#: ../../netconnect.pm_.c:863
+#: ../../netconnect.pm_.c:867
msgid "Do you want to restart the network"
msgstr "Да ли хоћете да рестартуjeте мрежe?"
-#: ../../netconnect.pm_.c:874
+#: ../../netconnect.pm_.c:878
msgid "Sorry, the mail configuration is not yet implemented. Be patient."
msgstr ""
-#: ../../netconnect.pm_.c:879 ../../netconnect.pm_.c:1001
+#: ../../netconnect.pm_.c:883 ../../netconnect.pm_.c:1005
msgid "Network Configuration"
msgstr "Подешавање мрежe"
-#: ../../netconnect.pm_.c:880
+#: ../../netconnect.pm_.c:884
msgid ""
"Because you are doing a network installation, your network is already "
"configured.\n"
-"Click on Ok to reconfigure your Network/Internet connection, or cancel to "
-"skip the step.\n"
+"Click on Ok to keep your configuration, or cancel to reconfigure your "
+"Internet & Network connection.\n"
msgstr ""
-#: ../../netconnect.pm_.c:894
+#: ../../netconnect.pm_.c:898
msgid ""
"Welcome to The Network Configuration Wizard.\n"
"Which components do you want to configure?\n"
msgstr ""
-#: ../../netconnect.pm_.c:896
+#: ../../netconnect.pm_.c:900
#, fuzzy
msgid "Internet/Network access"
msgstr "Интернет"
-#: ../../netconnect.pm_.c:897
+#: ../../netconnect.pm_.c:901
#, fuzzy
msgid "Mail information"
msgstr "Прикажи информације"
-#: ../../netconnect.pm_.c:898
+#: ../../netconnect.pm_.c:902
#, fuzzy
msgid "Choose the profile to configure"
msgstr "Изаберите default (основног) корисникa:"
-#: ../../netconnect.pm_.c:907
+#: ../../netconnect.pm_.c:911
msgid ""
"Internet Connection\n"
"\n"
@@ -5978,73 +5978,76 @@ msgid ""
"If you don't want to use the auto detection, deselect the checkbox.\n"
msgstr ""
-#: ../../netconnect.pm_.c:909
+#: ../../netconnect.pm_.c:913
msgid "Use auto detection"
msgstr ""
-#: ../../netconnect.pm_.c:913 ../../printerdrake.pm_.c:19
+#: ../../netconnect.pm_.c:917 ../../printerdrake.pm_.c:19
msgid "Detecting devices..."
msgstr "Детектуjем урeђаje..."
-#: ../../netconnect.pm_.c:921
+#: ../../netconnect.pm_.c:925
#, fuzzy
msgid "Normal modem connection"
msgstr "Подеси нормалну модемске конекциjу"
-#: ../../netconnect.pm_.c:921
+#: ../../netconnect.pm_.c:925
#, fuzzy, c-format
msgid "detected on port %s"
msgstr "Дуплиранa тачка монтирања %s"
-#: ../../netconnect.pm_.c:922
+#: ../../netconnect.pm_.c:926
#, fuzzy
msgid "ISDN connection"
msgstr "Кабловска конекциja"
-#: ../../netconnect.pm_.c:922
+#: ../../netconnect.pm_.c:926
#, c-format
msgid "detected %s"
msgstr ""
-#: ../../netconnect.pm_.c:923
+#: ../../netconnect.pm_.c:927
#, fuzzy
msgid "DSL (or ADSL) connection"
msgstr "Подеси DSL (или ADSL) конекциjу"
-#: ../../netconnect.pm_.c:923
+#: ../../netconnect.pm_.c:927
#, fuzzy, c-format
msgid "detected on interface %s"
msgstr "Мрeжни интерфejс"
-#: ../../netconnect.pm_.c:924
+#: ../../netconnect.pm_.c:928
#, fuzzy
-msgid "Cable connecion"
+msgid "Cable connection"
msgstr "Кабловска конекциja"
-#: ../../netconnect.pm_.c:925
+#: ../../netconnect.pm_.c:929
#, fuzzy
msgid "LAN connection"
msgstr "Кабловска конекциja"
-#: ../../netconnect.pm_.c:925
+#: ../../netconnect.pm_.c:929
msgid "ethernet card(s) detected"
msgstr ""
-#: ../../netconnect.pm_.c:930
+#: ../../netconnect.pm_.c:934
msgid "How do you want to connect to the Internet?"
msgstr "Како желите да се конектуjете на интернет ?"
-#: ../../netconnect.pm_.c:951
+#: ../../netconnect.pm_.c:956
msgid ""
-"\n"
"Congratulation, The network and internet configuration is finished.\n"
"\n"
-"The configuration will now be applied to your system.\n"
+"The configuration will now be applied to your system."
+msgstr ""
+
+#: ../../netconnect.pm_.c:959
+msgid ""
"After that is done, we recommend you to restart your X\n"
"environnement to avoid hostname changing problem."
msgstr ""
-#: ../../netconnect.pm_.c:1002
+#: ../../netconnect.pm_.c:1006
msgid ""
"Now that your Internet connection is configured,\n"
"your computer can be configured to share its Internet connection.\n"
#n791'>791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242
package printer::main;

# $Id$

use strict;

use common;
use run_program;
use printer::data;
use printer::services;
use printer::default;
use printer::gimp;
use printer::cups;
use printer::office;
use printer::detect;
use services;

use vars qw(@ISA @EXPORT);

@ISA = qw(Exporter);
@EXPORT = qw(%printer_type %printer_type_inv);

#-location of the printer database in an installed system
my $PRINTER_DB_FILE = "/usr/share/foomatic/db/compiled/overview.xml";

#-Did we already read the subroutines of /usr/sbin/ptal-init?
my $ptalinitread = 0;

our %printer_type = (
    N("Local printer")                              => "LOCAL",
    N("Remote printer")                             => "REMOTE",
    N("Printer on remote CUPS server")              => "CUPS",
    N("Printer on remote lpd server")               => "LPD",
    N("Network printer (TCP/Socket)")               => "SOCKET",
    N("Printer on SMB/Windows 95/98/NT server")     => "SMB",
    N("Printer on NetWare server")                  => "NCP",
    N("Enter a printer device URI")                 => "URI",
    N("Pipe job into a command")                    => "POSTPIPE"
);

our %printer_type_inv = reverse %printer_type;

our %thedb;

#------------------------------------------------------------------------------

sub spooler {
    # LPD is taken from the menu for the moment because the classic LPD is
    # highly unsecure. Depending on how the GNU lpr development is going on
    # LPD support can be reactivated by uncommenting the following line.

    #return @spooler_inv{qw(cups lpd lprng pdq)};

    # LPRng is not officially supported any more since Mandrake 9.0, so
    # show it only in the spooler menu when it was manually installed.
    return map { $spoolers{$_}{long_name} } qw(cups pdq), if_(files_exist(qw(/usr/lib/filters/lpf /usr/sbin/lpd)), 'lprng');
}

sub printer_type($) {
    my ($printer) = @_;
    for ($printer->{SPOOLER}) {
	/cups/  && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB), if_($::expert, qw(URI))};
	/lpd/   && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), if_($::expert, qw(POSTPIPE URI))};
	/lprng/ && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), if_($::expert, qw(POSTPIPE URI))};
	/pdq/   && return @printer_type_inv{qw(LOCAL LPD SOCKET), if_($::expert, qw(URI))};
    }
}

sub SIGHUP_daemon {
    my ($service) = @_;
    if ($service eq "cupsd") { $service = "cups" };
    # PDQ has no daemon, exit.
    if ($service eq "pdq") { return 1 };
    # CUPS needs auto-correction for its configuration
    run_program::rooted($::prefix, "/usr/sbin/correctcupsconfig") if $service eq "cups";
    # Name of the daemon
    my %daemons = (
			    "lpr" => "lpd",
			    "lpd" => "lpd",
			    "lprng" => "lpd",
			    "cups" => "cupsd",
			    "devfs" => "devfsd",
			    );
    my $daemon = $daemons{$service};
    $daemon = $service unless defined $daemon;
#    if ($service eq "cups") {
#	# The current CUPS (1.1.13) dies on SIGHUP, do the normal restart.
#	printer::services::restart($service);
#	# CUPS needs some time to come up.
#	printer::services::wait_for_cups();
#    } else {

    # Send the SIGHUP
    run_program::rooted($::prefix, "/usr/bin/killall", "-HUP", $daemon);
    if ($service eq "cups") {
	# CUPS needs some time to come up.
	printer::services::wait_for_cups();
    }

    return 1;
}


sub assure_device_is_available_for_cups {
    # Checks whether CUPS already "knows" a certain port, it does not
    # know it usually when the appropriate kernel module is loaded
    # after CUPS was started or when the printer is turned on after
    # CUPS was started. CUPS 1.1.12 and newer refuses to set up queues
    # on devices which it does not know, it points these queues to
    # file:/dev/null instead. Restart CUPS if necessary to assure that
    # CUPS knows the device.
    my ($device) = @_;
    my ($result, $i);
    for ($i = 0; $i < 3; $i++) {
	local *F; 
	open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . 
	    "/bin/sh -c \"export LC_ALL=C; /usr/sbin/lpinfo -v\" |" or
	    die "Could not run \"lpinfo\"!";
	while (my $line = <F>) {
	    if ($line =~ /$device/) { # Found a line containing the device
		                      # name, so CUPS knows it.
		close F;
		return 1;
	    }
	}
	close F;
	$result = SIGHUP_daemon("cups");
    }
    return $result;
}


sub spooler_in_security_level {
    # Was the current spooler already added to the current security level?
    my ($spooler, $level) = @_;
    my $sp;
    $sp = $spooler eq "lpr" || $spooler eq "lprng" ? "lpd" : $spooler;
    my $file = "$::prefix/etc/security/msec/server.$level";
    if (-f $file) {
	local *F; 
	open F, "< $file" or return 0;
	while (my $line = <F>) {
	    if ($line =~ /^\s*$sp\s*$/) {
		close F;
		return 1;
	    }
	}
	close F;
    }
    return 0;
}

sub add_spooler_to_security_level {
    my ($spooler, $level) = @_;
    my $sp;
    $sp = $spooler eq "lpr" || $spooler eq "lprng" ? "lpd" : $spooler;
    my $file = "$::prefix/etc/security/msec/server.$level";
    if (-f $file) {
	local *F; 
	open F, ">> $file" or return 0;
	print F "$sp\n";
	close F;
    }
    return 1;
}

sub pdq_panic_button {
    my $setting = $_[0];
    if (-f "$::prefix/usr/sbin/pdqpanicbutton") {
        run_program::rooted($::prefix, "/usr/sbin/pdqpanicbutton", "--$setting")
	    or die "Could not $setting PDQ panic buttons!";
    }
}

sub copy_printer_params($$) {
    my ($from, $to) = @_;
    map { $to->{$_} = $from->{$_} } grep { $_ ne 'configured' } keys %$from; 
    #- avoid cycles-----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}

sub getinfo($) {
    my ($prefix) = @_;
    my $printer = {};

    $::prefix = $prefix;

    # Initialize $printer data structure
    resetinfo($printer);

    return $printer;
}

#------------------------------------------------------------------------------
sub resetinfo($) {
    my ($printer) = @_;
    $printer->{QUEUE} = "";
    $printer->{OLD_QUEUE} = "";
    $printer->{OLD_CHOICE} = "";
    $printer->{ARGS} = "";
    $printer->{DBENTRY} = "";
    $printer->{DEFAULT} = "";
    $printer->{currentqueue} = {};
    # -check which printing system was used previously and load the information
    # -about its queues
    read_configured_queues($printer);
}

sub read_configured_queues($) {
    my ($printer) = @_;
    my @QUEUES;
    # Get the default spooler choice from the config file
    $printer->{SPOOLER} ||= printer::default::get_spooler();
    if (!$printer->{SPOOLER}) {
	#- Find the first spooler where there are queues
	foreach my $spooler (qw(cups pdq lprng lpd)) {
	    #- Is the spooler's daemon running?
	    my $service = $spooler;
	    if ($service eq "lprng") {
		$service = "lpd";
	    }
	    if ($service ne "pdq") {
		next unless services::is_service_running($service);
		# daemon is running, spooler found
		$printer->{SPOOLER} = $spooler;
	    }
	    #- poll queue info 
	    local *F; 
	    open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . 
		"foomatic-configure -P -q -s $spooler |" or
		    die "Could not run foomatic-configure";
	    eval join('', <F>); 
	    close F;
	    if ($service eq "pdq") {
		#- Have we found queues? PDQ has no damon, so we consider
		#- it in use when there are defined printer queues
		if ($#QUEUES != -1) {
		    $printer->{SPOOLER} = $spooler;
		    last;
		}
	    } else {
		#- For other spoolers we have already found a running
		#- daemon when we have arrived here
		last;
	    }
	}
    } else {
	#- Poll the queues of the current default spooler
	local *F; 
	open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . 
	    "foomatic-configure -P -q -s $printer->{SPOOLER} |" or
		die "Could not run foomatic-configure";
	eval join('', <F>); 
	close F;
    }
    $printer->{configured} = {};
    my $i;
    my $N = $#QUEUES + 1;
    for ($i = 0;  $i < $N; $i++) {
	$printer->{configured}{$QUEUES[$i]{queuedata}{queue}} = 
	    $QUEUES[$i];
	if (!$QUEUES[$i]{make} || !$QUEUES[$i]{model}) {
	    if ($printer->{SPOOLER} eq "cups") {
		$printer->{OLD_QUEUE} = $QUEUES[$i]{queuedata}{queue};
		my $descr = get_descr_from_ppd($printer);
		$descr =~ m/^([^\|]*)\|([^\|]*)\|.*$/;
		$printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{make} ||= $1;
		$printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{model} ||= $2;
		# Read out which PPD file was originally used to set up this
		# queue
		local *F;
		if (open F, "< $::prefix/etc/cups/ppd/$QUEUES[$i]{queuedata}{queue}.ppd") {
		    while (my $line = <F>) {
			if ($line =~ /^\*%MDKMODELCHOICE:(.+)$/) {
			    $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{ppd} = $1;
			}
		    }
		    close F;
		}
		# Mark that we have a CUPS queue but do not know the name
		# the PPD file in /usr/share/cups/model
		if (!$printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{ppd}) {
		    $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{ppd} = '1';
		}
		$printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{driver} = 'CUPS/PPD';
		$printer->{OLD_QUEUE} = "";
		# Read out the printer's options
		$printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{args} = read_cups_options($QUEUES[$i]{queuedata}{queue});
	    }
	    $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{make} ||= "";
	    $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{model} ||= N("Unknown model");
	} else {
	    $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{make} = $QUEUES[$i]{make};
	    $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{model} = $QUEUES[$i]{model};
	}
	# Fill in "options" field
	if (my $args = $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{args}) {
	    my @options;
	    foreach my $arg (@{$args}) {
		push(@options, "-o");
		my $optstr = $arg->{name} . "=" . $arg->{default};
		push(@options, $optstr);
	    }
	    @{$printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{options}} = @options;
	}
	# Construct an entry line for tree view in main window of
	# printerdrake
	make_menuentry($printer, $QUEUES[$i]{queuedata}{queue});
    }
}

sub make_menuentry {
    my ($printer, $queue) = @_;
    my $spooler = $shortspooler_inv{$printer->{SPOOLER}}{short_name};
    my $connect = $printer->{configured}{$queue}{queuedata}{connect};
    my $localremote;
    if ($connect =~ m!^file:! || $connect =~ m!^ptal:/mlc:!) {
	$localremote = N("Local Printers");
    } else {
	$localremote = N("Remote Printers");
    }
    my $make = $printer->{configured}{$queue}{queuedata}{make};
    my $model = $printer->{configured}{$queue}{queuedata}{model};
    my $connection;
    if ($connect =~ m!^file:/dev/lp(\d+)$!) {
	my $number = $1;
	$connection = N(" on parallel port \#%s", $number);
    } elsif ($connect =~ m!^file:/dev/usb/lp(\d+)$!) {
	my $number = $1;
	$connection = N(", USB printer \#%s", $number);
    } elsif ($connect =~ m!^ptal:/(.+)$!) {
	my $ptaldevice = $1;
	if ($ptaldevice =~ /^mlc:par:(\d+)$/) {
	    my $number = $1;
	    $connection = N(", multi-function device on parallel port \#%s",
			    $number);
	} elsif ($ptaldevice =~ /^mlc:usb:/) {
	    $connection = N(", multi-function device on USB");
	} elsif ($ptaldevice =~ /^hpjd:/) {
	    $connection = N(", multi-function device on HP JetDirect");
	} else {
	    $connection = N(", multi-function device");
	}
    } elsif ($connect =~ m!^file:(.+)$!) {
	$connection = N(", printing to %s", $1);
    } elsif ($connect =~ m!^lpd://([^/]+)/([^/]+)/?$!) {
	$connection = N(" on LPD server \"%s\", printer \"%s\"", $2, $1);
    } elsif ($connect =~ m!^socket://([^/:]+):([^/:]+)/?$!) {
	$connection = N(", TCP/IP host \"%s\", port %s", $1, $2);
    } elsif ($connect =~ m!^smb://([^/\@]+)/([^/\@]+)/?$! ||
	     $connect =~ m!^smb://.*/([^/\@]+)/([^/\@]+)/?$! ||
	     $connect =~ m!^smb://.*\@([^/\@]+)/([^/\@]+)/?$!) {
	$connection = N(" on SMB/Windows server \"%s\", share \"%s\"", $1, $2);
    } elsif ($connect =~ m!^ncp://([^/\@]+)/([^/\@]+)/?$! ||
	     $connect =~ m!^ncp://.*/([^/\@]+)/([^/\@]+)/?$! ||
	     $connect =~ m!^ncp://.*\@([^/\@]+)/([^/\@]+)/?$!) {
	$connection = N(" on Novell server \"%s\", printer \"%s\"", $1, $2);
    } elsif ($connect =~ m!^postpipe:(.+)$!) {
	$connection = N(", using command %s", $1);
    } else {
	$connection = ($::expert ? ", URI: $connect" : "");
    }
    my $sep = "!";
    $printer->{configured}{$queue}{queuedata}{menuentry} = 
	($::expert ? "$spooler$sep" : "") .
	"$localremote$sep$queue: $make $model$connection";
}

sub read_printer_db(;$) {

    my $spooler = $_[0];

    my $dbpath = $::prefix . $PRINTER_DB_FILE;

    local *DBPATH; #- don't have to do close ... and don't modify globals at least
    # Generate the Foomatic printer/driver overview, read it from the
    # appropriate file when it is already generated
    if (!(-f $dbpath)) {
	open DBPATH, ($::testing ? $::prefix : "chroot $::prefix/ ") . #-#
	    "foomatic-configure -O -q |" or
		die "Could not run foomatic-configure";
    } else {
	open DBPATH, $dbpath or die "An error occurred on $dbpath : $!"; #-#
    }

    my $entry = {};
    my $inentry = 0;
    my $indrivers = 0;
    my $inautodetect = 0;
    local $_;
    while (<DBPATH>) {
	chomp;
	if ($inentry) {
	    # We are inside a printer entry
	    if ($indrivers) {
		# We are inside the drivers block of a printers entry
		if (m!^\s*</drivers>\s*$!) {
		    # End of drivers block
		    $indrivers = 0;
		} elsif (m!^\s*<driver>(.+)</driver>\s*$!) {
		    push @{$entry->{drivers}}, $1;
		}
	    } elsif ($inautodetect) {
		# We are inside the autodetect block of a printers entry
		# All entries inside this block will be ignored
		if (m!^.*</autodetect>\s*$!) {
		    # End of autodetect block
		    $inautodetect = 0;
		}
	    } else {
		if (m!^\s*</printer>\s*$!) {
		    # entry completed
		    $inentry = 0;
		    # Expert mode:
		    # Make one database entry per driver with the entry name
		    # manufacturer|model|driver
		    if ($::expert) {
			foreach my $driver (@{$entry->{drivers}}) {
			    my $driverstr;
			    if ($driver eq "Postscript") {
				$driverstr = "PostScript";
			    } else {
				$driverstr = "GhostScript + $driver";
			    }
			    if ($driver eq $entry->{defaultdriver}) {
				$driverstr .= " (recommended)";
			    }
			    $entry->{ENTRY} = "$entry->{make}|$entry->{model}|$driverstr";
			    $entry->{driver} = $driver;
			    # Duplicate contents of $entry because it is multiply entered to the database
			    map { $thedb{$entry->{ENTRY}}{$_} = $entry->{$_} } keys %$entry;
			}
		    } else {
			# Recommended mode
			# Make one entry per printer, with the recommended
			# driver (manufacturerer|model)
			$entry->{ENTRY} = "$entry->{make}|$entry->{model}";
			if ($entry->{defaultdriver}) {
			    $entry->{driver} = $entry->{defaultdriver};
			    map { $thedb{$entry->{ENTRY}}{$_} = $entry->{$_} } keys %$entry;
			}
		    }
		    $entry = {};
		} elsif (m!^\s*<id>\s*([^\s<>]+)\s*</id>\s*$!) {
		    # Foomatic printer ID
		    $entry->{printer} = $1;
		} elsif (m!^\s*<make>(.+)</make>\s*$!) {
		    # Printer manufacturer
		    $entry->{make} = uc($1);
		} elsif (m!^\s*<model>(.+)</model>\s*$!) {
		    # Printer model
		    $entry->{model} = $1;
		} elsif (m!<driver>(.+)</driver>!) {
		    # Printer default driver
		    $entry->{defaultdriver} = $1;
		} elsif (m!^\s*<drivers>\s*$!) {
		    # Drivers block
		    $indrivers = 1;
		    @{$entry->{drivers}} = (); 
		} elsif (m!^\s*<autodetect>\s*$!) {
		    # Autodetect block
		    $inautodetect = 1;
		}
	    }
	} else {
	    if (m!^\s*<printer>\s*$!) {
		# new entry
		$inentry = 1;
	    }
	}
    }
    close DBPATH;

    # Add raw queue
    if ($spooler ne "pdq") {
	$entry->{ENTRY} = N("Raw printer (No driver)");
	$entry->{driver} = "raw";
	$entry->{make} = "";
	$entry->{model} = N("Unknown model");
	map { $thedb{$entry->{ENTRY}}{$_} = $entry->{$_} } keys %$entry;
    }

    #- Load CUPS driver database if CUPS is used as spooler
    if ($spooler && $spooler eq "cups" && $::expert) {

	#&$install('cups-drivers') unless $::testing;
	#my $w;
	#if ($in) {
	#    $w = $in->wait_message(N("CUPS starting"),
	#			   N("Reading CUPS drivers database..."));
	#}
        poll_ppd_base();
    }

    #my @entries_db_short     = sort keys %printer::thedb;
    #%descr_to_db          = map { $printer::thedb{$_}{DESCR}, $_ } @entries_db_short;
    #%descr_to_help        = map { $printer::thedb{$_}{DESCR}, $printer::thedb{$_}{ABOUT} } @entries_db_short;
    #@entry_db_description = keys %descr_to_db;
    #db_to_descr          = reverse %descr_to_db;

}

sub read_foomatic_options ($) {
    my ($printer) = @_;
    # Generate the option data for the chosen printer/driver combo
    my $COMBODATA;
    local *F;
    open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . 
	"foomatic-configure -P -q -p $printer->{currentqueue}{printer}" .
	    " -d $printer->{currentqueue}{driver}" . 
		($printer->{OLD_QUEUE} ?
		  " -s $printer->{SPOOLER} -n $printer->{OLD_QUEUE}" : "") .
		($printer->{SPECIAL_OPTIONS} ?
		  " $printer->{SPECIAL_OPTIONS}" : "") 
		    . " |" or
	    die "Could not run foomatic-configure";
    eval join('', (<F>)); 
    close F;
    # Return the arguments field
    return $COMBODATA->{args};
}

sub read_cups_options ($) {
    my ($queue_or_file) = @_;
    # Generate the option data from a CUPS PPD file/a CUPS queue
    # Use the same Perl data structure as Foomatic uses to be able to
    # reuse the dialog
    local *F;
    if ($queue_or_file =~ /.ppd.gz$/) { # compressed PPD file
	open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . #-#
	    "gunzip -cd $queue_or_file | lphelp - |" or return 0;
    } else { # PPD file not compressed or queue
	open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . #-#
	    "lphelp $queue_or_file |" or return 0;
    }
    my $i;
    my $j;
    my @args;
    my $line;
    my $inoption = 0;
    my $inchoices = 0;
#    my $innumerical = 0;
    while ($line = <F>) {
	chomp $line;
	if ($inoption) {
	    if ($inchoices) {
		if ($line =~ /^\s*(\S+)\s+(\S.*)$/) {
		    push(@{$args[$i]{vals}}, {});
		    $j = $#{$args[$i]{vals}};
		    $args[$i]{vals}[$j]{value} = $1;
		    my $comment = $2;
		    # Did we find the default setting?
		    if ($comment =~ /default\)\s*$/) {
			$args[$i]{default} = $args[$i]{vals}[$j]{value};
			$comment =~ s/,\s*default\)\s*$//;
		    } else {
			$comment =~ s/\)\s*$//;
		    }
		    # Remove opening paranthese
		    $comment =~ s/^\(//;
		    # Remove page size info
		    $comment =~ s/,\s*size:\s*[0-9\.]+x[0-9\.]+in$//;
		    $args[$i]{vals}[$j]{comment} = $comment;
		} elsif ($line =~ /^\s*$/ && $#{$args[$i]{vals}} > -1) {
		    $inchoices = 0;
		    $inoption = 0;
		}
#	    } elsif ($innumerical == 1) {
#		if ($line =~ /^\s*The default value is ([0-9\.]+)\s*$/) {
#		    $args[$i]{default} = $1;
#		    $innumerical = 0;
#		    $inoption = 0;
#		}
	    } else {
		if ($line =~ /^\s*<choice>/) {
		    $inchoices = 1;
#		} elsif ($line =~ /^\s*<value> must be a(.*) number in the range ([0-9\.]+)\.\.([0-9\.]+)\s*$/) {
#		    delete($args[$i]{vals});
#		    $args[$i]{min} = $2;
#		    $args[$i]{max} = $3;
#		    my $type = $1;
#		    if ($type =~ /integer/) {
#			$args[$i]{type} = 'int';
#		    } else {
#			$args[$i]{type} = 'float';
#		    }
#		    $innumerical = 1;
		}
	    }
	} else {
	    if ($line =~ /^\s*([^\s:][^:]*):\s+-o\s+([^\s=]+)=<choice>\s*$/) {
#	    if ($line =~ /^\s*([^\s:][^:]*):\s+-o\s+([^\s=]+)=<.*>\s*$/) {
		$inoption = 1;
		push(@args, {});
		$i = $#args;
		$args[$i]{comment} = $1;
		$args[$i]{name} = $2;
		$args[$i]{type} = 'enum';
		@{$args[$i]{vals}} = ();
	    }
	}
    }
    close F;
    # Return the arguments field
    return \@args;
}

sub set_cups_special_options {
    my ($queue) = $_[0];
    # Set some special CUPS options
    my @lpoptions = chomp_(cat_("$::prefix/etc/cups/lpoptions"));
    # If nothing is already configured, set text file borders of half an inch
    # and decrease the font size a little bit, so nothing of the text gets
    # cut off by unprintable borders.
    if (!any { /$queue.*\s(page-(top|bottom|left|right)|lpi|cpi)=/ } @lpoptions) {
	run_program::rooted($::prefix, "lpoptions",
			    "-p", $queue,
			    "-o", "page-top=36", "-o", "page-bottom=36",
			    "-o", "page-left=36", "-o page-right=36",
			    "-o", "cpi=12", "-o", "lpi=7", "-o", "wrap");
    }
    # Let images fill the whole page by default
    if (!any { /$queue.*\s(scaling|natural-scaling|ppi)=/ } @lpoptions) {
	run_program::rooted($::prefix, "lpoptions",
			    "-p", $queue,
			    "-o", "scaling=100");
    }
    return 1;
}

sub set_cups_autoconf {
    my $autoconf = $_[0];

    # Read config file
    my $file = "$::prefix/etc/sysconfig/printing";
    my @file_content = cat_($file);

    # Remove all valid "CUPS_CONFIG" lines
    /^\s*CUPS_CONFIG/ and $_ = "" foreach @file_content;
 
    # Insert the new "CUPS_CONFIG" line
    if ($autoconf) {
	push @file_content, "CUPS_CONFIG=automatic\n";
    } else {
	push @file_content, "CUPS_CONFIG=manual\n";
    }

    output($file, @file_content);

    # Restart CUPS
    printer::services::restart("cups");

    return 1;
}

sub get_cups_autoconf {
    local *F;
    open F, "< $::prefix/etc/sysconfig/printing" or return 1;
    my $line;
    while ($line = <F>) {
	if ($line =~ m!^[^\#]*CUPS_CONFIG=manual!) {
	    return 0;
	}
    }
    return 1;
}

sub set_usermode {
    my $usermode = $_[0];
    $::expert = $usermode;

    # Read config file
    local *F;
    my $file = "$::prefix/etc/sysconfig/printing";
    my @file_content;
    if (!(-f $file)) {
	@file_content = ();
    } else {
	open F, "< $file" or die "Cannot open $file!";
	@file_content = <F>;
	close F;
    }

    # Remove all valid "USER_MODE" lines
    (/^\s*USER_MODE/ and $_ = "") foreach @file_content;
 
    # Insert the new "USER_MODE" line
    if ($usermode) {
	push @file_content, "USER_MODE=expert\n";
    } else {
	push @file_content, "USER_MODE=recommended\n";
    }

    # Write back modified file
    open F, "> $file" or die "Cannot open $file!";
    print F @file_content;
    close F;

    return 1;
}

sub get_usermode {
    my %cfg = getVarsFromSh("$::prefix/etc/sysconfig/printing");
    $::expert = $cfg{USER_MODE} eq 'expert' ? 1 : 0;
    return $::expert;
}

#----------------------------------------------------------------------
# Handling of /etc/cups/cupsd.conf

sub read_cupsd_conf {
    cat_("$::prefix/etc/cups/cupsd.conf");
}
sub write_cupsd_conf {
    my (@cupsd_conf) = @_;

    output("$::prefix/etc/cups/cupsd.conf", @cupsd_conf);

    #- restart cups after updating configuration.
    printer::services::restart("cups");
}

sub read_directives {

    # Read one or more occurences of a directive from the cupsd.conf file 
    # or from a ripped-out location block

    my ($lines_ptr, $directive) = @_;

    my @result = ();
    ($_ =~ /^\s*$directive\s+(\S.*)$/ and push(@result, $1)) 
	foreach @{$lines_ptr};
    (chomp) foreach @result;
    return @result;
}

sub read_unique_directive {

    # Read a directive from the from the cupsd.conf file or from a
    # ripped-out location block, if the directive appears more than once,
    # use the last occurence and remove all the others, if it does not
    # occur, return the default value

    my ($lines_ptr, $directive, $default) = @_;

    if ((my @d = read_directives($lines_ptr, $directive)) > 0) {
	my $value = @d[$#d];
	set_directive($lines_ptr, "$directive $value");
	return $value;
    } else {
        return $default;
    }
}

sub insert_directive {

    # Insert a directive into the cupsd.conf file or into a ripped-out
    # location block (but only if it is not already there)

    my ($lines_ptr, $directive) = @_;

    ($_ =~ /^\s*$directive$/ and return 0) foreach @{$lines_ptr};
    splice(@{$lines_ptr}, -1, 0, "$directive\n");
    return 1;
}

sub remove_directive {

    # Remove a directive from the cupsd.conf file or from a ripped-out
    # location block

    my ($lines_ptr, $directive) = @_;

    my $success = 0;
    ($_ =~ /^\s*$directive/ and $_ = "" and $success = 1)
	foreach @{$lines_ptr};
    return $success;
}

sub replace_directive {

    # Replace a directive in the cupsd.conf file or from a ripped-out
    # location block, if the directive appears more than once, remove
    # the additional occurences

    my ($lines_ptr, $olddirective, $newdirective) = @_;

    $newdirective = "$newdirective\n";
    my $success = 0;
    ($_ =~ /^\s*$olddirective/ and $_ = $newdirective and 
     $success = 1 and $newdirective = "") foreach @{$lines_ptr};
    return $success;
}

sub set_directive {

    # Set a directive in the cupsd.conf, replace the old definition or
    # a commented definition

    my ($cupsd_conf_ptr, $directive) = @_;

    my $olddirective = $directive;
    $olddirective =~ s/^\s*(\S+)\s+.*$/$1/s;

    return (replace_directive($cupsd_conf_ptr, $olddirective,
			      $directive) or
	    replace_directive($cupsd_conf_ptr, "\#$olddirective", 
			      $directive) or 
	    insert_directive($cupsd_conf_ptr, $directive));
}

sub read_location {

    # Return the lines inside the [path] location block
    #
    #   <Location [path]>
    #   ...
    #   </Location>

    my ($cupsd_conf_ptr, $path) = @_;

    my @result = ();
    if (grep(m!^\s*<Location\s+$path\s*>!, @{$cupsd_conf_ptr})) {
	my $location_start = -1;
	my $location_end = -1;
	# Go through all the lines, bail out when start and end line found
	for (my $i = 0; 
	     ($i <= $#{$cupsd_conf_ptr}) and ($location_end == -1);
	     $i++) {
	    if ($cupsd_conf_ptr->[$i] =~ m!^\s*<\s*Location\s+$path\s*>!) {
		# Start line of block
		$location_start = $i;
	    } elsif (($cupsd_conf_ptr->[$i] =~ 
		      m!^\s*<\s*/Location\s*>!) and
		     ($location_start != -1)) {
		# End line of block
		$location_end = $i;
		last;
	    } elsif (($location_start >= 0) and ($location_end < 0)) {
		# Inside the location block
		push(@result, $cupsd_conf_ptr->[$i]);
	    }
	}
    } else {
	# If there is no root location block, set the result array to
	# "undef"
	@result = undef;
    }
    return (@result);
}

sub rip_location {

    # Cut out the [path]  location block
    #
    #   <Location [path]>
    #   ...
    #   </Location>
    #
    # so that it can be treated seperately without affecting the
    # rest of the file

    my ($cupsd_conf_ptr, $path) = @_;

    my @location = ();
    my $location_start = -1;
    my $location_end = -1;
    if (grep(m!^\s*<Location\s+$path\s*>!, @{$cupsd_conf_ptr})) {
	# Go through all the lines, bail out when start and end line found
	for (my $i = 0; 
	     ($i <= $#{$cupsd_conf_ptr}) and ($location_end == -1);
	     $i++) {
	    if ($cupsd_conf_ptr->[$i] =~ m!^\s*<\s*Location\s+$path\s*>!) {
		# Start line of block
		$location_start = $i;
	    } elsif (($cupsd_conf_ptr->[$i] =~ 
		      m!^\s*<\s*/Location\s*>!) and
		     ($location_start != -1)) {
		# End line of block
		$location_end = $i;
		last;
	    }
	}
	# Rip out the block and store it seperately
	@location =